Kernel is the core of the operating system. There are hundreds of available kernel versions and each distribution such as Kubuntu / RedHat / SUSE comes with a default one (For Example SUSE Leap 15.2 comes with a 5.3.18 Kernel). The Long-Term Support (LTS) versions of the distributions contain a stable kernel version unlike for example the TumbleWeed SUSE versions, which contain an up-to date versions of all the installed packages and the kernel itself. This might be a good idea for some users, who has to have the latest versions or simply require the usage of the latest versions (This may be for example due to having a brand new PC, for which kernel drivers are no available for the previous kernels). The problem usually arises one you are trying to use or even compile an application, which is not yet ready for the newer kernel, because of some deprecated function calls and or missing packages. This can happen both ways:

  • Trying to compile new kernel with outdated Packages
  • Trying to compile old kernel with latest packages

One may think, that changing the entire core of the OS is something, that you should likely avoid. However changing the kernel is nothing you should be afraid of. For those, who already have some experiences with embedded systems and custom kernel compilation, this is even a simple straight-forward task, which doesn’t even need any cross-compilation tool chain. Just download the kernel source files for example from HERE, preconfigure the kernel based on your current setup by issuing “cp /boot/config-`uname -r` .config” and optionally modify some kernel parameters via standard “make menuconfig” or preferably “make nconfig” or “make xconfig” and hit make (Or “make -j 4“), which may take a while, since you are building something quite complex.

After kernel compilation is done, you need to install the compiled kernel drivers by using “make modules_install” and finally “make install” which adds new entry to the boot loader menu, which allows you to boot the old kernel version as well as the newly compiled kernel version. You can of course test this without any problems on any virtual platform and even install several kernel versions if necessary. A little bit cumbersome is the removal of the old kernel,which you no longer need,because it requires you to manually remove the installed files. Fortunately there is not too much of a work,simply remove the following and update your bootloader:

  • /boot/vmlinuz*KERNEL-VERSION*
  • /boot/initrd*KERNEL-VERSION*
  • /boot/System-map*KERNEL-VERSION*
  • /boot/config-*KERNEL-VERSION*
  • /lib/modules/*KERNEL-VERSION*/

Finally: “update-bootloader –refresh” & reboot & enjoy the new kernel. I particularly find this flow very simple and useful, because you can turn on additional features,that are not available in the mainline kernel configuration. Also you are then able to recompile your own kernel module drivers into different kernel versions and see if there are any problems and differences (Such as deprecated calls, which needs to be updated to use likely a newer API.) Finally, you can of course modify various kernel features directly from the command line (By modification of the kernel boot argument list. You can find the available arguments HERE). The place to modify the parameters is “sudo nano /etc/default/grub” & GRUB_CMDLINE_LINUX_DEFAULT – Don’t forget to update the boot loader upon changes there!