From 1374b623fb397d442a6886ef5b889da7bbd5fda8 Mon Sep 17 00:00:00 2001 From: Stephen Wadeley Date: Aug 31 2015 05:08:46 +0000 Subject: Configuring GRUB 2 Using the grubby Tool Changing examples to bridgeheads --- diff --git a/en-US/Working_with_the_GRUB_2_Boot_Loader.xml b/en-US/Working_with_the_GRUB_2_Boot_Loader.xml index 9ac2fb2..f7ca789 100644 --- a/en-US/Working_with_the_GRUB_2_Boot_Loader.xml +++ b/en-US/Working_with_the_GRUB_2_Boot_Loader.xml @@ -144,11 +144,14 @@ The and parameters can be removed i + +
+Configuring GRUB 2 Using the grubby Tool - The grubby tool can be used to read information from, and make persistent changes to, the grub.cfg file. It enables, for example, changing GRUB menu entries to specify what arguments to pass to a kernel on system start and changing the default kernel. IS THIS BIT TRUE? In Red Hat Enterprise Linux 7, grubby defaults to working with the GRUB 2 configuration file, grub.cfg. Do we need to warn users to use the "--grub2" option in scripts? + The grubby tool can be used to read information from, and make persistent changes to, the grub.cfg file. It enables, for example, changing GRUB menu entries to specify what arguments to pass to a kernel on system start and changing the default kernel. In Red Hat Enterprise Linux 7, grubby defaults to working with the GRUB 2 configuration file, grub.cfg. - -Listing the Default Kernel + +Listing the Default Kernel To find out the file name of the default kernel, enter a command as follows: @@ -160,27 +163,35 @@ The and parameters can be removed i ~]# grubby --default-index 0 - - -Viewing the GRUB Menu Entry for a Kernel +Changing the Default Boot Entry + + To make a persistent change in the kernel designated as the default kernel, use the grubby command as follows: + ~]# grubby --set-default /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 + + +Viewing the GRUB Menu Entry for a Kernel - To view the GRUB menu entry for a kernel, enter a command as follows: - -~]# grubby --info /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 +To list all the kernel menu entries, enter a command as follows: + ~]$ grubby --info=ALL + + + + To view the GRUB menu entry for a specific kernel, enter a command as follows: +~]$ grubby --info /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 index=0 kernel=/boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 args="ro rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet LANG=en_US.UTF-8" root=/dev/mapper/rhel-root initrd=/boot/initramfs-3.10.0-229.4.2.el7.x86_64.img title=Red Hat Enterprise Linux Server (3.10.0-229.4.2.el7.x86_64) 7.0 (Maipo) - +Try tab completion to see the available kernels within the /boot/ directory. + + +Adding and Removing Arguments from a GRUB Menu Entry The option can be used to update a menu entry when used in combination with to add new arguments and to remove existing arguments. These options accept a quoted space-separated list. The command to simultaneously add and remove arguments a from GRUB menu entry has the follow format: grubby --remove-args="argX argY" --args="argA argB" --update-kernel /boot/kernel - - -Adding and Removing Arguments from a GRUB Menu Entry To add and remove arguments from a kernel's GRUB menu entry, use a command as follows: ~]# grubby --remove-args="rhgb quiet" --args=console=ttyS0,115200 --update-kernel /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 @@ -189,26 +200,22 @@ This command removes the Red Hat graphical boot argument, enables boot message t To review the changes, use the command option as follows: -~]# grubby --info /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 +~]$ grubby --info /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 index=0 kernel=/boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 args="ro rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us LANG=en_US.UTF-8 ttyS0,115200" root=/dev/mapper/rhel-root initrd=/boot/initramfs-3.10.0-229.4.2.el7.x86_64.img title=Red Hat Enterprise Linux Server (3.10.0-229.4.2.el7.x86_64) 7.0 (Maipo) - - -Updating All Kernel Menus with the Same Arguments +Updating All Kernel Menus with the Same Arguments To add the same kernel boot arguments to all the kernel menu entries, enter a command as follows: ~]# grubby --update-kernel=ALL --args=console=ttyS0,115200 The parameter also accepts DEFAULT or a comma separated list of kernel index numbers. - - - Changing a Kernel Argument +Changing a Kernel Argument To change a value in an existing kernel argument, specify the argument again, changing the value as required. For example, to change the virtual console font size, use a command as follows: ~]# grubby --args=vconsole.font=latarcyrheb-sun32 --update-kernel /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 @@ -219,7 +226,6 @@ root=/dev/mapper/rhel-root initrd=/boot/initramfs-3.10.0-229.4.2.el7.x86_64.img title=Red Hat Enterprise Linux Server (3.10.0-229.4.2.el7.x86_64) 7.0 (Maipo) - See the grubby(8) manual page for more command options.