I moved the disk with my debian installation to another computer, and it wouldn't boot. Using systemrescuecd I mounted my uefi partition (512 MB, vfat filesystem, has EFI directory) and did cd /mnt/sda1 && mkdir BOOT && cp debian/grubx64.efi BOOT/bootx64.efi, and it booted fine. (got the advice at Askubuntu) Now how do I register debian/grubx64.efi file with my system so that I can get rid of BOOT/bootx64.efi?

2 Answers 2


You can list and manipulate the EFI boot entries with efibootmgr on Linux.

Once you've successfully booted the system manually, make sure that efibootmgr is installed:

apt-get install efibootmgr

Then make sure the efivars pseudo-filesystem is mounted RW:

mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars

If that command fails, or if running efibootmgr results in a message like EFI variables are not supported on this system. then you did not boot in EFI mode. Reboot and try again.

Finally, add debian/grubx64.efi to the EFI boot list and make it the default:

efibootmgr -c -p 1 -d /dev/sda -L "GRUB" -l '\efi\debian\grubx64.efi'

The -p 1 and -d /dev/sda options specify the partition and block device containing the EFI system partition where you created the BOOT sub-directory. -L is a label for the entry being created, and -l is the path to the boot-loader.

You can delete entries you don't want with efibootmgr -b <boot-entry> -B.

You can get a detailed list of the current EFI boot entries with efibootmgr -v.

See man efibootmgr for details. I recommend reading it thoroughly and googling or asking here for clarification before running any of the above commands.

  • 1
    note: this is how to do it manually. Running grub-install or update-grub should do much of the above automatically if you have grub-efi-amd64 (or grub-efi-ia32 on a 32-bit x86 machine) installed. You may need to manually mount the EFI partition user /boot manually, I can't recall exactly.
    – cas
    Mar 7, 2018 at 5:34
  • grub-install with appropriate options did it
    – CrabMan
    Mar 7, 2018 at 19:51
  • Could be just grub-install in a chroot with /dev, /proc and maybe /sys (bind)mounted. Mar 11, 2018 at 10:35

After having read https://wiki.archlinux.org/index.php/GRUB#UEFI_systems and man grub-install I did sudo grub-install --efi-directory $MY_ESP_MOUNTPOINT --target=x86_64-efi and now I have a "debian" boot target listed and working.

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.