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
Now install the
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.