Fedora 40 doesn't switch to new kernel after the upgrade

Why Fedora still using the old kernel when two newer ones are available in Grub?

$ uname -r
6.8.5-301.fc40.x86_64

$ rpm -q kernel
kernel-6.8.5-301.fc40.x86_64
kernel-6.10.8-200.fc40.x86_64
kernel-6.10.9-200.fc40.x86_64

$ sudo grubby --default-kernel
/boot/vmlinuz-6.8.5-301.fc40.x86_64

$ sudo cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.luks.uuid=luks-1fa7c339-8b6e-4cfc-b0d6-9dec5e846012 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

have you changed UPDATEDEFAULT ?

$ cat /etc/sysconfig/kernel 
# UPDATEDEFAULT specifies if kernel-install should make
# new kernels the default
UPDATEDEFAULT=yes          <========

# DEFAULTKERNEL specifies the default kernel package type
DEFAULTKERNEL=kernel-core
1 Like

I don’t even have that:

$ cat /etc/sysconfig/kernel
cat: /etc/sysconfig/kernel: No such file or directory

My assumption is this:

The new kernel will be installed into index 0 and as you are not booting from index 0 you do not see a change.

If you want to use the lastest installed kernel on an update you need to be set to boot from index 0.

at some point kernel 6.8.5 was at index 0. But the saved entry is the kernel version not the index.

Without UPDATEDEFAULT=yes system will keep booting 6.10.9.
I guess /etc/sysconfig/kernel should have been created by the installer?

@omid: is this a vanilla fedora 40 workstation install?
What’s the output of hostnamectl | grep Operating?

1 Like

Also, just to add to this conversation a bit. I run systemd-boot, not grub, for the bootloader. If your btrfs subvolume that is mounted as /boot is actually comprised of more than one physical device partitions, you will run into updating problems at one point or another since the mounted subvolume is not one contiguous block. In that scenario, which I find myself, the kernel updates do not get reflected in the bootloader entries. Systemd-boot silently fails during a (automatic) kernel update and unless you manually perform the update of (boot menu) entries in a terminal, you don’t see the error.

Yes, it is a vanilla Fedora 40 Workstation, I just installed it a few days ago:

$ hostnamectl | grep Operating
    Operating System: Fedora Linux 40 (Workstation Edition)

It could be. I did not mess with the default Fedora installation; however, I installed Btrfs Assistant after the installation to test the root snapshot and restore.

$ sudo btrfs subvolume list /
ID 256 gen 10194 top level 5 path home
ID 258 gen 10095 top level 269 path var/lib/machines
ID 259 gen 10020 top level 269 path var/swap
ID 269 gen 10194 top level 5 path root
ID 270 gen 10160 top level 269 path .snapshots
ID 271 gen 9698 top level 270 path .snapshots/1/snapshot
ID 272 gen 9716 top level 270 path .snapshots/2/snapshot
ID 273 gen 9845 top level 270 path .snapshots/3/snapshot
ID 274 gen 10010 top level 270 path .snapshots/4/snapshot
ID 275 gen 10115 top level 270 path .snapshots/5/snapshot
ID 276 gen 10145 top level 270 path .snapshots/6/snapshot
ID 277 gen 10160 top level 270 path .snapshots/7/snapshot
$ sudo lsblk 
NAME                                      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
zram0                                     252:0    0     8G  0 disk  [SWAP]
nvme0n1                                   259:0    0 931.5G  0 disk  
├─nvme0n1p1                               259:1    0   600M  0 part  /boot/efi
├─nvme0n1p2                               259:2    0     1G  0 part  /boot
└─nvme0n1p3                               259:3    0 929.9G  0 part  
  └─luks-1fa7c339-8b6e-4cfc-b0d6-9dec5e846012
                                          253:0    0 929.9G  0 crypt /home

if it’s a default vanilla Workstation 40 then /boot is ext4

this is VM, f39 upgraded to f40

lsblk -f
NAME   FSTYPE FSVER LABEL                 UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                           
├─sda1                                                                                        
├─sda2 ext4   1.0                         c74edde8-bdf5-4bab-9c04-80f0eca684ff  489.4M    43% /boot
└─sda3 btrfs        fedora_localhost-live 1a31a273-8652-4fdc-b967-0d988848bd2c     10G    49% /home
                                                                                              /
sr0                                                                                           
zram0                                                                                         [SWAP]


$ rpm -qf /etc/sysconfig/kernel 
file /etc/sysconfig/kernel is not owned by any package

# ls -lZ /etc/sysconfig/kernel 
-rw-r--r--. 1 root root unconfined_u:object_r:etc_t:s0 185 Apr 28  2023 /etc/sysconfig/kernel

You probably want to re-create /etc/sysconfig/kernel and paste the output from my first post ( ofc remove the ‘<====’ )

Then you could test by installing the new 6.10.10 kernel.

1 Like

Excellent Mark. Fedora booted with 6.10.10 kernel after the /etc/sysconfig/kernel creation. Thank you for your time.

$ lsblk -f
NAME                 FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
zram0                                                                                        [SWAP]
nvme0n1                                                                                      
├─nvme0n1p1          vfat   FAT32        47B1-2D62                             579.8M     3% /boot/efi
├─nvme0n1p2          ext4   1.0          421664d5-4d86-426d-9206-a6b9a671f16a  550.5M    37% /boot
└─nvme0n1p3          crypto 2            1fa7c339-8b6e-4cfc-b0d6-9dec5e846012                
  └─luks-1fa7c339-8b6e-4cfc-b0d6-9dec5e846012
                     btrfs        fedora 78523edf-35e8-4170-8423-6d6084b18ed1  785.2G    16% /home
                                                                                             /

$ cat /etc/sysconfig/kernel
# UPDATEDEFAULT specifies if kernel-install should make
# new kernels the default
UPDATEDEFAULT=yes

# DEFAULTKERNEL specifies the default kernel package type
DEFAULTKERNEL=kernel-core


$ rpm -qf /etc/sysconfig/kernel 
file /etc/sysconfig/kernel is not owned by any package

$ ls -lZ /etc/sysconfig/kernel 
-rw-r--r--. 1 root root unconfined_u:object_r:etc_t:s0 185 Sep 14 20:15 /etc/sysconfig/kernel

$ uname -r
6.10.10-200.fc40.x86_64
1 Like