Tag: Linux kernel

How to downgrade to a previous kernel version in Arch Linux. How to install and switch to linux-lts

New Linux kernels bring support for new hardware and new features. But sometimes the kernel causes problems: it is completely or partially incompatible with existing software, especially video drivers suffer from this, but this can also apply to any other software, for example, VirtualBox.

At the time of the release of the linux 5.9 kernel, NVIDIA drivers were partially incompatible with it, as a result, their important functionality was lost. Although the graphics card worked, but CUDA, OpenCL and probably other features are broken. Of course, this was fixed pretty quickly, but what about those who needed CUDA and OpenCL or other programs that were incompatible with the latest version of the Linux kernel at the time of the problem?

A very recent example, the linux 5.19 kernel at the time of writing is not compatible with the latest version of VirtualBox, which just doesn't work. The problem will be fixed in the near future, but what if you need running VirtualBox machines right now?

One option is to rollback to a previous version by installing it from the downloaded package cache. The method is not the most pleasant, since it will be necessary to prohibit updating the package, the version of which was rolled back, or even refuse to update the entire system.

This method is especially annoying when it comes to the linux kernel – you also need to do something with dependencies.

One of the easier options is to switch to the linux-lts kernel.

How to install linux-lts

LTS – stands for Long Time Support. Simply put, this is a Linux kernel and modules from one of the previous versions, which is rarely updated.

This kernel can be installed as a regular package, replacing the existing kernel. Depending on your computer configuration, you may need to install other *-lts packages, such as the nvidia-lts package, an NVIDIA video driver for the linux-lts kernel.

Also install linux-lts-headers.

All these packages can be installed with the command:

sudo pacman -S linux-lts linux-lts-headers nvidia-lts

Please note that it is not required to remove the old kernel and also the NVIDIA drivers (although you can do this if you wish).

How to switch to linux-lts kernel. Boot options update

In order to use the linux-lts kernel, you need to change the boot options.

Changing boot options is done differently depending on whether you are using GRUB or systemd-boot.

If you are unsure, see “How to check if a computer is using BIOS or UEFI; GRUB or systemd-boot bootloader; MBR or GPT partition table”.

Update boot options for systemd-boot

Open file /boot/loader/entries/arch.conf

sudo vim /boot/loader/entries/arch.conf

Or:

sudo gedit /boot/loader/entries/arch.conf

And replace the lines in it

linux   /vmlinuz-linux
initrd  /initramfs-linux.img

On the

linux   /vmlinuz-linux-lts
initrd  /initramfs-linux-lts.img

For example, the full content of my file was

title	BlackArch
linux   /vmlinuz-linux-lts
initrd  /initramfs-linux-lts.img
options	root=/dev/nvme0n1p2 rw

I commented out the lines that point to the normal kernel version and added the lines that point to linux-lts:

title	BlackArch
#linux	/vmlinuz-linux
#initrd	/initramfs-linux.img
linux   /vmlinuz-linux-lts
initrd  /initramfs-linux-lts.img
options	root=/dev/nvme0n1p2 rw

Then reboot and make sure you are using the LTS kernel version with the command:

uname -a

Update Boot Options for GRUB

Update your GRUB configuration:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Then reboot and make sure you are using the LTS kernel version with the command:

uname -a

After the kernel has been improved and the problems that are bothering you are fixed, you can return to the latest version of the Linux kernel.

Changes in the linux-firmware package: kernel requirements, separating large files into separate packages

In Arch Linux, the linux-firmware package, which contains the firmware files, got important changes. In addition to the usual file updates and adding support for new devices, this package has a requirement for a minimum kernel version, and the package itself is divided into several packages.

Recall that device firmware are files that are necessary for the normal operation of the hardware in addition to kernel modules (drivers).

The linux-firmware package now implements kernel firmware compression and also requires Linux kernel version 5.3 or later with support for booting from compressed xz firmware. The CONFIG_FW_LOADER_COMPRESS kernel option must be enabled. All official Arch Linux kernels have supported this for a long time.

The linux-firmware package has been split into smaller packages to further reduce disk space requirements. Some large firmware files for rarely used hardware have been split into separate packages. This affects firmware for Mellanox Spectrum switches, Marvell devices, Qualcomm SoCs, Cavium LiquidIO server adapters, QLogic devices, Broadcom NetXtreme II 10Gb Ethernet adapters. Be sure to install additional firmware packages if needed.

The following packages are now in the official Arch Linux repository:

  • linux-firmware and linux-firmware-whence – the main firmware packages for a wide variety of hardware
  • linux-firmware-bnx2x – firmware for NetXtreme II 10Gb Ethernet adapters
  • linux-firmware-liquidio – Cavium LiquidIO server adapters
  • linux-firmware-marvell – firmware for Marvell devices
  • linux-firmware-mellanox – firmware for Mellanox Spectrum switches
  • linux-firmware-nfp – firmware for Netronome Flow Processors (nfp)
  • linux-firmware-qcom – firmware for Qualcomm SoCs (qcom)
  • linux-firmware-qlogic – firmware for Qlogic devices (qlogic)

Do I need to restart the server after updating the Linux kernel (SOLVED)

Unlike Windows, in which a program must not be running to update this program, in Linux you can update running programs without any problems – this will not lead to any errors. In Linux, you can delete files in use (including executables) and while they are in use, they will be kept in the cache, and when the system stops using them, they will be truly deleted. That is, when updating a running program, the new version of the file will be used after you close and reopen this program.

Updating the Linux kernel is no exception – you can update the kernel on a running system and continue using it.

This raises the question, is a system reboot actually required after a Linux kernel update? This issue is especially relevant for web servers that become unavailable during the reboot period. It also matters when using caching (Varnish or NGINX), since the cache is usually stored in RAM and is lost on reboot, resulting in the need to refill the web page cache.

So is it necessary to restart the computer after updating the Linux kernel?

In short, yes, absolutely. For the system to start using the new kernel, the computer (server) needs to be rebooted.

After updating the kernel, you can continue to use the server without rebooting, but besides the fact that the benefits of the new kernel have not taken effect, there are a few more things to keep in mind.

1. Avoid subsequent package updates until reboot

Since the kernel header packages (linux-headers, kernel-headers) are updated along with the kernel, there may be a problem with building modules using dkms (Dynamic Kernel Modules System). A situation arises when an old kernel is used, for which the kernel header files (linux-headers) may have already been deleted, so the system cannot build the dkms modules normally.

And even if the kernel headers are saved and it was possible to build the kernel modules for the outdated kernel, then immediately after the reboot these modules will conflict with the new kernel and will not work due to the difference between the versions of the current kernel and the kernel for which they were built.

2. dkms modules may not work until kernel update

When updating the kernel, all kernel modules that use dkms are rebuilt. Examples of packages that use dkms kernel modules are Wi-Fi adapter drivers, VirtualBox guest additions, other drivers, and kernel modules.

So, new kernel modules are rebuilt when the kernel is updated, but cannot be used while the old kernel is in use. That is, in order for them to work, a reboot is required. In this case, old kernel modules in some distributions are immediately removed.

3. Unexpected reboot can lead to unexpected results

Remember that your system has not been tested with a new kernel. Therefore, if the server is restarted without your attention, then in case of problems, you will not be able to respond to them quickly.

How not to reboot Linux after a kernel update

1. Kexec

Kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. This is useful for kernel developers or other people who need to reboot very quickly without waiting for the whole BIOS boot process to finish. Note that kexec may not work correctly for you due to devices not fully re-initializing when using this method, however this is rarely the case.

In short, Kexec is a reboot of the computer with skipping the hardware part (what you see starting from the start of the BIOS).

2. Does the Linux 4.0 kernel no longer require a computer restart?

In the Linux 4.0 changelog, it is said that starting with this version, a kernel reboot is no longer required. But either it doesn't or doesn't work out of the box. At a minimum, this requires additional steps to be implemented.

Summary

Rebooting the computer after updating the Linux kernel is required. It may be postponed, but in fact it is better to postpone the kernel update than to postpone reboot after the update.

As an option to reduce downtime due to reboots, you can reduce the number of updates by taking them only to fix vulnerabilities.

How to downgrade to a previous kernel in Arch Linux

New Linux kernels bring support for new hardware and new features. But sometimes the kernel causes problems: it is completely or partially incompatible with existing software, especially video drivers often suffer from this, but this can also apply to any other software.

A very recent example: NVIDIA drivers are partially incompatible with linux >= 5.9 at the time of writing. Although the graphics card works, CUDA, OpenCL and probably other functions are broken. Of course, someday this will be fixed, but what about those who need CUDA and OpenCL or other programs incompatible with the latest version of the Linux kernel?

One of the options is to roll back to the previous version by installing it from the downloaded package cache. The method is not the most pleasant, since you will need to prohibit updating the package, the version of which was rolled back, or even refuse to update the entire system.

This method is especially annoying when it comes to the linux kernel - you also need to do something with dependencies.

One of the easier options is to switch to the linux-lts kernel.

LTS - stands for Long Time Support. Simply put, it is the kernel and modules of Linux from one of the previous versions, which is rarely updated.

This kernel can be installed as a regular package, replacing the existing kernel. Depending on the configuration of your computer, you may need to install other *-lts packages, such as the nvidia-lts package, the NVIDIA video driver for the linux-lts kernel.

Also install linux-lts-headers.

After finalizing the kernel and fixing the problems that bother you, you can return to the latest version of the Linux kernel.

Loading...
X