Linux kernel post-installation

Updating the boot process

Now that the kernel and modules are in place, the boot process has to be modified in order to find these binaries and allow the systemn to boot them.


These steps are very dependent on the actual distribution. Consult the manual for the exact procedure.

Updating the initramfs

In some distributions, an initramfs file is used to provide a first virtual filesystem at boot time before the kernel is loaded in memory. If this is the case, this file must be recreated to use the new kernel image.

To create a new initramfs for the new kernel, use the command provided by your distribution.

Updating the initramfs in Debian

For example, in Debian, there is the command update-initramfs to deal with this process:

# update-initramfs -c -k 4.19.21

Updating the bootloader


Changing the boot process or the bootloader configuration can render the system unable to boot anymore. Always keep a copy of a previously working kernel and bootloader configuration in order to be able to revert back any changes.

In order to use the new kernel image the bootloader needs to be updated to point to the new image of the kernel, so it can be loaded at boot time and then given the control of the machine.

Again, depending on the bootloader used in your distribution the process may vary.

Updating the bootloader in Debian

In Debian, for example, the command update-grub is used to update the configuration of the GRUB bootloader. This commands searches for all the kernel images present in the /boot directory and updates the GRUB configuration files.

# update-grub

Testing the kernel

Once the new kernel image is installed, along with any kernel modules, and the system is prepared to boot using the new kernel, reboot the system and, when prompted by the bootloader, select the new kernel.

If the system is able to boot using the new kernel, the login prompt will appear. Log in into the system and, in a terminal or the console, check the kernel version actually running with the command uname:

$ uname -sr Linux 4.19.21

Reconfigure the system

After succesfully installing and booting a new Linux kernel, some tasks need still to be performed to complete the system update.

Rebuild other programms after the new kernel

With the new kernel, if modules were built and installed, some programs running in the system may need to be updated in order to link to the new modules.

Recompile video or other devices propietary drivers

Some video drivers depend on binary modules that may have changed with the new kernel. Recompile or rebuild these drivers following the instructions provided by the driver developers.

Reinstall or update virtual machine hypervisors

Also, if running any virtual machine hypervisor, these applications may need to be reinstalled or rebuilt after changing the running kernel. Follow the instructions provided by the hypervisor developers to update their application.

Reconfigure GRUB to use the new kernel as default

If the new kernel is fine, it may be convenient to set it as the new default boot option in the bootloader configuration.

For example, in the case of the GRUB bootloader, in a Debian system, edit the /etc/default/grub file and select the new kernel as the default option in the menu to boot using the GRUB_DEFAULT variable.

For the Debian or Ubuntu case, update the GRUB configuration again to update these changes:

# update-grub

Other distributions will requiere other commands or manually updating the bootmanager configuration.