IBM Support

Custom Linux Kernel boot configuration

Troubleshooting


Problem

Custom Linux Kernel boot configuration

Resolving The Problem

GRUB and GRUB2 Kernel Selection

Legacy GRUB (RHEL7 and previous, CentOS6 and previous)

  • Temporary kernel selection
    1. Connect to the server’s IPMI-KVM console.

    2. Reboot the system. The GRUB bootloader starts.

    3. Move the highlight/selection up or down with your keyboard’s up and down keys before the timeout. The default is 5 seconds.

    4. Press enter for the kernel that you wish to boot.
  • Changing the default boot kernel

    In every Linux distribution, the newest kernel is automatically configured by the package manager scripts as the default boot option. In cases where you want to use an older kernel or a custom kernel that is not installed by the package manager, complete the following steps:

    1. Log in to the system using SSH. Alternatively, you can log in to the system using IPMI-KVM.

    2. From a shell session, open the /boot/grub/grub.cfg file with the text editor (vi, vim, nano, emacs) of your choice.

    3. Change the “default” parameter to the corresponding entry. In the following screenshot, 0 defines the “/vmlinuz-2.6.32-696.18.7.el6.x86_64” entry. Setting the default to 1 would define “/vmlinuz-2.6.32-696.el6..x86_64” as the default kernel.

      C:\Users\hnguyen\Documents\ACS Projects\SelfServe\Screens\grubcfgscreenRHEL6x.png

    4. From your text editor, save and exit. The next time the system boots or is rebooted, it will boot to the newly defined default kernel.


GRUB 2 (CentOS7, Debian, Ubuntu Server 14.x and 16.x)

GRUB2 uses a less straightforward configuration method. Whereas Legacy GRUB will read from a single configuration file, GRUB2 utilizes a configuration file that is generated by built-in utilities. It is not expected to be read or edited directly by users or administrators. The true configuration file is created dynamically with variables and prerogatives that are configured in the human-readable /etc/default/grub file instead. Complete the following steps:

  1. Determine the running kernel:
    [root@testhost ~]# uname -r
    3.10.0-514.16.1.el7.x86_64

  2. Change the GRUB_DEFAULT variable to ‘saved’ in /etc/default/grub with your preferred text editor:
    [root@testhost~]# cp /etc/default/grub /etc/default/grub.bak
    [root@testhost~]# vim /etc/default/grub
    GRUB_DEFAULT=saved

    C:\Users\hnguyen\Documents\ACS Projects\SelfServe\Screens\grubcfgscreenUbuntu.png

  3. Back up the existing configuration file in case it is needed again. Sew the following command example:
    [root@testhost ~]# cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak

  4. Issue a rebuild command for GRUB2:
    [root@testhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

  5. Check and confirm all installed kernels and obtain the name of the one that you want to use:
    [root@testhost~]# grep "^menuentry" /boot/grub2/grub.cfg | cut -d "';" -f2
    CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)
    CentOS Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)
    CentOS Linux (3.10.0-327.36.3.el7.x86_64) 7 (Core)
    CentOS Linux (3.10.0-327.22.2.el7.x86_64) 7 (Core)

  6. Run the following command assuming 3.10.0-327.36.3 is desired:
    [root@testhost ~]# grub2-set-default "CentOS Linux (3.10.0-327.36.3.el7.x86_64) 7 (Core)

    Note: In the case of Ubuntu, prepend ‘Advanced options for Ubuntu’ (if listed) to the kernel name in this command, as sub-menu dependencies will break without it.

  7. Verify the changes using the following example command:
    [root@testhost ~]# grub2-editenv list
    saved_entry=CentOS Linux (3.10.0-327.36.3.el7.x86_64) 7 (Core)

Document Location

Worldwide


[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSCL81","label":"Network Tools"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

More support for:
Network Tools

Software version:
All Versions

Document number:
963398

Modified date:
01 August 2019

UID

ibm1KB0010937

Manage My Notification Subscriptions