Monday 9 June 2014

GRUB Troubleshooting 2


GRUB Troubleshooting 2
How to  Disable  fsck  of file systems from the grub menu?
At the grub prompt edit the boot parameters.
This is usually done by pressing e at the menu.
At the end of the ‘kernel’ line add ‘fastbootwithout the quotation marks. This is what skips the filesystem check.
Exit the grub mode and  boot the system.




How to Configure one time use of Specific Kernel Entry to boot,  in Grub Menu ?  
Using grub Command:
# grub
grub> savedefault –stage2=/boot/grub/stage2 –default=2 –once
Or invoking grup from a shell script:
# echo “savedefault –stage2=/boot/grub/stage2 –default=1 –once” | grub
Please notice that savedefault does not change the grub.conf, it just change the binary code within stage2 file /boot/grub/stage2.




Grub not starting the count down of Timeout value during booting, and we have to hit enter manually to boot from default kernel.
Either Hardware Clock of the Server not working, or had not working. Fixing the Hardware clock should resolve the issue.




How to find nextboot order when using grub “savedefault” option?
Use the below command to know the next boot order set with save default option
# xxd /boot/grub/stage2 |awk ‘ /0000200/ {print $8}’




How to boot into single user mode using the GRUB bootloader?
Single user mode can be accessed by appending an “S”, “s”, or “single” to the kernel command line in GRUB. To do this, restart the system and when the GRUB splash screen presents itself:
Select/highlight the desired kernel using the up/down arrow keys.
Press the letter a to modify the kernel line.
On the new screen, press the spacebar to add a space, then type the letter s and press Enter.
This will boot the system into single user mode, i.e. the boot process will stop immediately after execution of rc.sysinit and present a root BASH shell.
Note:
Adding “S”, “s”, or “single” to the kernel command-line tells the kernel to to have init drop to a root shell after rc.sysinit finishes. This allows one to get into the system without a password and bypass any problems with services.
Adding “1″ to the kernel command-line seems to do basically the same as above, but in reality init also kicks off rc for runlevel 1 before dropping to a root shell. This means that in runlevel 1, there could possibly be some services running (if they were configured in /etc/rc1.d).




How Troubleshoot the if the server hangs at GRUB prompt during boot?
Sometime, when SAN disks connected to the system were detected before the local hard disk. And the the local hard disk will be recognized as /dev/sdg instead of /dev/sda so the GRUB pointed to wrong device to boot from.To Diagnosis and troubles we can use the below guidelines
1. Boot  into Rescue mode, using CD#1 or Network Boot
boot: linux rescue
If your installation images reside on an FTP, HTTP or NFS server on your network, you need to enable it.Then, the rescue environment will ask if you wish to mount filesystems.
Select “Continue” to mount the filesystems in /mnt/sysimage with read-write mode. Now, you can access a minimal shell.
2. chroot the / filesystem
Before we troubleshoot GRUB, we change system environment so that  the grub-install command thinks your root filesystem is the /mnt/sysimage directory. Below command explains the procedure
# mount -t proc none /mnt/sysimage/proc
# mount -o bind /dev /mnt/sysimage/dev
# mount -o bind /sys /mnt/sysimage/sys
# chroot /mnt/sysimage
Verify that /boot is available:
# ls -l /mnt/sysimage/boot
To make sure where the GRUB bootloader was previously installed, check the ‘#boot=’ line in the configuration file:
# head /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,1)
# kernel /boot/vmlinuz-version ro root=/dev/hda2
# initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
3. Execute grub-install command for the / filesystem.
In this case it is in the MBR of the sda device, To restore the bootloader, execute:
# grub-install /dev/sda
4. Reboot the system
5. When you see GRUB splash screen, hit space key
6. Highlight the server title line, for example “Red Hat Enterprise Linux Server-base (2.6.18-53.el5)” , then type c key to drop into the command line.
7. At the grub prompt, use find command to find out which device has a kernel image (vmlinuz) and driver image (initrd).
If your system has a separate /boot partition, type
grub> find /initrd-2.6.18-53.el5.img
(hd0,0)
If your system does NOT have a separate /boot partition, type
grub> find /boot/initrd-2.6.18-53.el5.img
(hd0,0)
8. Using the device name found in the step 7, set up root as “hd0,0″.
grub> root (hd0,0)
9. Set up kernel image AND the location of / filesystem. This should look like the kernel line in /boot/grub/grub.conf.
If your system has a separate /boot partition, type
grub> kernel /vmlinuz-2.6.18-53.el5 ro root=LABEL=/1 rhgb quiet
If your system does NOT have a separate /boot partition, type
grub> kernel /boot/vmlinuz-2.6.18-53.el5 ro root=LABEL=/1 rhgb quiet
10. Set up driver image (initrd).
If your system has a separate /boot partition, type
grub> initrd /initrd-2.6.18-53.el5.img
If your system does NOT have a separate /boot partition, type
grub> initrd /boot/initrd-2.6.18-53.el5.img
11. Type boot command to boot with the setting made above steps.
grub> boot

No comments :

Post a Comment