Managing the Kernel on a Linode
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
The primary component of every Linux system is the Linux kernel. The kernel interfaces with the system’s hardware and it controls the operating system’s core functionality. This guide covers the types of kernels that can be assigned to a Linode and how to view, update, or change the kernel.
Types of Kernels
Your Linode is capable of running one of three kinds of kernels:
Upstream kernel (or distribution-supplied kernel): This kernel is maintained and provided by your Linux distribution. A major benefit of this kernel is that the distribution was designed with this kernel in mind and all updates are managed through the distributions package management system. It also may support features not present in the Linode kernel (for example, SELinux).
Linode kernel: Linode also maintains kernels that can be used on a Linode. If selected, these kernels are provided to your Linode at boot (not directly installed on your system). The Current Kernels page displays a list of all the available Linode kernels.
Custom-compiled kernel: A kernel that you compile from source. Compiling a kernel can let you use features not available in the upstream or Linode kernels, but it takes longer to compile the kernel from source than to download it from your package manager. For more information on custom compiled kernels, review our guides for Debian, Ubuntu, and CentOS.
Most of the distribution images available on Linode use the upstream distribution-supplied kernel by default.
Determining Which Kernel Is Installed
There are may ways you can determine which kernel version is installed on your Linux system. The following instructions cover the most common methods:
Run one of the following commands to display the kernel version:
uname -r: Outputs a single line with just the kernel version.
hostnamectl: Outputs an organized list of system details, including the kernel version. Can only be used on distributions with systemd (Debian, Ubuntu, CentOS, openSUSE, and more).
cat /proc/version: Outputs a string that contains the kernel version and release details.
The kernel version should be a string that’s similar to
5.4.0-80-generic. In this example, the kernel ends with
generic, which is common in Ubuntu systems to designate that this is an upstream kernel. If the kernel ends with something similar to
linode123, a Linode kernel is being used and the string matches the precise Linode kernel release.
Viewing and Modifying the Kernel in the Cloud Manager
You can use the Cloud Manager to view the type of kernel you are using. If you are using a Linode kernel (not an upstream kernel), you can also view the kernel version.
NoteThese instructions may not accurately reflect the actual kernel version installed. This is especially true if the Linode hasn’t been rebooted in a while or wasn’t rebooted after a change to the Linode’s Configuration. To determine the actual kernel version installed on your system, see Determining Which Kernel Is Installed.
Navigate to your Linode in the Cloud Manager and click the Configuration tab.
Find your current Configuration and click the corresponding Edit link. This may be located within the More Options Ellipses dropdown menu.
Scroll to the Boot Settings section.
Review the Kernel dropdown menu selection.
- Latest 64 bit: Uses the latest 64-bit Linode kernel at the time the Linode boots/reboots. This was the default for most 64-bit distributions prior to August 2018.
- Latest 32 bit: Uses the latest 32-bit Linode kernel at the time the Linode boots/reboots. This was the default for most 32-bit distributions prior to August 2018.
- Direct Disk: Instead of a Linux Kernel, this uses the MBE (Master Boot Record) of the primary disk*.
- GRUB 2: Uses the upstream distribution-supplied kernel that’s installed on the primary disk. If a custom kernel has been installed instead, that is used instead. This is the most common option and has been the default for most new Linodes created after August 2018.
- GRUB (Legacy): Uses the upstream distribution-supplied kernel that’s installed on the primary disk*. This should only be used on older Linux distributions that have Grub (not Grub 2) installed, like CentOS 6.
- Specific Linode Kernel: Allows you to specify the exact Linode kernel to use. Since this kernel is maintained regardless of reboots or system updates, it may be preferred in some use cases.
*Primary disk: the disk assigned as the “Root Device” within the Linode’s Configuration Profile.
Make any desired changes and click the Save Changes button. Otherwise, if no changes were made, click Cancel.
If any changes were made, reboot your Linode for the new kernel to take affect.
Updating the Kernel
Provided a newer kernel is available, you should be able to either manually (or automatically) update the kernel. The exact steps vary depending on the type of kernel and, for upstream kernels, the Linux distribution you are using.
Updating the Linode Kernel
Follow these steps if the Linode is using a Linode kernel:
- Latest 64-bit or 32-bit kernel: Rebooting the Linode automatically updates the kernel used within your system to the latest Linode kernel release.
- Specific kernel version (ex:
5.12.2-x86_64-linode144): To update your kernel, follow the instructions within the Viewing and Modifying the Kernel in the Cloud Manager section. When selecting the kernel in the Linode’s Configuration Profile, chose your desired kernel version (or select
Latest 64 bit), save the changes, and reboot your Linode.
Updating the Upstream Kernel
Follow these steps if the Linode is using an upstream kernel (the default for most new Linodes created after August 2018):
Upgrade any system packages related to the kernel:
sudo apt-get update && sudo apt-get upgrade linux-generic
sudo apt-get update && sudo apt-get upgrade linux-base
CentOS Stream, CentOS 8, AlmaLinux 8, Rocky Linux 8, and Fedora
sudo dnf upgrade kernel
sudo yum update kernel
Alternatively, you can upgrade all packages on your system. For specific commands, review the Update/Upgrade sections in the guides for your package manager. See APT (for Ubuntu and Debian), DNF (for CentOS Stream, CentOS 8, AlmaLinux 8, Rocky Linux 8, and Fedora), and YUM (for CentOS 7).
Reboot the Linode.
Considerations When Switching From a Linode Kernel to GRUB 2
If you wish to switch from a Linode kernel to GRUB 2, there are a few issues you may encounter in older systems created prior to August 2018.
CentOS 7 and Fedora ship with SELinux running in enforcing mode by default. When switching from the Linode kernel to the upstream kernel, SELinux may need to relabel your filesystem at boot. When the relabeling completes, the Linode will shut down. If you have Lassie enabled, the Linode will automatically boot back up following the shut down. If you do not have Lassie enabled, you will need to manually reboot from the Cloud Manager.
You can trigger the relabel process by creating an empty
/.autorelabel file and then rebooting:
No Upstream Kernel Installed
If your system does not boot and instead shows a GRUB command line prompt in Lish like shown below, then you need to install the kernel and configure GRUB. This should only be necessary on Linodes which were created before February 2017. If this is the case, switch back to the Linode kernel in your configuration profile, reboot your Linode, and then follow this guide’s instructions for installing the kernel.
Installing the Upstream Kernel and Configuring GRUB
For new Linodes, an upstream kernel is already installed on your system and you do not need to follow these steps. In the case of older Linodes, this section outlines how to get both an upstream kernel (and GRUB) installed and configured on your system.
Update your package management system and install the Linux kernel and GRUB 2. Choose
/dev/sdaif you’re asked which disk to install to during installation. Linode provides the GRUB bootloader, so your system only needs to provide a
sudo apt update && sudo apt install linux-generic grub2
sudo apt update && sudo apt install linux-image-amd64 grub2
CentOS Stream, CentOS 8, AlmaLinux 8, Rocky Linux 8, Fedora
sudo dnf upgrade && sudo dnf install kernel grub2
sudo yum update && sudo yum install kernel grub2
sudo pacman -Syu && sudo pacman -S linux grub
emerge -avDuN world
There are two main ways to install Gentoo’s kernel: Manual configuration and using the
genkerneltool. Which you use and how you configure the kernel will depend on your preferences, so see the Gentoo Handbook for instructions.
When the installation finishes, the kernel and other components are located in the
/bootdirectory. For example:
[[email protected] ~]# ls /boot grub initramfs-linux-fallback.img initramfs-linux.img vmlinuz-linux
/etc/default/grubin a text editor and go to the line beginning with
GRUB_CMDLINE_LINUX. Remove the word
quietif present, and add
console=ttyS0,19200n8 net.ifnames=0. Leave the other entries in the line. For example, on CentOS 7 you should have something similar to:
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb console=ttyS0,19200n8 net.ifnames=0"
Add or change the options in
/etc/default/grubto match the following snippet. There are other variables in this file, but the current changes are only focused on these lines.
- File: /etc/default/grub
1 2 3 4 5
GRUB_TERMINAL=serial GRUB_DISABLE_OS_PROBER=true GRUB_SERIAL_COMMAND="serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1" GRUB_DISABLE_LINUX_UUID=true GRUB_GFXPAYLOAD_LINUX=text
Prepare and update the bootloader:
Debian and Ubuntu
.autorelabelfile is necessary to queue the SELinux file system relabeling process when rebooting from the Linode kernel to the CentOS kernel.
mkdir /boot/grub ln -s /boot/grub2/grub.cfg /boot/grub/grub.cfg grub2-mkconfig -o /boot/grub/grub.cfg touch /.autorelabel
Arch and Gentoo
grub-mkconfig -o /boot/grub/grub.cfg
This page was originally published on