It’s kind of tricky, but the basic idea is:
- Install
linux-generic
.
- Remove
linux-generic-hwe-22.04
and then do an apt autoremove
.
- Uninstall all the other kernels.
- Profit.
To start, just run sudo apt update && sudo apt install linux-generic && sudo apt remove linux-generic-hwe-22.0 && sudo apt autoremove
and that will do steps 1 and 2. Step 3 is a bit harder though.
Each kernel consists of four components - linux-image-VERSION-generic
, linux-modules-VERSION-generic
, linux-modules-extra-VERSION-generic
, and linux-headers-VERSION-generic
. The VERSION is different for each installed kernel - if you run ls /boot
, you’ll see files like vmlinuz-5.19.0-29-generic
- the “5.19.0-29” is the version.
So if you want to remove a kernel, you’d run:
sudo apt remove linux-image-VERSION-generic linux-modules-VERSION-generic linux-modules-extra-VERSION-generic linux-headers-VERSION-generic
replacing VERSION with the version number. For instance, to remove kernel 5.19.0-29, you’d run sudo apt remove linux-image-5.19.0-29-generic linux-modules-5.19.0-29-generic linux-modules-extra-5.19.0-29-generic linux-headers-5.19.0-29-generic
and the kernel would be uninstalled.
So in order to go back to the older kernel, you want to remove all the kernels except for the 5.15 one that you installed when you ran sudo apt install linux-generic
. To do that, just run ls /boot
and look at all of the kernels you have. For each kernel who’s version does not start with “5.15”, run the kernel uninstallation command, replacing all four VERSIONs with the kernel version you’re removing. You want to be left with a single 5.15 kernel when you’re done.
Be careful, if you get carried away and accidentally uninstall all kernels, that would be bad.
The system will probably throw a small tantrum when you try to uninstall the kernel that you’re actively booted into - as long as you’ve installed the linux-generic
package first and still have a 5.15 kernel on the system at that point, you can safely tell the system to go ahead and remove the kernel even though you’re running it. (No, this will not cause a system crash like you might imagine - the kernel is fully loaded into RAM and the system should continue to run just fine once you remove it from the disk, until you reboot. You just need to make sure you have a kernel available to boot into once you reboot.)
If all goes well, you should be running 5.15 by the end of it - you can run uname -r
in a terminal to confirm this.