I am trying to install GRUB to the USB as a bootloader so that I can boot to a system that normally can't boot to NVMe.

It is preferred to use secure UEFI boot style.

For a guy who is completely new to Linux and GRUB, I already spent more than 10 hours on concept formation and initial research.

On a mirrored system that fully supports NVMe boot with full Linux installed, I created the GTP flash disk, formated as EFI partition, mounted the EFI partition to /efi

user@user-PC:/$ sudo -s
[sudo] password for user: 

root@user-PC:/# lsblk
loop0         7:0    0  55.5M  1 loop /snap/core18/1988
loop1         7:1    0   219M  1 loop /snap/gnome-3-34-1804/66
loop2         7:2    0  64.8M  1 loop /snap/gtk-common-themes/1514
loop3         7:3    0    51M  1 loop /snap/snap-store/518
loop4         7:4    0  31.1M  1 loop /snap/snapd/11036
sda           8:0    1   3.6G  0 disk 
├─sda1        8:1    1   256M  0 part ### This is the EFI partition, so Linux wont mount it
└─sda2        8:2    1   3.4G  0 part /media/user/DATA
sr0          11:0    1  1024M  0 rom  
nvme0n1     259:0    0 238.5G  0 disk 
├─nvme0n1p1 259:1    0   100M  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part 
├─nvme0n1p3 259:3    0 137.9G  0 part 
├─nvme0n1p4 259:4    0   499M  0 part 
└─nvme0n1p5 259:5    0   100G  0 part /

root@user-PC:/# mkfs.msdos -F 32 -n GRUB2EFI /dev/sda1
mkfs.fat 4.1 (2017-01-24)
root@user-PC:/# mount /dev/sda1 /efi

root@user-PC:/# mkdir -p /efi/etc/default
root@user-PC:/# cp -a /etc/grub.d /efi/etc
root@user-PC:/# cp /etc/default/grub /efi/etc/default

root@user-PC:/home/user# grub-install --target=x86_64-efi --uefi-secure-boot --efi-directory=/efi/boot --bootloader-id=GRUB --removable --verbose
Installing for x86_64-efi platform.
grub-install: info: adding `hd0' -> `/dev/nvme0n1' from device.map.
grub-install: info: adding `hd1' -> `/dev/sda' from device.map.
grub-install: error: failed to get canonical path of `/efi/boot'.

Please see the last line. Any expert can shine some lights on this? Much appreciated, thank you.


After sleeping for a night, I thought about reading more references and rechecking my commands.

YouTube tutorial based on BIOS/MBR but the underlying steps are the same

GRUB/UEFI reference

After I deleted /boot from the grub-install command it worked:

grub-install --target=x86_64-efi --uefi-secure-boot --efi-directory=/efi --bootloader-id=GRUB --removable –verbose

This is the UEFI boot. To test it, I plugged in the USB and in the BIOS boot settings, disabled the boot entries from the NVMe. The green light in the USB was flashing and it booted okay. Restarted the computer without the USB, the computer was (correctly) unable to find a boot device.

I am going out and will post the complete command history once I have a chance to restore the system and repeat the process (I had the system backed up to test it repeatedly)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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