Why does my Linode boot with an old kernel?
I updated my Linode OS (Fedora Linux) via DNF System Upgrade. The Linode boots with an old kernel despite the upgrade. How do I fix that?
2 Replies
✓ Best Answer
Andysh solved the issue in this thread.
Specifically:
I think I’ve figured this out with a simple statement I found in some Redhat documentation. The “hash” part of the boot loader entry’s file name is actually the machine ID. Which got me thinking, why is the newer kernel’s different to the older one, if it’s on the same machine?
Because the older kernel was installed using the machine ID of where the Linode image was built. After deployment, that ID is re-generated but the boot loader files remain the same.
This causes the order of the entries in /boot/loader/entries to become “undefined” depending on whether the new Linode’s machine ID is before or after the Linode image machine’s ID alphabetically - explaining why it works sometimes and not others.
I’ve tried this simple solution - rename the original files in /boot/loader/entries to have the new machine ID. (the 80d8… is static, based on the current F33 image at the time of writing. This may change when Linode next update the image.)
mv /boot/loader/entries/80d8462157374e998348f8a25b06b18c-0-rescue.conf /boot/loader/entries/
cat /etc/machine-id
-0-rescue.conf
mv /boot/loader/entries/80d8462157374e998348f8a25b06b18c-uname -r
.conf /boot/loader/entries/cat /etc/machine-id
-uname -r
.conf
grub2-mkconfig -o /boot/grub2/grub.cfg
Reboot the Linode and then run dnf upgrade to get the latest kernel. Reboot and you should be running the new version!
Factors which determine the kernel on a Linode:
The configuration profile being used to boot the Linode has a kernel setting which is used to determine the Linode's boot method.
Setting | Description | Prevents kernel on disk from running |
---|---|---|
Latest 64 bit | Uses the latest 64-bit Linode kernel at the time the Linode boots/reboots. This was the default for most 64-bit distributions prior to August 2018. | Yes |
Latest 32 bit | Uses the latest 32-bit Linode kernel at the time the Linode boots/reboots. This was the default for most 32-bit distributions prior to August 2018. | Yes |
Direct Disk | Instead of a Linux Kernel, this uses the MBE (Master Boot Record) of the primary disk to determine the bootloader which in turn determines the kernel | No, settings specific to your bootloader control the kernel |
GRUB 2 | Uses the upstream distribution-supplied kernel that’s installed on the primary disk. If a custom kernel has been installed instead, that is used instead. This is the most common option and has been the default for most new Linodes created after August 2018. | No, GRUB settings determine the kernel used. |
GRUB (Legacy) | Uses the upstream distribution-supplied kernel that’s installed on the primary disk. This should only be used on older Linux distributions that have Grub (not Grub 2) installed, like CentOS 6. | Legacy GRUB settings determine the kernel |
Specific Linode Kernel | Allows you to specify the exact Linode kernel to use. Since this kernel is maintained regardless of reboots or system updates, it may be preferred in some use cases. | Yes |
If you are using the GRUB 2 setting, you may have to re-configure it to use the desired kernel on your disk.
If your system uses SELinux (CentOS does and Fedora is very similar) then you may be running into a problem with filesystem relabeling. The above guide discusses this for CentOS.