My usual routine to update the Linux kernel

Soon we will have a brand new Linux 5.0. It’s not a real major release … it’s just … easier to count from zero again rathen than higher than 20.

So each time there is a new release, i quickly (ahem) update it.

Here’s my little ritual to upgrade to a new kernel !

  1. Get the source
  2. Decompress and update the symlink
  3. Configuring the new features
  4. Compilation
  5. Installing and testing
  6. Updating the bootloader

Let’s be more verbose !

1. Get the source

Which better place to get the sources than the famous source ?


I just copy the link Latest Stable Kernel du jour.

cd /usr/src/ I go to the right folder.

wget le latest I download from the link from the first step.

tar xvf *.tar.xz Let’s decompress this shit.

unlink linux Removing the old symlink (you can use rm but it’s way more impressive to use this command !).

ln -s linux-votre-latest linux I create the symlink to the new sources.

3. Config

zcat /proc/config.gz > linux/.config First i get the actual config from the running kernel and i put it in the new sources.

make oldconfig And now i ask the kernel to apply this config and it will ask question about any new feature to enable/disable them (most of the time, I disable; I love minimalism). Often I need to search the web to know what are those.

4. Compilation

make -j32 I just compile.

su I’m the one who knocks.

make modules_install I install the kernel modules (i don’t have many but they still need to be in the righ place (/lib/modules/kernel.version)). It should be good now.

5. Installing and testing

mount /dev/sda1 /boot Before continuing I must mount the boot partition.

cp /arch/x86/boot/bzImage /boot/boot/kernelXXXX I then paste the brand new compiled kernel.

reboot The mighty reboot.

e To stop Grub from booting and edit the boot command line. I just need to edit the name of the booting kernel to the new one.

6. Updating the bootloader

If it successfully booted then I hardcode it in the config.

su I put on my boss cosplay.

mount /dev/sda1 /boot I mount the boot partition again.

vi /boot/boot/grub/menu.lst Then I edit the Grub config file with the correct kernel filename.

Et voilà, c’est bon.

From time to time I remove the old kernels from /boot and I also remove the old modules in /lib/modules.