Redhat: Grub
GRUB
Redhat used the GRUB bootloader. It uses the /boot partition to determine what kernel to boot by default, and also locates the boot menu.
GRUB can be configured to boot any OS or kernel found, either at boot up through the grub.conf file. GRUB can also be password protected to restrict access.
Modify the Bootloader
The grub.conf file can be found in /boot/grub.
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd1,0)
# kernel /vmlinuz-version ro root=/dev/md0
# initrd /initrd-[generic-]version.img
#boot=/dev/sdb
default=0
timeout=5
splashimage=(hd1,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
root (hd1,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=05d8086d-e1b1-4584-a760-7fc10a217059 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=uk LANG=en_US.UTF-8 rd_MD_UUID=df8151a1:0b11a89a:7b08b55c:759cccc1 rd_MD_UUID=886008e8:9dc03fa0:ac7d12bc:29c6faa1 quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_NO_LVM rd_NO_DM
initrd /initramfs-2.6.32-220.el6.x86_64.img
The few lines are comments showing that the file was created at installation. The last comment defines which hard drive has the 'master boot record, in this case /dev/sdb.
The next four lines define the default configuration of GRUB. The default directive defines which OS is booted by default. In this case the default is set to '0', meaning that the first stanza is booted - in this case theres only one....
The timeout sets the time the splashscreen is shown before booting the default OS, and the splashscreen location is also specified.
The final directive is 'hiddenmenu'. This stops the menu being shown and instead displays message:
Booting Redhat Enterprise Linux Server (2.6.32-71.el6.x86_64)
OS Stanzas
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
root (hd1,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=05d8086d-e1b1-4584-a760-7fc10a217059 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=uk LANG=en_US.UTF-8 rd_MD_UUID=df8151a1:0b11a89a:7b08b55c:759cccc1 rd_MD_UUID=886008e8:9dc03fa0:ac7d12bc:29c6faa1 quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_NO_LVM rd_NO_DM
initrd /initramfs-2.6.32-220.el6.x86_64.imgEach bootable OS is defined in a stanza, starting with the title that will be displayed on the GRUB menu. It also defines the location of the the boot directive, here the second hard drives, first partition.
The next two lines define the location of the kernel along with the boot options, followed by the location of the initrd.
Grub on Centos 7
- Show all the info on the current grub setup
grubby --info=ALL- Check the default boot kernel/initd
[root@mds ~]# grubby --default-index
1- Add arguments to the kernel (all of them)
grubby --args=console=ttyS1,115200 --update-kernel=ALL- Setup the kernel to boot an alternative kernel
grubby --set-default 0