All Articles

Reverting to a Previous Kernel

This post is basically copied from the following URL. I found it useful enough that I wanted to keep it on my own site. All credits go to: https://karlcode.owtelse.com/blog/2017/03/13/reverting-to-a-previous-kernel/

I was having issues this weekend with my second monitor suddenly not working any more. xrand just could not find the display at all, and it would not show up with lspci, dmesg etc. Thinking a bit I remember that I probably had ran an apt upgrade yesterday. On a hunch I decided to try reverting the kernel version, which worked :). Here’s a quick how to for reverting the kernel version.

I’m on Ubuntu 18.04, so this may differ depending on your linux flavour.

Verify that an old kernel version works

By default Ubuntu seems to keep an old kernel version installed. First you want to test that this old version still works as expected.

Reboot, hold the shift key, choose “Advanced options for Ubuntu”, then select the older kernel version you have installed. You should now be booting with the older kernel.

Remove the broken kernel

If the old kernel seems to work ok, i.e. in my case my second monitor came back alive, you can remove the new kernel.

The following snippet is again copied from the blogpost I linked above. I think it’s self explanatory.

# use the kernel numbers from previous step to confirm that the broken kernel has been installed
# eg if the currently broken kernel was linux-image-4.4.0-64-generic it should show up in the following command.
dpkg -l | grep linux-image

# remove the broken kernel
sudo apt-get purge linux-image-45.0.0-31-generic

# remove its headers too
sudo apt-get purge linux-headers-5.0.0-31-generic

Reboot, and now you should automatically boot into the old kernel version.

Published Oct 5, 2019

Security Engineer with a dash of software. Originally from Stockholm, now in Berlin. I like to hack things.