Basic knowledge of the Linux kernel

  • by

The Linux kernel is the central element of every Linux-based operating system. It is involved in every interaction with the system, no matter how small – it therefore already becomes active when you just put your finger on the touchpad. The Linux kernel’s main task: to make the hardware fully operational and thus provide an environment in which you can run programs.

The kernel works towards this goal as soon as you start Linux via the boot manager. It then loads a Linux kernel into memory and executes it. Using the thousands of drivers contained in the kernel, it then begins to activate the motherboard, processor, graphics chip and all other components of the system.

The kernel then mounts the disk with the Linux installation and calls the init system located there. This then starts numerous programs with the help of the kernel, which then ultimately provide the user interface through which you interact with the system via keyboard, mouse & co. The kernel is involved every time, because its drivers abstract hardware differences. This allows applications to simply pass data intended for saving to the kernel, for example, without having to worry about the differences that have to be taken into account when saving to USB sticks, network drives and the various hard disk types (PATA, SATA, SCSI, NVMe …). This is done by the kernel with its drivers.

Parallel to the initialization of the hardware, the kernel has set up the environment in which it executes the programs. The kernel controls this “user space” and regulates, for example, how often and for how long a program may use the processor before passing on to the next one. It also distributes the working memory and shields the programs from each other, but at the same time also offers ways for programs to communicate with each other. Furthermore, the kernel performs numerous tasks for which it is simply best positioned due to its central, all-controlling position. Therefore it takes care for example of the access rights and helps with file systems with the order keeping.

Linguistics

Do the terms kernel, Linux and Linux kernel actually all mean the same thing? In common usage, these three words are often used synonymously. In fact, however, they can stand for quite different things.

  • Only the term “Linux kernel” is unambiguous: This always refers to the operating system kernel whose development was started by Linus Torvalds 25 years ago.
  • Like any other software, this core also has a name: “Linux”. Some people find the name “Linux kernel” as bumpy and redundant as “white mold” or “iPhone smartphone”.
  • However, it provides clarity, because the term “Linux” has long been used for Android, Fritz!OS, Ubuntu and thousands of other operating systems that use Linux as a kernel.
  • The term “kernel” is even more ambiguous; after all, every operating system has one – including Windows. Nevertheless, the term often refers to Linux (the kernel).

Which Linux version does my distribution use?

The command uname -r returns the version name of the currently running Linux kernel. However, for some distributions, this is only a rough guide.

Ubuntu 16.10, for example, at times used a kernel that identified itself as “4.8.0-34-generic”. The “4.8.0” indicates that the source code of Linux 4.8 forms the basis; in fact, however, it is version 4.8.11, which can only be found out in the source code management system of the Ubuntu kernel. The “34” is Ubuntu’s own revision designation for unique identification.

With “generic” Ubuntu identifies its standard kernel variant. In addition to this image, Ubuntu also has one with the label “lowlatency”. This is created from the same source code, but is configured differently; as a result, it can react faster if necessary, which can be important for industrial control systems, but reduces the data throughput.

Other distributions do a similar thing. With enterprise distributions, however, you can’t put too much stock in the version number: The current kernel of Red Hat Enterprise Linux 7, for example, identifies itself as “3.10.0-514.2.2.el7.x86_64”. It is very different from Linux 3.10, however, because Red Hat has incorporated many features and drivers into its kernel that have been incorporated into later versions of the Linux kernel.

Ticked off?

The kernel of my Linux distribution is based on a Linux version that is no longer maintained according to Linux kernel developers or Kernel.org. A release email even said, “All users must upgrade.” Do I need to upgrade to a new one now to make my system safe again? If a new Ubuntu kernel causes problems, you can boot the previously used kernel image via the boot manager entry “Advanced options for Ubuntu”.

  1. You don’t need to waste any thought on this as long as your Linux distribution is still maintained. Within the support period, all proper distributors maintain the kernel set up by default; they therefore submit corrected versions as updates to plug security holes that have become public in the meantime.
  2. Until the end of support for Ubuntu 16.10, therefore, you don’t need to itch that the kernel developers have abandoned the maintenance of Linux 4.8, on which the Ubuntu 16.10 kernel is based.

Complete package

The Linux kernel of my distribution does not support the sound and WLAN chips of my notebook. How can I update the drivers?

The best thing to do is to switch to a newer Linux distribution that comes with a younger kernel. This is because the drivers for these and many other hardware components are an integral part of the kernel; therefore, a driver included in Linux 4.9 cannot be used with Linux 4.4.

This is the short answer to a complex issue with many “ifs and buts”. For example, there are some drivers maintained independently of the kernel that can certainly be combined with different Linux versions; however, such drivers are rather the exception, if one disregards the kernel drivers that AMD and Nvidia offer for their graphics chips.

Capable programmers can of course integrate drivers of current Linux kernels into older ones. How much work such a “backport” does depends on the individual case. But it quickly becomes time-consuming, so even for developers it is often more efficient to install a newer Linux distribution or at least a younger Linux kernel.

Security

The system update also wants to update the Linux kernel. Do I really need to install this update? I’m afraid that something won’t work after that. You should install the new kernel: Every year, dozens of moderate and a handful of serious vulnerabilities are found in the Linux kernel. Attackers exploit these gaps and use them to take over servers, routers and IoT devices time and again. Desktop systems have rarely been targeted, but that could change any day.

With Debian, Fedora, Ubuntu and most other distributions, there is no reason to be afraid anyway, because they install new kernel images in parallel to the one currently in use. If a new kernel does cause problems, the previous kernel can still be started via the boot manager, but sometimes the entry for the old kernel is hidden in a submenu.

Replace?

Linus Torvalds has released a new Linux version. Is it worth the change? Will my system perhaps even work faster with the new version? Every ten weeks, new Linux kernels are released that contain major improvements. Whether the switch is worthwhile depends primarily on the answer to two questions: Will you benefit from the improvements in the new version? Do the benefits justify the effort involved in switching to a newer kernel version?

The answers to these questions are very individual. Whether there are relevant changes for you can be answered by studying articles like the Kernel-Log of c’t, which describe improvements of new Linux versions. These always include new and improved drivers that may make your system run better or faster. This is often the case with new PCs, because the drivers responsible for them are often still being fine-tuned. Sometimes features also speak for the change, if something can be realized by it, which was not possible before or only substantially more awkwardly.

Even more individual is the clarification whether the advantages justify the effort. The answer depends mainly on your motivation and your Linux knowledge. If you install new Linux kernels frequently, you can do it with a handful of commands while fetching a hot drink from the kitchen. If you are installing a new kernel for the first time, on the other hand, it can take many hours; in the worst case, the Linux installation can even get so messed up that some people only know how to help themselves with a new installation.

You should therefore take a little time and be willing to experiment if you want to switch to a younger kernel version yourself. You should also create a current backup. And don’t forget that a change is not a one-time thing, because the kernel also needs maintenance: Security holes are always being found in the Linux kernel and plugged by new versions, so you have to keep an eye out for them and install them promptly if necessary, so as not to expose yourself to any danger.