Make GRUB recognize a new vmlinuz

I compiled a vanilla kernel, built a rpm package out of it, installed the RPM package, and created a new vmlinuz that is signed (due to SecureBoot) with this script:

#!/usr/bin/env bash
read -p "Kernel version: " ver
echo $ver
sudo sbsign --key MOK.priv --cert MOK.pem /boot/vmlinuz-$ver --output /boot/vmlinuz-$ver.signed
sudo cp /boot/initramfs-${ver}.img /boot/initramfs-${ver}.signed.img

Now I need GRUB to boot /boot/vmlinuz-5.14.0.signed instead of /boot/vmlinuz-5.14.0.

Unfortunately there is no such entry in the GRUB menu.

I tried to update grub with

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

But nothing, there is an entry for the old unsigned kernel, but no entry for the new signed one

Have you tried calling kernel-install add with the appropriate options?


No I didn’t.

I didn’t know I had to call this, thanks :slight_smile:

For now I have just substituted the unsigned kernel with the signed one.

By default, Fedora is now using grub2 with BLS config: that means there will be no kernel boot entries inside /boot/grub2/grub.conf

In order to change default boot entry, we can use grubby

List all boot entries:
sudo grubby --info=ALL

Set new boot default:
sudo grubby --set-default-index=<index number> as per output of above

List the default for future boots:
sudo grubby --default-index


or just disable BLS config and do it the old way via /etc/default/grub by adding


to the content of /etc/default/grub

1 Like

After disabling BLSCFG, when there are kernel updatesl, will Fedora use the “correct” way to update the system?

if you do sudo grub2-mkconfig -o /boot/grub2/grub.cfg after kernel update and before booting, grub should list the new kernel too (unless you boot EFI, then you should do grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg). I do this manually after every kernel update.


I have read that /boot/efi/EFI/fedora/grub.cfg just links to /boot/grub2/grub.cfg. Isn’t this true?

Actualy my /boot/efi/EFI/fedora/grub.cfg is:

# cat grub.cfg
search --no-floppy --fs-uuid --set=dev [UUID of my disk]
set prefix=($dev)/grub2
export $prefix
configfile $prefix/grub.cfg

With Fedora 34 the location of grub.cfg was moved to /boot/grub2/grub.cfg for boot legacy and efi boot. Thus the file in /boot/efi/EFI/fedora/grub.cfg now only redirects the grub boot loader for efi to /boot/grub2/grub.cfg

1 Like

good to know