Kernel Management

I encountered this bug While running 5.13.0-25-generic. The bug for me was related to the 5.11.0-46-generic Linux kernel. I have unfortunately lost the exact error message I recieved on my system due to a reboot, but in general the error message was the following, which I encountered during an upgrade. (taken from the comment on the bug linked above)

sudo apt upgrade

Error! The /var/lib/dkms/backport-iwlwifi/8324/5.4.0-77-generic/aarch64/dkms.conf for module backport-iwlwifi includes a BUILD_EXCLUSIVE directive which
does not match this kernel/arch. This indicates that it should not be built.
Skipped.

After some searching, I found a topic on Linux Mint Forums that led me to reinstalling my 5.11.0-46-generic kernel.

First, be sure that you have any kernel installed that isn't producing errors. For me, 5.11.0-46-generic was giving errors but I was actually on 5.13.0-25-generic so no issue there. If you are on the faulty kernel, just run the following commands to install a different kernel version.

For the sake of the example, I will install 5.11.0-44-generic in the following commands.

# Search for all Linux kernel images >= 5.10.0
apt search linux-image-5.1 generic
# Install 5.11.0-44-generic image and headers
sudo apt install linux-image-5.11.0-44-generic linux-headers-5.11.0-44-generic
# Important! This updates grub entries with the new kernel
# + In the next step, we use this new entry to boot into a different kernel
sudo update-grub

Run the following command to edit your GRUB config.

sudoedit /etc/default/grub

Now, read the header comment and notice the recommendation to run the command info -f grub -n 'Simple configuration'. This is useful, and can provide more information on these settings if needed. For swapping a kernel, we don't need to get too crazy. We just need to make sure that GRUB is displayed, and that the timeout is not set to 0.

For me, this was the default configuration. This results in GRUB not being displayed with no timeout. Makes for quick reboots, but does not allow us to boot from a different kernel.

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

Change the settings to something like the below. The lines to node are GRUB_TIMEOUT_STYLE and GRUB_TIMEOUT.

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

This will show the GRUB menu for 5 seconds on boot. If you don't press a key in 5 seconds, the system will boot. Save and exit this file with the new changes applied, then again run the following commands to updat GRUB and reboot.

sudo update-grub
reboot

When GRUB is displayed, you can select Ubuntu or Advanced Options for Ubuntu. Select Advanced Options for Ubuntu and then select any kernel version (NOT safe mode). This will boot Ubuntu with that Linux kernel, and now we've detached ourselves from the faulty kernel.

Once you're at a terminal in your desktop again, you can run the following commands to remove the kernel and reinstall it.

sudo apt remove linux-image-5.11.0-46-generic linux-headers-5.11.0-46-generic
sudo apt install linux-image-5.11.0-46-generic linux-headers-5.11.0-46-generic
sudo update-grub

That's it! For me, this fixed the specific issue I noted at the top of the page, but you could want to do this for various reasons so I thought it was useful to document it. After the install is complete and you've updated GRUB, you can reboot back into the default Ubuntu selection in the GRUB menu.

Notes

Also noteworthy, I encountered this issue on an XPS 9310 using dell PPAs for some drivers. These PPAs just happened to target the kernel I removed, and at some point while debugging this I ran an update with --autoremove, so I also removed the oem-somerville-melisa-meta package in the process. This meant that I removed the keys for the PPA that was still in my apt sources. I was getting warnings about unable to update the PPA during apt update. I solved by reinstalling the oem-somerville-melisa-meta package. After this, everything was good!

sudo apt remove oem-somerville-melisa-meta
sudo apt install oem-somerville-melisa-meta

Revision #5
Created 11 January 2022 16:38:53 by Shaun Reed
Updated 25 March 2022 21:38:25 by Shaun Reed