If you search around the Internet, you may find many reports of problems with dual booting Windows and linux in a UEFI environment. There are a number of pitfalls, and I have stumbled over several of those.
The aim of this post is to explain how to do it and avoid the pitfalls. This is based on my own experience, with the UEFI BIOS for a Dell Inspiron 660 (BIOS version A05). Other UEFI systems may behave differently, though the suggestions that I give should work with most of them.
You can only do this with a 64 bit install. It won’t work with a 32 bit install. You need to be able to boot the install media in UEFI mode. You might have to experiment with that.
For my install, I copied the install DVD iso to an 8G USB stick, using dd_rescue:
# dd_rescue openSUSE-12.3-DVD-x86_64.iso /dev/sdf
Note that when I plug in a USB on this system, it shows up as “/dev/sdf”. You will need to check the device on your system if you are using a USB to install. Other methods are available to copy to the USB - check the wiki. DO NOT run “isohybrid” on the iso file.
I can also boot to UEFI mode with the live 64bit KDE image (again written to USB). The DVD is supposed to boot into UEFI mode without difficulty.
On my system, to boot a USB or DVD, I hit F12 during the early stages of boot. This is typical for a Dell. That brings up a menu. My system is set to allow both UEFI and Legacy MBR boots. The menu lists both. I choose the boot media (the USB) in UEFI mode if I want to boot it for install.
Other computers have different ways of setting the boot device. You will need to experiment with that to find out how to do it on your system.
If Windows 8 fills your entire disk, then you can try shrinking that in the Windows disk management tool (part of Windows 8). In my case, that cut Windows down to about half its original size. Another possibility is to add a second physical disk, and I actually did that. If you add a second physical disk, you should use gpt partitioning on it. You can set that up with “parted” or “gdisk” from the live media.
For the most part, installing is the same as ever. But there are two places where you have to be careful. One of those in the partitioning, and the other is the boot setup. I’ll discuss those in separate sections below. The software selection (if you use the DVD) is the same as you have done in the past. The post-install steps are also similar to what you have done in the past.
The most important install step, is to be sure that you have booted the install media in UEFI mode. If you booted in MBR mode, you will see the familiar boot screen with various options. If you booted in UEFI mode, the boot screen is a bit simpler with fewer options. If you are using live media, there’s a second way to tell. In the live system, before you start the install, try:
$ su - # efibootmgr
If you are in MBR mode, that will give an error. If you are in UEFI mode, that should provide information (probably about Windows booting).
The important step in partitioning, is to make sure that there is a partition assigned to be mounted as “/boot/efi”.
Your system will already have an EFI partition, setup for Windows. DO NOT USE the same EFI partition as Windows. If you added a second disk, then use the EFI partition that you should have created on the second disk. Otherwise, have the partitioner create a new EFI partition from free space, and use that. If you have created an EFI partition, then set it to be formatted. DO NOT format the EFI partition that Windows is using.
If you are creating an EFI partition, I suggest a size of 100M. On my box, the EFI partition that I created is using only 5M, but it is wise to allow some space for expansion. I actually allocated 500M for my EFI partition, but 100M should have ample spare space.
The reason for a separate EFI partition, is that Windows seems to have taken ownership of the EFI partition that it uses. If you try to reuse that, there is a risk that Windows will override your boot setup, and the system will only be able to boot Windows. By using a separate EFI partition, you avoid those risks.
Apart from the EFI partition (mounted at “/boot/efi”), the rest of partitioning is about as normal for other installs. If you plan to use an encrypted LVM, then you will need a separate “/boot” partition, and the installer will forget to tell you that.
The other place to be careful is in the boot setup. You get to that by clicking “Boot” on the installer screen.
The main thing to choose is which boot software to use. Make sure that you select “grub2-efi”. That should be the default, but some reports indicate that install from live media gets that wrong.
Once you have selected “grub2-efi”, there should be a second choice to configure for secure boot. I suggest that you check that box. Even if you do not plan to use secure boot, it does no harm to check that box.
Now that you have completed the partitioning and booting setup, you can proceed with the rest of the install.
Using in secure boot mode
If secure boot is enabled on your system, you might find it difficult to boot Windows. There will be an entry to boot Windows in the grub2-efi boot menu, but it probably won’t work. It will instead generate an odd error message. Personally, I think that’s a Microsoft bug, but the Microsoft people probably think it is a feature.
If I want to boot Windows on my box, there are two methods that work:
- I can hit the F12 key while booting. That brings up the boot menu from the UEFI BIOS, and there I can choose between Windows and opensuse.
- I can first boot to opensuse. Then, in a root command line, I can set the next boot to be from Windows.
For the second of those options, I use
which lists the boot options of the system. In my case it lists Windows as selection 0 and opensuse as selection 4.
I then type in
# efibootmgr -n 0
which specifies that the next boot should be from selection 0 which, for my system, will be Windows.
I then reboot the system, and it boots into windows.
Using with secure boot disabled
If secure boot is disabled, everything just works. The grub2-efi menu should have a choice for booting Windows, and it should work.
Learning the hard way
At one stage, I actually tried setting up my box sharing the EFI partition that Windows had created. And at first that seemed to work well. The grub2-efi menu had options to boot into opensuse and into Windows. I mostly used the opensuse entry, since that’s the system that I prefer.
I then tested booting into Windows. It worked very will. The system booted straight into Windows. Windows promptly changed the boot setup, and I lost the ability to boot into opensuse. There are many reports of similar problems that will turn up with a search. And that’s why I am advising that you do not try to share the Windows EFI partition.