I plugged my Ubuntu installation drive into my new PC using UEFI and it was not visible on the UEFI boot menu. So I booted into a Live USB drive of Ubuntu and mounted the drive. Then I mounted a 512-megabyte DOS partition as well.
The main partition was /dev/sda1 and the DOS partition was /dev/sda3. I mounted the main Ubuntu partition first.
sudo mount /dev/sda1 /mnt |
Then the DOS partition.
sudo mount /dev/sda3 /mnt/boot/efi |
After this, I was able to run this one-liner to build an EFI boot partition.
sudo grub-install --boot-directory=/mnt/boot --bootloader-id=ubuntu --target=x86_64-efi --efi-directory=/mnt/boot/efi |
After all of this, it was successful and I was able to successfully boot my Ubuntu installation using UEFI boot.
And I can see in the /etc/fstab file I can see I am using EFI boot.
╭~:└jason-desktop@jason╮ ╰──────────────────────╯ ☕[]$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation UUID=874c36d5-aae7-41f4-af84-d7cad4c692b9 / ext4 errors=remount-ro 0 1 /swapfile none swap sw 0 0 UUID=1DFB-923F /boot/efi vfat defaults 0 1 |
These are my Ubuntu partitions.
sda 8:0 0 931.5G 0 disk ├─sda1 8:1 0 930.7G 0 part /var/snap/firefox/common/host-hunspell │ / └─sda3 8:3 0 512M 0 part /boot/efi |