dev-guides

Downgrading Arch Linux LTS kernel to 4.9

Arch Linux very recently updated their Long Term Support (LTS) kernel package to version 4.14, but this semester 4118 will be taught with version 4.9. This guide walks you through a couple of ways you can downgrade a 4.14 machine to 4.9.

To check your current kernel version execute the command uname -r to get your current running kernel version. If it says something of the form 4.9.xx-lts then you do not need to downgrade. Please ensure you have a VM snapshot saved of this kernel version lest an accidental upgrade leave you on 4.14. If your output includes the string ARCH then you are on the ArchLinux kernel, which means you either never installed an LTS kernel or forgot to boot in to your LTS kernel. If it is the latter please boot into your LTS kernel and check again. Otherwise you will have to follow the rest of this guide to properly install a 4.9-lts kernel.

First and foremost, the easiest solution, assuming you previously had linux-lts 4.9 installed, is to restore a previous VM snapshot on 4.9-lts. Otherwise, downgrading the LTS kernel to 4.9 without a snapshot can be done through a few ways, but this guide will only deal with two such ways.

NOTE: Before following any method listed below, please make sure to take a snapshot of your VM just in case.

WARNING: Regardless of which method you follow, you do not want to execute pacman -Syu, which will upgrade all your packages, including the kernel, to latest release, thereby undoing everything you did (take snapshots!).

As a general notation, whenever you see commands prepended with a $ it means to run the command without root privleges. If instead it is prepended with # then it means to be run as root. For example,

$ echo "hi" # This does not need root privileges
# pacman -S vim # This does need root privileges

Table of Contents

Using the Package Cache

This method relies on the pacman cache and thus only works if you had previously installed linux-lts 4.9 on the VM. If this does not apply to you, skip to the next section.

First navigate to /var/cache/pacman/pkg and run

$ ls | grep -E 'linux-lts-(|headers-)4.9'

If you see packages of the form linux-lts-4.9.xx and linux-lts-headers-4.9.xx then you have the required packages in your cache and can continue to the next step. If you don’t see those packages look at the next section.

To properly downgrade the system all you need to do now is run (still in /var/cache/packman/pkg)

# pacman -U linux-lts-VERSION linux-lts-headers-<VERSION>

where <VERSION> refers to whatever version string you saw in the previous ls command. Reboot the system and execute uname -r to see if the downgrade succeeded. If it did, please take a snapshot of your VM now.

Note: After using this method your Arch Linux system will still attempt to install the latest packages if you run pacman -S <PACKAGE>. If you still need to install packages to your VM it may be easier to follow the steps in the next section.

Using the Arch Linux Archive

This method relies on the Arch Linux Archive to downgrade your system to a state before February 2nd, 2018.

The setup can be done by executing the following commands (as root).

# mv /etc/pacman.d/mirrorlist{,.bak}
# echo 'Server=https://archive.archlinux.org/repos/2018/01/31/$repo/os/$arch' > /etc/pacman.d/mirrorlist

What this will do is force Arch Linux to download files solely from its backup archive for January 31st, 2018, two days before the 4.14 kernel package was released. To perform the downgrade itself do

# pacman -Syyuu

Now you can reboot your system and execute uname -r to check if it succesfully downgraded. If it did, please take a snapshot of your VM now.