0

This question already has an answer here:

My laptop have already installed Windows 10 in UEFI but I mistakenly dual boot Ubuntu OS In legacy mode. So everytime I have to change BIOS SETUP settings to UEFI for Windows and legacy and legacy first for Ubuntu. So what I do to when I start my pc it ask me which OS to use(it also ask currently but don't run the other one according to BIOS setting)

marked as duplicate by wjandrea, karel, Thomas, Elder Geek, N0rbert Sep 10 '18 at 6:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

The switch from legacy boot to UEFI boot in Ubuntu should be fairly easy, only a few steps are needed.

First of all make sure that Windows is fully shut down, Windows Fast-startup-feature should be disabled. Boot your current Ubuntu installation.

You need to know which partition is your EFI-System-Partition (ESP). You can use the command lsblk -f to get the device name and UUID of the ESP. The ESP is formatted in FAT and normally has a size of a few hundred MB, mostly the partition will be labeled and you can find it easily.

Create a directory as mount-point for the ESP with

sudo mkdir /boot/efi

Now add a line to /etc/fstab with the following content:

UUID=XXXXXXXXX   /boot/efi  vfat   umask=0077    0    1

Use the UUID you found before.

Mount the ESP with sudo mount-a

Now install the grub-efi-amd64-package:

sudo apt install grub-efi-amd64

This will automatically remove grub-pc (the legacy boot-mode version of Grub).

Other commands like grub-install or update-grub are not needed, installing grub-efi-amd64 will install the boot-loader to the ESP during installation of the package.You are ready to reboot.

Enter the UEFI-settings and check your boot-order. I'd also recommend to disable CSM in UEFI-settings to speed up the boot process.

-2

I suggest you to reinstall Ubuntu in UEFI mode cause moving from legacy to UEFI not so simple. You should:

  • Boot from Live-USB;
  • Create FAT32 partition (minimum 33MB of size) and mark it with boot flag;
  • Enter chroot mode by:
    • sudo mount -o /dev/sdxX /mnt where xX is you drive and partition number where a root partition is;
    • sudo mount /dev/sdxX /mnt/boot/efi
    • for i in /dev /dev/pts /proc /run /sys; do sudo mount -B $i /mnt$i; done
    • sudo chroot /mnt
    • for i in /dev /dev/pts /proc /run /sys; do sudo mount -B $i /mnt$i; done
    • sudo chroot /mnt

Now install grub:

apt-get install --reinstall grub-efi-amd64
grub-install --recheck /dev/sdX

or just:

dpkg-reconfigure grub-efi-amd64

It should create 'ubuntu' menu item in UEFI.

Now edit your fstab by sudo nano /etc/fstab and add the following to it:

UUID=bla-bla  /boot/efi  vfat  umask=0077 0  1

You should run blkid to identify which UUID your efi partition has.

Check which packages are installed by dpkg --get-selections | grep grub

grub-common                                     install
grub-efi                                        install
grub-efi-amd64                                  install
grub-efi-amd64-bin                              install
grub2-common                                    install

Those are packages should be installed for UEFI boot. All other you should remove.

Also check that /EFI/ubuntu/grubx64.efi file is exist.

Exit from chroot by Ctrl+D. Unmount all in /mnt and try to reboot.

Not the answer you're looking for? Browse other questions tagged or ask your own question.