Managing Kernels for Oracle Linux Instances
Learn how to manage kernel boot parameters before booting and at runtime and how to use grubby
to manage kernels for Oracle Linux instances on Oracle Cloud Infrastructure.
See also: Managing Kernels and System Boot.
Using grubby to Manage Kernels
The grubby tool can be used to read information from and make persistent changes to the grub.cfg
file which defines the GRUB configuration for an Oracle Linux instance. Using the grubby
command, you can view kernel configuration, specify the default boot kernel, configure extra kernel command line boot parameters, and change the kernel boot (GRUB) menu. See the grubby(8)
manual page for more information.
List Installed Kernels and Default Kernel
Use the grubby command to see all kernels installed on an Oracle Linux instance, configuration information about the kernels, which kernel is the default and which kernel is currently running.
- From a command line, using administrative privileges connect to the instance using SSH.
- List the installed kernels using one of the following options. The list of installed kernels might be different depending on the Oracle Linux version.
- List the kernels using
grubby
and the--info=ALL
command option to see the boot configuration associated with each installed kernel.sudo grubby --info=ALL
index=0 <<Each boot entry is assigned an index, which is a number that indicates its position in the GRUB menu kernel="/boot/vmlinuz-5.15.0-305.176.4.el8uek.x86_64" <<Full path to the kernel image args="ro crashkernel=auto LANG=en_US.UTF-8 console=tty0 console=ttyS0,115200 rd.luks=0 / <<Command-line arguments passed to the kernel when it boots rd.md=0 rd.dm=0 rd.lvm.vg=ocivolume rd.lvm.lv=ocivolume/root rd.net.timeout.carrier=5 / netroot=iscsi:169.254.0.2:::1:iqn.2015-02.oracle.boot:uefi / rd.iscsi.param=node.session.timeo.replacement_timeout=6000 net.ifnames=1 / nvme_core.shutdown_timeout=10 ipmi_si.tryacpi=0 ipmi_si.trydmi=0 libiscsi.debug_libiscsi_eh=1 / loglevel=4 ip=dhcp,dhcp6 rd.net.timeout.dhcp=10 crash_kexec_post_notifiers / fips=1 boot=UUID=5097b6ba-ed0e-418a-9c2c-fb25d577991f $tuned_params" root="/dev/mapper/ocivolume-root" <<Root partition device initrd="/boot/initramfs-5.15.0-305.176.4.el8uek.x86_64.img $tuned_initrd" <<Path to the initial RAM disk (initrd) image title="Oracle Linux Server (5.15.0-305.176.4.el8uek.x86_64 with Unbreakable Enterprise Kernel) 8.10" <<Title displayed in the GRUB menu at startup id="7063910fe2979258f8fd66f2fb8b8567-5.15.0-305.176.4.el8uek.x86_64" <<Unique identifier for the boot entry index=1 kernel="/boot/vmlinuz-4.18.0-553.40.1.el8_10.x86_64" ... title="Oracle Linux Server (4.18.0-553.40.1.el8_10.x86_64) 8.10" ... index=2 kernel="/boot/vmlinuz-0-rescue-7063910fe2979258f8fd66f2fb8b8567" ... title="Oracle Linux Server (0-rescue-7063910fe2979258f8fd66f2fb8b8567 with Unbreakable Enterprise Kernel) 8.10" ...
From the output of sudo grubby --info=ALL, you can determine what is displayed in kernel boot menu at startup. For example, using the index number and title in the above output, the kernel boot menu would display as follows:
Oracle Linux Server (5.15.0-305.176.4.el8uek.x86_64 with Unbreakable Enterprise Kernel) 8.10 Oracle Linux Server (4.18.0-553.40.1.el8_10.x86_64) 8.10 Oracle Linux Server (0-rescue-7063910fe2979258f8fd66f2fb8b8567 with Unbreakable Enterprise Kernel) 8.10
- List the installed kernels in the
/boot
directory.sudo ls -l /boot/vmlinuz*
-rwxr-xr-x. 1 root root 13701352 Feb 12 19:33 /boot/vmlinuz-0-rescue-7063910fe2979258f8fd66f2fb8b8567 -rwxr-xr-x. 1 root root 10889384 Feb 11 12:19 /boot/vmlinuz-4.18.0-553.40.1.el8_10.x86_64 -rwxr-xr-x. 1 root root 13701352 Jan 29 04:13 /boot/vmlinuz-5.15.0-305.176.4.el8uek.x86_64
- List the kernels using
- List which kernel is configured as the default kernel to use at boot and its title and position as seen in the kernel boot menu. The default kernel might be different depending on the Oracle Linux version.
- List default kernel.
sudo grubby --default-kernel
/boot/vmlinuz-5.15.0-305.176.4.el8uek.x86_64
- Check the title of the default kernel.
sudo grubby --default-title
The output matches the value seen in the kernel boot menu when starting Oracle Linux
Oracle Linux Server (5.15.0-305.176.4.el8uek.x86_64 with Unbreakable Enterprise Kernel) 8.10
- Find the position of the default kernel in the kernel boot list.
sudo grubby --default-index
0
- List default kernel.
- Check which kernel is currently running on the instance.
uname -r
5.15.0-305.176.4.el8uek.x86_64
The default kernel and the currently running kernel might not be identical because
- You installed a newer kernel, but you have not rebooted the system
- During a system reboot, you selected an alternative kernel manually to be the operative kernel
- You manually updated the default kernel but have not rebooted the system after the update
Change Default Kernel
Use the grubby command to set the default boot kernel in the GRUB 2 configuration.
- From a command line, using administrative privileges connect to the instance using SSH.
- List default kernel.
sudo grubby --default-kernel
For example:
/boot/vmlinuz-5.15.0-305.176.4.el8uek.x86_64
- Use the grubby --set-default command to change the default kernel making sure to specify the full path to the kernel. You can get the kernel path using either of the options in step 2 of Listing Installed Kernels and Default Kernel.
For example:
sudo grubby --set-default /boot/vmlinuz-4.18.0-553.40.1.el8_10.x86_64
The change takes effect immediately and persists across system reboots.
- Verify the default kernel change.
sudo grubby --default-kernel
For example:
/boot/vmlinuz-4.18.0-553.40.1.el8_10.x86_64
- (Optional) Set the new default kernel to the first position in the kernel boot menu using the grubby --set-default-index command.The new default kernel is displayed first in the kernel boot menu, for example:
sudo grubby --set-default-index=0
Oracle Linux Server (4.18.0-553.40.1.el8_10.x86_64) 8.10 Oracle Linux Server (5.15.0-305.176.4.el8uek.x86_64 with Unbreakable Enterprise Kernel) 8.10 Oracle Linux Server (0-rescue-7063910fe2979258f8fd66f2fb8b8567 with Unbreakable Enterprise Kernel) 8.10
- Reboot the instance to boot with the new default kernel.
Change Kernel Boot Parameters
Use the grubby --update-kernel
command to add new arguments, change existing argument values, or remove arguments for a specific kernel or all kernels. Multiple arguments can be specified for each option in a quoted space-separated list. You can add and remove arguments in the same operation. When using the --args
option, if an argument already exists the new value replaces the old values.
- From a command line, using administrative privileges connect to the instance using SSH.
- Use the
grubby --update-kernel
command to change or add a specific kernel boot argument. For example, update the kernel parameters to change the LANG argument for:- all kernels
sudo grubby --update-kernel=ALL --args LANG=en_GB.UTF-8
- one kernel
sudo grubby --update-kernel /boot/vmlinuz-5.4.17-2136.337.5.1.el7uek.x86_64 --args LANG=en_GB.UTF-8
- all kernels
- Verify the changes have taken effect.
sudo grubby --info=ALL
- all kernels
index=0 kernel="/boot/vmlinuz-5.4.17-2136.337.5.1.el7uek.x86_64" args="ro crashkernel=auto console=tty0 console=ttyS0,115200 rd.luks=0 rd.md=0 rd.dm=0 rd.lvm.vg=ocivolume rd.lvm.lv=ocivolume/root rd.net.timeout.carrier=5 netroot=iscsi:169.254.0.2:::1:iqn.2015-02.oracle.boot:uefi rd.iscsi.param=node.session.timeo.replacement_timeout=6000 net.ifnames=1 nvme_core.shutdown_timeout=10 ipmi_si.tryacpi=0 ipmi_si.trydmi=0 libiscsi.debug_libiscsi_eh=1 loglevel=4 ip=dhcp,dhcp6 rd.net.timeout.dhcp=10 crash_kexec_post_notifiers fips=1 boot=UUID=5097b6ba-ed0e-418a-9c2c-fb25d577991f LANG=en_GB.UTF-8 $tuned_params" ... index=1 kernel="/boot/vmlinuz-4.18.0-553.40.1.el8_10.x86_64" args="ro crashkernel=auto console=tty0 console=ttyS0,115200 rd.luks=0 rd.md=0 rd.dm=0 rd.lvm.vg=ocivolume rd.lvm.lv=ocivolume/root rd.net.timeout.carrier=5 netroot=iscsi:169.254.0.2:::1:iqn.2015-02.oracle.boot:uefi rd.iscsi.param=node.session.timeo.replacement_timeout=6000 net.ifnames=1 nvme_core.shutdown_timeout=10 ipmi_si.tryacpi=0 ipmi_si.trydmi=0 libiscsi.debug_libiscsi_eh=1 loglevel=4 ip=dhcp,dhcp6 rd.net.timeout.dhcp=10 crash_kexec_post_notifiers fips=1 boot=UUID=5097b6ba-ed0e-418a-9c2c-fb25d577991f LANG=en_GB.UTF-8 $tuned_params" ...
- one kernel
index=0 kernel="/boot/vmlinuz-5.4.17-2136.337.5.1.el7uek.x86_64" args="ro crashkernel=auto console=tty0 console=ttyS0,115200 rd.luks=0 rd.md=0 rd.dm=0 rd.lvm.vg=ocivolume rd.lvm.lv=ocivolume/root rd.net.timeout.carrier=5 netroot=iscsi:169.254.0.2:::1:iqn.2015-02.oracle.boot:uefi rd.iscsi.param=node.session.timeo.replacement_timeout=6000 net.ifnames=1 nvme_core.shutdown_timeout=10 ipmi_si.tryacpi=0 ipmi_si.trydmi=0 libiscsi.debug_libiscsi_eh=1 loglevel=4 ip=dhcp,dhcp6 rd.net.timeout.dhcp=10 crash_kexec_post_notifiers fips=1 boot=UUID=5097b6ba-ed0e-418a-9c2c-fb25d577991f LANG=en_GB.UTF-8 $tuned_params" ... index=1 kernel="/boot/vmlinuz-4.18.0-553.40.1.el8_10.x86_64" args="ro crashkernel=auto console=tty0 console=ttyS0,115200 rd.luks=0 rd.md=0 rd.dm=0 rd.lvm.vg=ocivolume rd.lvm.lv=ocivolume/root rd.net.timeout.carrier=5 netroot=iscsi:169.254.0.2:::1:iqn.2015-02.oracle.boot:uefi rd.iscsi.param=node.session.timeo.replacement_timeout=6000 net.ifnames=1 nvme_core.shutdown_timeout=10 ipmi_si.tryacpi=0 ipmi_si.trydmi=0 libiscsi.debug_libiscsi_eh=1 loglevel=4 ip=dhcp,dhcp6 rd.net.timeout.dhcp=10 crash_kexec_post_notifiers fips=1 boot=UUID=5097b6ba-ed0e-418a-9c2c-fb25d577991f LANG=en_US.UTF-8 $tuned_params" ...
- all kernels
- Reboot the instance to boot with the new kernel configuration.
To change kernel boot parameters without grubby, edit the
/etc/default/grub
file directly and modify boot parameter settings in the GRUB_CMDLINE_LINUX
definition. For example, change LANG=en_US.UTF-8
to LANG=en_GB.UTF-8
:GRUB_CMDLINE_LINUX="crashkernel=auto LANG=en_GB.UTF-8 console=tty0 console=ttyS0
,115200 rd.luks=0 rd.md=0 rd.dm=0 rd.lvm.vg=ocivolume rd.lvm.lv=ocivolume/root r
d.net.timeout.carrier=5 netroot=iscsi:169.254.0.2:::1:iqn.2015-02.oracle.boot:ue
fi rd.iscsi.param=node.session.timeo.replacement_timeout=6000 net.ifnames=1 nvme
_core.shutdown_timeout=10 ipmi_si.tryacpi=0 ipmi_si.trydmi=0 libiscsi.debug_libi
scsi_eh=1 loglevel=4 ip=dhcp,dhcp6 rd.net.timeout.dhcp=10 crash_kexec_post_notif
iers"
For the changes to take effect at the next system reboot, rebuild the GRUB 2 configuration: sudo grub2-mkconfig -o /boot/grub2/grub.cfg