Loading...
X

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.


Leave Your Observation

Your email address will not be published. Required fields are marked *