downgrade kernel version

install a specific linux version

October 10, 2023



Some cases require a different kernel version.

The following example simply assumes a running kernel more recent than 5.4.0.162-generic.

  • For whatever reason it is required to insall exactly this version.

Check your current kernel version:

$ uname -r
# Possible output:
5.15.0-78-generic

Install a specific kernel (5.4.0.162):

$ apt-get install linux-headers-5.4.0-162-generic linux-image-5.4.0-162-generic

The kernel is installed but not used anywhere, so grub needs to know about it.

The goal is to boot into this kernel version.

List the grub menu entries, in order to get the entry for the kernel we are searching for:

$ awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg
# OR or use 'grub-reboot':
$ grub-reboot <TAB><TAB>

Copy the necessary entry and configure it withn /etc/default/grub:

GRUB_DEFAULT='Advanced options for Ubuntu>Ubuntu, with Linux 5.4.0-162-generic'
  • GRUB_DEFAULT is the first option grub is going to use.
  • This is particularly useful when preventing the grub boot menu to show on system boots.

Run update-grub2 in order to actually apply these changes. In case a Warning about old titles is displayed, you are encouraged to use a more recent title.

  • This is not a problem since the suggested title can simply be used as value for GRUB_DEFAULT in /etc/default/grub.
  • The above example already uses the suggested title.

Apply the changes again:

$ update-grub2

In any case:

$ reboot

Check again:

$ uname -r
# The output shoud show:
5.4.0.162-generic