1

I have a multiple hard drive setup with Ubuntu-18.04 as a primary OS (for some accident installed in legacy/BIOS mode, first Linux experience). Recently I added an extra SSD and installed win10 on it. Somehow I managed to get things to work, but the problem is that win10 boot in UEFI while ubuntu in legacy/BIOS mode. As I am new to ubuntu, I figured out the legacy type of install only after I tried to boot-repair in UEFI and broke my working grub (luckily I managed to restore it). I don't want to break things again, so I have a few questions:

  1. Is it safe/ok to dual boot legacy ubuntu and UEFI windows by simply switching the boot order directly in "bios" firmware? (I am ok with doing that, but maybe I should avoid this practice?)
  2. How can I convert my ubuntu 18.04 to UEFI mode without breaking anything to enable normal dual boot setup?

Regarding the second question, yes I read https://help.ubuntu.com/community/UEFI, but it didn't help much since it does not provide a ready-to-use solution. With my level of understanding of how boot works I came up with the following idea to fix my setup:

  1. I have several disks /dev/nvme0n1 for windows, /dev/nvme1n1 for linux and some /dev/sda, /dev/sdb for storage. Linux partitions are /dev/nvme1n1p1=/boot, /dev/nvme1n1p2=/, /dev/nvme1n1p3=swap, /dev/nvme1n1p4=/home. (/boot is large enough)
  2. Boot in currently installed legacy ubuntu 18.04, use GParted to unmount /boot, erase it, make new fat32 (vfat) partition on the same place and remount it to /boot/efi (also add a corresponding record in /etc/fstab).
  3. Reboot and boot to boot-repair disk (https://sourceforge.net/projects/boot-repair-cd/) in UEFI mode and click recommended fix.
  4. Reboot to uefi ubuntu, run $>sudo update-grub? Done?

But I decided not to go for it as I am afraid that something will go wrong and I will end up with an entirely failed system. (It was really scary to enter grub-rescue> or grub> and when it failed to load after specifying correct boot and root folders...) Or maybe there is a simpler and more clear way (e.g. do the boot repair in current running ubuntu, then just reboot).

Thanks in advance.

Tejas Lotlikar
  • 2,945
  • 5
  • 17
  • 26
Ivan
  • 11
  • I’d say your best bet is to reinstall Ubuntu in UEFI mode. Backup your /home before doing that and restore it after. Backup anything else on the machine that you cannot afford to lose – PonJar Dec 01 '20 at 13:28
  • 1
    https://askubuntu.com/a/1073683/590937 – mook765 Dec 01 '20 at 13:31
  • @PonJar, can i make the backup on second hard drive (physically installed) rather than on second machine? – Ivan Dec 01 '20 at 13:59
  • @mook765, that looks like exactly what i want to do, but i dont have /boot/efi partition yet, just /boot. So can i unmount and erase the /boot partition (and remove the corresponding folder), then create fat32 boot partition on the freed space and mount it on /boot/efi to proceed your solution? – Ivan Dec 01 '20 at 14:03
  • What is mounted at /boot/efi is the EFI System Partition (ESP). You should have an ESP since you have Windows installed in EFI-mode. Do not delete your /boot-partition, this would make Ubuntu unable to boot. Instead, find out the correct partition, create the folder /boot/efi, mount the ESP there and install the bootloader as described in the link. – mook765 Dec 01 '20 at 14:12
  • It is also safe to change the boot-order in UEFI-firmware to switch between the operating systems during boot. Most people will find this inconvenient, but it's safe. – mook765 Dec 01 '20 at 14:28
  • @mook765 tried you method, but no success, still loads to /boot (legacy). Maybe i messed with some commands, maybe something else, maybe grub should be removed first. (Though nothing seems to be broken after all.) – Ivan Dec 01 '20 at 14:38
  • 1
    The old bootloader (grub) still resides in MBR. Try to disable legacy boot in firmware settings, check boot-order, save and exit from firmware-settings and see if it works. – mook765 Dec 01 '20 at 14:42
  • Make also sure that secure boot is disabled in firmware-settings. – mook765 Dec 01 '20 at 14:46
  • You should place you backup in a safe place. The Windows drive should be safe but to be sure sounds like you could disconnect it while reinstalling Ubuntu in UEFI mode. That should make for a very easy install, just update grub after the Windows disk is reconnected to get a Windows entry on the grub menu. – PonJar Dec 02 '20 at 09:01

0 Answers0