You’ve decided to reboot your Linux Desktop (or remote server) and instead of getting to running system you were greeted by something like this
1 2 3 4 5 6 |
GNU GRUB version 0.97 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename.] grub> |
Why did it happen and where to go from here?
Now I can not possibly offer you “cure for all illnesses” here. I can think of about 10 different reasons why your boot process will end up in GRUB shell.
What I want to review is the particular situation that can end up like this and possible ways out of it.
What we will need is the ability to boot from recovery CD (for CentOS installation CD preferrable, for other distros – rescue media they provide) and access to the console – for the remote server that could be IP-KVM or iLO/IPMI management card, for local PC – attached display/keyboard. Knowledge of the name of root device would be also very helpful (or device UUID if that’s your thing). As well as knowledge if you have separate /boot parititon or not
First and foremost advice – do not despair – GRUB shell is pretty powerful and flexible tool for its purposes.
Lets try to find where (if) do we have GRUB installed.
1 2 3 |
grub> find /grub/stage1 find /grub/stage1 (hd0,0) |
Good – 1st primary partition.
Now, lets check if it’s possibly /boot partition or root, and where is root partition and if it is readable at all.
1 2 3 |
grub> find /etc/passwd find /etc/passwd (hd0,5) |
Ok, in our case root partition is first logical drive of extended partition, that means that GRUB is installed on separate /boot partition.
Now, one of the reasons boot processes ended up in GRUB shell is that GRUB could not find it’s config file so it has no information about kernel to boot. Lets check this out
1 2 3 |
grub> find /grub/menu.lst find /grub/menu.lst (hd0,0) |
The file is there, why it did not load? One of possible reasons is the file itself is corrupt. Let’s try to find out.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
cat (hd0,0)/grub/menu.lst # 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 (hd0,0) # kernel /vmlinuz-version ro root=/dev/md0 # initrd /initrd-version.img #boot=/dev/md5 default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-194.11.3.el5) root (hd0,0) kernel /vmlinuz-2.6.18-194.11.3.el5 ro root=/dev/sda6 selinux=0 initrd /initrd-2.6.18-194.11.3.el5.img |
Looks correct – we also refreshed our memory about root device. Why this config file was not executed then? Let’s try one more test:
1 2 3 4 |
grub> find /boot/grub/menu.lst find /boot/grub/menu.lst Error 15: File not found |
Now here is the clue – in some cases ( I don’t know exactly which) GRUB *stage_15 part looks for /boot/grub/menu.lst regardless of the partition on which it was installed. In case of separate /boot partition that calls for special symlink, which is not existant in our situation.
What we can do now – we can try to boot manually or boot from rescue CD to resolve the problem.
Lets try to boot manually via GRUB shell. Use TAB completion to get the list of kernel/initrd images you can use
1 2 3 4 5 6 7 8 |
grub> kernel /vmlin<TAB> vmlinuz-2.6.18-164.el5 vmlinuz-2.6.18-194.11.3.el5 vmlinuz-2.6.18-194.3.1.el5 kernel /vmlinuz-2.6.18-194.3.1.el5 ro root=/dev/sda6 selinux=0 grub> initrd /initrd-<TAB> initrd-2.6.18-164.el5.img initrd-2.6.18-194.3.1.el5.img initrd-2.6.18-194.11.3.el5.img initrd /initrd-2.6.18-194.3.1.el5.img grub> boot |
If starts are in lucky position and there are no other problems (corrupt file system for example), then your system will boot and we can correct the reason why it’s all happened in the first place.
1 2 |
# cd /boot # ln -s . boot |
From this otherwise very informative page I’ve got possible explanation of the reason of this problem and the solution same as above. But because of page formatting I’ve got it wrong and did
1 2 |
# cd /boot # ln -s /boot boot |
And very next reboot I was awarded with infamous GRUB “error 26” – – too many symbolic links just like this guy.
I hope this page was helpful and saved you some time and efforts.
0 Comments.