Search This Blog

2014-08-12

Debug RHEL Boot Using GRUB

When a machine fails to boot in redhat while loading the kernel it is generally nor verbose as to why it failed.

To make it verbose there's a couple parameters we can remove that hide that information.
quiet - turns off verbose logging when added to the kernel line
rhgb - redhat gui boot (the little progress bar that loads while redhat is booting)


In GRUB 0.97 a sample kernel line in /boot/grub/grub.conf would look as follows:
/boot/grub/grub.conf
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/mapper/VolGrp-Vol1 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGrp/Vol1 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet


To get additional logging we can add console via:
console=tty0 console=ttyS0,115200n8

Which will give us output to the first serial console COM1 port and video console

Then we can remove the quiet and rhgb options so the kernel line looks like the following:
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/mapper/VolGrp-Vol1 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGrp/Vol1 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM console=tty0 console=ttyS0,115200n8


That should get you most of what debug you require. If you still need more there are a couple more common options you can add they are:
confirm - confirm the execution of every init script load to debug where failures are happening
single - drops you into single user mode
rdshell - if root fails to mount or you cannot get any further in the boot process it will drop you to a dracut shell to use to debug


The final kernel line of a common debugging scenario that I usually have is:
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/mapper/VolGrp-Vol1 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGrp/Vol1 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM console=tty0 console=ttyS0,115200n8 rdshell single

Which lets me drop to single user mode if necessary (if it can only mount root read only). Then if it cant even find root it takes me to dracut shell and provides all output on console and video console.

References:
Basic GRUB1 Config w/ video and serial redirection: http://www.cyberciti.biz/faq/linux-serial-console-howto/
GRUB2 and GRUB1 with inittab and pinouts: http://www.coreboot.org/Serial_console#Enabling_Serial_Console
Ubuntu and GRUB2: https://help.ubuntu.com/community/SerialConsoleHowto
Arch with systemd GRUB2 and GRUB1: https://wiki.archlinux.org/index.php/working_with_the_serial_console#Configure_console_access_on_the_target_machine
Debian inittab securetty and GRUB1: http://www.cyberciti.biz/faq/howto-setup-serial-console-on-debian-linux/
RedHat 7 and GRUB2: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sec-GRUB_2_over_Serial_Console.html
Debug using Dracut Fedora: http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
Redhat dracut: http://people.redhat.com/harald/dracut.html

No comments:

Post a Comment