Ubuntu – Converting Ubuntu 16.04 legacy mode to UEFI mode

dual-bootuefi

So it's time to ask my first question, something I've been struggling with for a while now. I know there are some questions around the same topic, however, none of them (which I could find) have been of any help.

Before you ask, I want to do some explaining of the core problem.

Why have I not just installed it in UEFI mode?

I was unable to boot the install (or live mode for that matter) in uefi mode. After some time spent searching on google I noticed that several people have had this exact problem: after the menu appears (the uefi one), whatever I do simply results in a black screen.

After reading this article https://help.ubuntu.com/community/UEFI, I though I'd try installing ubuntu in legacy mode, and then use boot-repair to convert my install to uefi.

NOTE: I am dual booting ubutnu alongside Windows 10. Currently I have to enter the bios settings to enable uefi boot in order to enter windows and vice versa.

What I have tried

Boot-repair

I then tried, of course, boot-repair while in a legacy mode session only to get this error message:

The current session is in Legacy mode. Please reboot the computer, and use this software in an EFI session. This will enable this feature. For example, use a live-USB of Boot-Repair-Disk-64bit (www.sourceforge.net/p/boot-repair-cd), after making sure your BIOS is set up to boot USB in EFI mode.

Boot-repair live usb

I tried creating a live usb with boot-repair 64bit only to encounter the same problem as when booting the ubuntu install

Why do I need to boot with UEFI?

Well I don't REALLY need too boot using UEFI, however, my current windows install does, and it would be great to be able to choose whether to boot windows or ubuntu without having to switch between legacy and uefi.

Need any more information?

Is there a way to manually create the /boot partition and do the necessary changes for my system to boot efi?

Other suggestions?

Thanks

EDIT:

While I have tried both on and off, secured boot has been turned off for most of my attempts.

Edit #2: (In response to Rod Smith and comments regarding more info)

  • I have tried rEFInd boot manager, it encounters the very same problem
  • I have tried rufus (Windows) and unetbootin (Ubuntu) for creating the usb media, both of which producing valid media (for other computers at least)
  • I have a friend with (almost) the same computer with the same problem
  • Very few distros work, Arch and Gentoo are among those who do work
  • I have a GTX 1060 card on a Multicom laptop
  • Windows does indeed use GPT and UEFI boot

Many of my assumptions have been made after reading this post right here: My computer boots to a black screen, what options do I have to fix it?

Especially the text right after something describing my problem:

There is no solution for these errors and the workaround is to disable UEFI to enable the Ubuntu installer to run in legacy mode; after which boot-repair can be used to install grub-efi which then allows/needs UEFI switched back on before Ubuntu will boot using UEFI.

I actually assumed I couldn't reach the F6 menu at all, but now I haven't had time to recheck that.

Best Answer

First, your problem of an inability to boot the installer in EFI mode was most likely the result of one or more of three things:

  • An incorrectly-prepared boot medium -- To boot in EFI mode, a boot medium must have an EFI-mode boot loader. Not all tools for creating bootable USB disks from .iso images, though, copy the necessary EFI boot loader files. Most notably, Pen Drive Linux (aka YUMI) does not create these files. Most other tools do create these files, but you might have used some obscure tool that does not. The solution to this problem is to use another tool to create the boot medium.
  • Incompatibility between your EFI and your boot medium -- On occasion, a disk that boots fine in EFI mode on one system will fail to boot in EFI mode on another one. This is because of quirks in the boot medium and in the EFI implementations. The solution, as in the previous case, is to use another tool to create the boot medium.
  • User error during the boot process -- You may need to select specific options to boot in EFI mode. Most importantly, your firmware must be configured to boot in EFI mode rather than in BIOS/CSM/legacy mode. You may also need to select the correct boot option; in many cases, you'll see two options to boot an external disk, one of which includes the string UEFI and the other of which does not. To boot in EFI mode, you must select the option that includes the string UEFI; the other option will boot in BIOS mode.

If you start the installer in BIOS mode, then the same tools and procedures will most likely start the Boot Repair utility in BIOS mode, too, and that will make a 100% complete and proper installation of an EFI-mode boot loader impossible. (There can be workarounds and hackish install of EFI-mode boot loaders from a BIOS-mode boot, though.)

You can read more about the problems with controlling BIOS-mode vs. EFI-mode booting on my Web page on the subject. Note that some online tutorials for installing Linux, especially older tutorials, give horrible advice on EFI mode; they recommend enabling the BIOS/CSM/legacy support (which is almost always a mistake) and ignore the issue of using appropriate tools for creating a bootable medium. My CSM page is intended to set the record straight on these issues.

In your specific case, I recommend you download and prepare the USB flash drive or CD-R version of my rEFInd boot manager. This tool works only in EFI mode, so if you can get it to boot, you're guaranteed that you're running rEFInd itself in EFI mode. On UEFI-based PCs, rEFInd defaults to booting only EFI-based OSes, so if you can boot Ubuntu from the rEFInd menu, Ubuntu will then be booted in EFI mode. You can then install rEFInd using its PPA or Debian package, run Boot Repair, or manually install the EFI version of GRUB. Any of these actions should get your computer booting in EFI mode directly, without using the rEFInd USB drive or CD-R.

Before you go too far down this road, though, you should check your current Windows boot mode (as describe on this page of mine) and your partition table. Based on your description, I suspect you're booting Windows in EFI mode from a GPT disk, which makes booting Ubuntu in EFI mode desirable, too; however, you should verify this to be 100% sure before you start messing with your permanent boot loader installation.