Translation(s): none

Since Wheezy, Debian kernel on x86 contain their own BootLoader called EFI stub. Therefore it is possible to load the kernel directly, without any additional bootloader (like grub-efi).

Copy the files

The UEFI firmware is only able to load files from the EFI partition (usually FAT). If you use a standard UEFI installation of Debian, you should copy the kernel and the initrd to /boot/efi. The best way to keep it up to date is to place a script in /etc/kernel/postinst.d/zz-update-efistub:

   1 #!/bin/sh
   2 cp /vmlinuz /boot/efi/EFI/debian/

Make it executable and launch it manually:

chmod +x /etc/kernel/postinst.d/zz-update-efistub

/etc/initramfs/post-update.d/zz-update-efistub (create the directory if it does not exist):

   1 #!/bin/sh
   2 cp /initrd.img /boot/efi/EFI/debian/

Make it executable and launch it manually:

chmod +x /etc/initramfs/post-update.d/zz-update-efistub

Add the boot entry

Replace /dev/sda3 with the device of your / partition, see the efibootmgr manpage if you EFI partition is not /dev/sda1:

export UUID=$(blkid -s UUID -o value /dev/sda3)
efibootmgr -c -g -L "Debian (EFI stub)" -l '\EFI\debian\vmlinuz' -u "root=UUID=$UUID ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img"

You can check your new boot entry. Since EFI uses UCS2, it should look like this:

#efibootmgr -v

Or add the boot entry with a script

  1. Create the script below with it's contents. (Tip: Highlight and copy with linenumbers hidden)

  2. Edit the parts to accommodate your needs.
  3. Make it executable.
    • chmod a+x

  4. Execute the script as root.

    • sudo

  5. (./) -- TriMoon 2018-04-24 15:51:14 B) {OK}

Here are some line numbers with explanation:

   1 #!/usr/bin/env bash
   2 # v0.1 Automatically create an EFI Boot entry.
   3 #
   4 #       (C) 2018+ ©TriMoon™ <>
   5 #       ------------------------------------------------
   6 #       License: BY-SA 4.0
   7 #       This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
   8 #
   9 #
  11 # First compose the variables used as arguments:
  12 label='Debian (EFI stub)'
  13 loader='\EFI\debian\vmlinuz' # Use single \'s !
  14 initrd='\EFI\debian\initrd.img' # Use single \'s !
  15 printf -v largs "%s " \
  16         "root=UUID=$(findmnt -kno UUID /)" \
  17         "rootfstype=$(findmnt -kno FSTYPE /)" \
  18         "ro quiet splash" \
  19         "add_efi_memmap" \
  20         "intel_iommu=on" \
  21         "nvidia-drm.modeset=1" \
  22         "initrd=$initrd"
  24 # Then create the EFI entry:
  25 efibootmgr -c -L "${label}" -l "${loader}" -u "${largs%* }"

If you were installing Debian from UEFI medium, efibootmgr should be installed by default. However, sometimes it can report that EFI variables are not supported. If you are sure that you have EFI partition, probably you need to download efivar package and modprobe efivars module.