Sometimes GRUB refuses to behave. In those cases, unless you are dual booting, you can make an EFI Stub to boot directly into linux. You must be using an EFI system partition.
Install efibootmgr
Arch Linux:
# pacman -S efibootmgr
Debian:
# apt install efibootmgr
Get distribution name:
DIST=$(lsb_release -a | awk '/Description/ {print $2}')
Create a directory in /boot/EFI
:
# mkdir /boot/EFI/$DIST
Copy linux and initramfs images to this directory:
# cp /vmlinuz /boot/efi/EFI/$efidir
# cp /initrd.img /boot/efi/EFI/$efidir
Create kernel and initramfs post install scripts to do this automatically:
#!/bin/sh
DIST=$(lsb_release -a | awk '/Description/ {print $2}')
echo "Copying initrd.img to /boot/efi/EFI/$DIST for EFIStub"
cp /initrd.img /boot/efi/EFI/$DIST
#!/bin/sh
DIST=$(lsb_release -a | awk '/Description/ {print $2}')
echo "Copying vmlinuz to /boot/efi/EFI/$DIST for EFIStub"
cp /vmlinuz /boot/efi/EFI/$DIST'
Finally, create the EFI stub:
# UUID=$(blkid -s UUID -o value $part)
# efibootmgr --create --gpt --disk $disk --part $num --label "$label" --loader "\EFI\\$DIST\vmlinuz" --unicode "initrd=\EFI\\$efidir\initrd.img root=UUID=$UUID rw quiet" --verbose
Where:
- $part is the linux root partition name (eg /dev/nvme1n1p2)
- $label is the label you want the EFI stub to have in the BIOS
- $disk is the device containing the EFI partion (eg /dev/nvme1n1)
- $num is the partition number of the EFI partition (eg 1 = /dev/nvme1n1p1)