Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-18-2012, 12:28 AM
|
#1
|
LQ Newbie
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16
Rep:
|
Stuck at grub legacy prompt after boot.
Hi, I have CentOS 6 installed on my server and accidentally deleted the contents of /boot partition, so I d/loaded a CentOS LiveCD and booted from it.
I chrooted into /mnt/sysimage I created and mount -o bind the lvs that contain /usr and / respectively and I reinstalled grub grubby xen and the kernel with yum reinstall blah... /boot got populated again but /boot/grub/grub.conf was not created so I used one of my other server to mimic it of course changing the sd_LVM_LV= values to suit the other server's, when I reboot 'm stuck at the grub> prompt where I can type commands and I can certainly boot using:
Code:
kernel /vmlinuz
initrd /initramfs.img
boot
The system starts just fine and I can use it normally, but if I reboot, then again stuck at grub's prompt.
Apparently Grub is not reading my grub.conf which *IS* there indeed.
I've read a zillion threads and forums but they take me nowhere.
If anyone can help this n00b, thanks.
|
|
|
05-18-2012, 02:07 PM
|
#2
|
Member
Registered: Dec 2011
Posts: 114
Rep:
|
Do the necessary backup once the server is up then reboot the server with the Redhat installation DVD. Choose the option "install or upgrade an existing system", it should fix your problem if you follow the upgrade properly. Do this at your own risk.
|
|
|
05-18-2012, 03:56 PM
|
#3
|
Senior Member
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791
|
I don't know if this will be of any help, but long ago, I downloaded to my collection of helpful docs, a howto that explains how to restore grub-legacy. Unfortunately, I didn't document the source, so I don't know to whom the credit should go, but it's saved me many, many times. Anyway, heres an example taken from that howto:
Code:
title Red Hat Linux (2.4.18-14)
root (hd0,1)
kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/ hdc=ide-scsi
initrd /boot/initrd-2.4.18-14.img
where (hd0,1)/boot/grub contains all the grub files, and the partition containing the Linux filesystem to be run has the label /.
|
|
|
05-18-2012, 04:07 PM
|
#4
|
LQ Newbie
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16
Original Poster
Rep:
|
Quote:
Originally Posted by RockDoctor
I don't know if this will be of any help, but long ago, I downloaded to my collection of helpful docs, a howto that explains how to restore grub-legacy. Unfortunately, I didn't document the source, so I don't know to whom the credit should go, but it's saved me many, many times. Anyway, heres an example taken from that howto:
Code:
title Red Hat Linux (2.4.18-14)
root (hd0,1)
kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/ hdc=ide-scsi
initrd /boot/initrd-2.4.18-14.img
where (hd0,1)/boot/grub contains all the grub files, and the partition containing the Linux filesystem to be run has the label /.
|
Thanks Doctor,
As soon as my brother gets to the office and can turn on the server (remote location) I'll try that. In the meantime I'd like to know what's the file that grub looks for when it goes into stage2 grub.conf or menu.lst?, I have them both, menu.lst being a symlink to grub.conf.
Also as I have my root filesystem on LVM I have this cryptic line.
Code:
title CentOS (3.2.6-0.choon.centos6.x86_64)
root (hd0,0)
kernel /xen.gz loglvl=all guest_loglvl=all dom0_max_vcpus=1 dom0_vcpus_pin conswitch=g dom0_mem=384M console=vga
module /vmlinuz-3.2.6-0.choon.centos6.x86_64 ro root=/dev/mapper/vgMaster-root nomodeset rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vgMaster/swap rd_LVM_LV=vgMaster/root KEYBOARDTYPE=pc KEYTABLE=es rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_NO_DM earlyprintk=xen console=hvc0
module /initramfs-3.2.6-0.choon.centos6.x86_64.img
That is workin on the other server which is almost the same as this one, but I get stuck at the grub prompt.
Code:
Probing devices to guess BIOS drives. This may take a long time.
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>
I'll try your suggestion and tell you how this goes.
Thanks for taking the tme to answer.
|
|
|
05-18-2012, 04:46 PM
|
#5
|
Senior Member
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791
|
I think menu.lst is the standard name for the file, although Red Hat and its derivatives use grub.conf and simlink it with menu.lst.
I stay away as far away from lvm as I can, which is a good thing given that I have absolutely no knowledge regarding how to set it up or what a valid gurb.conf/menu.lst configuration should look like. Someone more knowledgeable than I will have to help you decipher that one.
|
|
|
05-18-2012, 09:28 PM
|
#6
|
Senior Member
Registered: Jan 2011
Location: Australia
Distribution: openSUSE
Posts: 1,465
|
I've no knowledge on LVM or Grub.conf. I've Arch and Opensuse on my system plus a boot partition for chainloading that i set up, and all three run Grub Legacy, and none have a grub.conf to my knowledge.
Here's my tip:
In your first post, you stated it was a "/boot partition"
In your menu.list, are you setting root to the right place?
Quote:
title CentOS (3.2.6-0.choon.centos6.x86_64)
root (hd0,0)
|
That's pointing to /dev/sda1
I don't know the details behind your partitions, but that line needs to point to your root partition.
This could likely be your problem. Sometimes the simple things get overlooked.
|
|
|
05-18-2012, 09:46 PM
|
#7
|
LQ Newbie
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16
Original Poster
Rep:
|
Thank you very much for your advise I'll try it tomorrow because server is remote and I started it manually and it's running so I don't wanna screw it unless there's someone there to type in commands for me.
Thank you very very much.
|
|
|
05-18-2012, 10:52 PM
|
#8
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,316
|
Quote:
Originally Posted by Knightron
In your menu.list, are you setting root to the right place?
That's pointing to /dev/sda1
I don't know the details behind your partitions, but that line needs to point to your root partition.
|
Nope.
The root (hd?,?) is for the grub root directory.
The root=???? keyword on the kernel command is what points the kernel to your Linux root directory.
Totally separate concepts.
@dgonzalezh are you running under Xen or not ?. If you booted as per post #1, it doesn't look like Xen.
Perhaps go here, and let us see the RESULTS.txt so we can see what installed where.
|
|
|
05-18-2012, 11:19 PM
|
#9
|
LQ Newbie
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16
Original Poster
Rep:
|
Quote:
Originally Posted by syg00
Nope.
The root (hd?,?) is for the grub root directory.
The root=???? keyword on the kernel command is what points the kernel to your Linux root directory.
|
Totally separate concepts.
That's clear for me, fortunately I corrected some problems now I'll show you what I have did and the system boots into grub prompt and I can start he OS from there issuing
Code:
kernel /xen.gz
module /vmlinuz ro root=/dev/mapper/vgMaster-lvRoot
module /initrd.img
It starts fine but if it happens to reboot as it's been all day because of power failures there it stays at grub>_ prompt.
I did this, to try to recover
Code:
grub> find /grub/stage1
find /grub/stage1
(hd1,0)
grub> root (hd1,0)
root (hd1,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd1)
setup (hd1)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd1)"... 27 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd1) (hd1)1+27 p (hd1,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.
And the rest you can see at results.txt.
I even tried find /grub/grub.conf and it worked, found the file at (hd1,0)
Quote:
@dgonzalezh are you running under Xen or not?. If you booted as per post #1, it doesn't look like Xen.
|
Yes Sr. I'm running XEN 4.1.2 and this is a heavy duty server like 24 DomUs here, so a mission critical server.
Quote:
Perhaps go here, and let us see the RESULTS.txt so we can see what installed where.
|
Roger, on my way...
After looking at it I see that Grub is installed on both /sda and sdb and my grub stuff is located at sbd.
Here's some info that the script didn't get
OS: CentOS 6.2 x86_64
XEN: 4.1.3-rc2-pre
I see that everytjing looks like it's fine now, but as I said the server is miles away from me and as it's late now no one there to issue commands if I screw things up, but I guesss I'm a hair away from getting the server back to normal operation.
Thanks for your replies, that's why I use GNU/Linux, you're the best people.
|
|
|
05-18-2012, 11:55 PM
|
#10
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,316
|
Looks like the last bit you need is to do the setup to hd0, not hd1. The BIOS will (in all likelihood) be set to boot that.
|
|
|
05-19-2012, 12:05 AM
|
#11
|
LQ Newbie
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16
Original Poster
Rep:
|
Quote:
Originally Posted by syg00
Looks like the last bit you need is to do the setup to hd0, not hd1. The BIOS will (in all likelihood) be set to boot that.
|
Well, I tried that and no luck, I still don't reboot, but according to my research sda/hd0 is not the place where grub shuld be installed, I might be wrong.
Code:
[root@xen ~]# cat /boot/grub/device.map
# this device map was generated by anaconda
(hd0) /dev/sdb
(hd1) /dev/sda
[root@xen ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
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> setup (hd0)
setup (hd0)
Error 1: Invalid device requested
grub> root (hd0,0)
root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Error 15t: File not found
grub> map
map
Error 11t: Unrecognized device string
grub> root (hd1,0)
root (hd1,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd1)
setup (hd1)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd1)"... 27 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd1) (hd1)1+27 p (hd1,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.
grub> quit
quit
I don't want to reboot until I'm sure it won't be stuck at grub prompt.
Again apreciate your insight and help.
|
|
|
05-19-2012, 12:19 AM
|
#12
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,316
|
Quote:
grub> root (hd1,0)
root (hd1,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd1)
|
The "root (hd1,0)" has to stay - it identifies where the grub code is located. But the "setup (hd1)" needs to change to "setup (hd0)". This is what writes the MBR code, and it points back to whatever the "root ..." identified.
|
|
|
05-19-2012, 12:32 AM
|
#13
|
LQ Newbie
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16
Original Poster
Rep:
|
Quote:
Originally Posted by syg00
The "root (hd1,0)" has to stay - it identifies where the grub code is located. But the "setup (hd1)" needs to change to "setup (hd0)". This is what writes the MBR code, and it points back to whatever the "root ..." identified.
|
Ok, you're absolutely right, I did as you said and here's what I got.
Code:
grub> root (hd1,0)
root (hd1,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd1)
setup (hd1)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd1)"... 27 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd1) (hd1)1+27 p (hd1,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.
Would it be safe to reboot now?.
Thanks.
|
|
|
All times are GMT -5. The time now is 05:50 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|