Ubuntu – Add a non-UEFI boot target to an UEFI grub

dual-bootgrub2uefi

I have two disks in my system:

  1. Non-UEFI windows 10 install
  2. UEFI kubuntu 16.10

This system is my home server. I'm migrating from Windows to Kubuntu, but it will take a while since I can't yet duplicate the entire functionality. In the mean time I want to run dual boot so that I can run the server as was (windows) while I'm setting up the Kubuntu deploy in any spare time I get. So:

I'd like to add windows boot to grub's target list, however update-grub does not find my Windows bootloader.

I'm guessing the problem is that it's searching for an EFI boot while there is only a legacy BIOS one.

Is there a way I can add my Windows install as a grub target?

Best Answer

It's not possible to do this with GRUB; however, it is possible with my rEFInd boot manager:

  1. Install rEFInd using its Debian package or PPA.
  2. Edit /boot/efi/EFI/refind/refind.conf: Uncomment the scanfor line and ensure that hdbios is among the options.
  3. Reboot.

The result should be, in the rEFInd screen, options to boot Ubuntu and a gray diamond-shaped option that boots Windows. (If you have multiple disks, there may be multiple diamond boot options, one for each disk. If you've got multiple disks and just one such option and it doesn't work, uncomment the uefi_deep_legacy_scan option in refind.conf.)

If you want to test this process before installing anything on your hard disk, you can do so by using the USB flash drive image of rEFInd (available on its downloads page). You'll have to edit EFI/refind/refind.conf on the USB drive as just described -- but of course the mount point will be whatever it is, not /boot/efi.

One more caveat: rEFInd can boot a BIOS-mode boot loader on most EFI-based computers, but not on all of them. A few early EFIs used an EFI layered atop a conventional BIOS, rather than an EFI with a CSM. rEFInd won't be able to redirect to a BIOS-mode boot loader on those early EFIs. (The same is true on systems that lack either an underlying BIOS or a CSM, but you clearly don't have such a system if you're able to boot Windows in BIOS mode.)

There are three other options you might want to consider:

  • Re-install Ubuntu in BIOS/CSM/legacy mode. You'll need to learn to control your CSM so that you can boot the installer in the correct mode. See this page of mine for more on this topic.
  • Install a BIOS-mode boot loader for Linux. You can do this even in EFI mode, but if you're not comfortable with installing and configuring boot loaders, this can be a challenging task, and one that can easily go very badly wrong. Unfortunately, I don't have a pointer to a page that will provide step-by-step instructions, but such a page may well exist. As general advice, though, the Boot Repair should be able to do the job -- IF you boot an Ubuntu emergency disk in BIOS mode to run Boot Repair. (See my CSM link for information on controlling your boot mode.)
  • Convert Windows to boot in EFI mode. This blog post describes how to do this. This task is moderately difficult and carries some risk. Overall, it's probably riskier than installing a BIOS-mode boot loader for Linux; however, the documentation to which I've linked can help a lot.