Cloud Server: Repair Current Kernel Version (CentOS, AlmaLinux and Rocky Linux)
Please use the “Print” function at the bottom of the page to create a PDF.
If it is not possible to migrate your server even though you have installed the latest kernel, it may be corrupted. This can occur, for example, if the boot partition on your server had less than 100 MB of free space before the migration. There can also be a variety of other reasons.
If the Linux kernel is corrupted, this can have various symptoms that indicate that something is wrong with the system. You can use the following signs and methods to recognise whether the kernel may be damaged:
Boot problems: The most obvious sign of a corrupted kernel is boot problems. The system could get stuck in a boot loop, crash with error messages or not boot at all.
System crashes and error messages: If your Linux system crashes frequently or has unexpected kernel panics, it may be a sign of a corrupted kernel. Kernel panics are often accompanied by an error message on a blue or black screen.
Dmesg and system logs: Check the logs, especially the output from dmesg immediately after booting. dmesg provides the kernel-related messages that can be helpful in identifying specific errors or problems.
root@localhost:~# dmesg | less
You can also use journalctl to check system logs:
root@localhost:~# journalctl -xb
Faulty modules: Another possible symptom of a corrupted kernel is problems with kernel modules. Check whether all modules can be loaded or whether error messages are displayed:
root@localhost:~# lsmod
root@localhost:~# modprobe yourmodulename
Inconsistencies in functionality: If certain system-related functions (such as network operations, file system access, hardware interactions, etc.) become unreliable or inexplicable errors occur, this could also indicate problems with the kernel.
Booting from an older kernel and repairing the latest kernel version
If an older kernel is installed on your server, you can boot your server with one of these kernels and carry out troubleshooting.
- Log in to your IONOS account log in.
Click Menu > Server & Cloud in the title bar. If you have several server contracts, select the desired contract.
click on Actions > Open remote console.
The remote console opens in a new tab.Immediately switch to Cloud Panel and click on Actions > Restart.
The connection to the console is interrupted during the restart.
Switch to the remote console.
Click on Options > Reconnect in the top left-hand corner until the following message is displayed:
- Immediately press and hold the ESC key until the Grub version window is displayed.
A list of available kernels is displayed, with the latest kernel at the top.
- Select the second most recent kernel and press Enter. If this kernel works, your server will now boot normally and the login prompt will be displayed.
Note
Do not select a recovery mode kernel!
- Enter your login data.
To check whether you have booted the server from an older kernel, enter the following command:
[root@localhost ~]# uname -r
Backup your server data
Backup your server data before you repair the kernel. You can either use the paid Cloud Backup or save the data locally on your computer with Filezilla.
You can find more information about Cloud Backup in the following articles:
Repair kernel
Use the following command to check which kernels are currently installed on your server:
[root@localhost ~]# rpm -q kernel
example:[root@localhost ~]# rpm -q kernel
kernel-5.14.0-70.13.1.el9_0.x86_64
kernel-5.14.0-427.16.1.el9_4.x86_64In this example, kernel-5.14.0-427.16.1.el9_4.x86_64 is the latest installed kernel and kernel-5.14.0-70.13.1.el9_0.x86_64 is the oldest.
To repair the latest kernel version, reinstall the corresponding kernel. To do this, replace the placeholder in the following command and then enter it.
CentOS[root@localhost ~]# sudo yum reinstall kernel-PACKAGE_VERSION
Example:
[root@localhost ~]# sudo yum reinstall kernel-5.14.0-427.16.1.el9_4.x86_64
AlmaLinux and Rocky Linux[root@localhost ~]# sudo dnf reinstall kernel-PACKAGE_VERSION
Example:[root@localhost ~]# sudo dnf reinstall kernel-5.14.0-427.16.1.el9_4.x86_64
To check whether the reinstallation was successful, enter the following command:
[root@localhost ~]# rpm -q kernel
The kernel 4.18.0-240.el8.x86_64 now displays the package status code ii. This means that it is installed and configured correctly. To complete the process, restart the server. The latest kernel will then be loaded automatically.
To complete the process, restart the server.
[root@localhost ~]# reboot
Repair kernel if there is not enough space on the boot partition
If there is not enough space on the boot partition, reinstalling the kernel using the method described above will fail.
To solve this problem, it is necessary to free up memory space. Proceed as follows:
Enter the following command to display information about the memory used:
[root@localhost ~]# df -h
Then release the memory space. You can find instructions on how to delete old kernels and free up memory space in the following article:
Manual installation of the kernel if the new installation fails
If reinstalling the kernel fails for a reason other than insufficient space on the boot partition, you can try to manually remove and reinstall the kernel.
Warning
Never remove the kernel you are currently using. This can lead to serious errors on your server. Always use the uname -r command to check which kernel you are using.
To remove the kernel and then reinstall it, proceed as follows:
Use the following command to check which kernels are currently installed on your server:
[root@localhost ~]# rpm -q kernel
To remove the kernel package, enter the following command:
CentOS 7
yum remove kernel-PACKAGE_VERSION
CentOS Stream 8, CentOS Stream 9, AlmaLinux and Rocky Linuxsudo dnf remove kernel-PACKAGE_VERSION
Examplesudo yum remove kernel-5.14.0-427.16.1.el9_4.x86_64
To check whether the kernel package has been removed, enter the following command:
[root@localhost ~]# rpm -q kernel
To reinstall the kernel, replace the placeholders in the following command and enter it:
CentOS
[root@localhost ~]# sudo yum reinstall kernel-PACKAGE_VERSION
Example:[root@localhost ~]# sudo yum reinstall kernel-5.14.0-427.16.1.el9_4.x86_64
AlmaLinux and Rocky Linux[root@localhost ~]# sudo dnf reinstall kernel-PACKAGE_VERSION
Example:[root@localhost ~]# sudo dnf reinstall kernel-5.14.0-427.16.1.el9_4.x86_64
Check that the kernel package is installed correctly.
[root@localhost ~]# rpm -q kernel
To restart the server, enter the following command:
[root@localhost ~]# reboot