LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 05-17-2012, 11:28 PM   #1
dgonzalezh
LQ Newbie
 
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16

Rep: Reputation: 0
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.
 
Old 05-18-2012, 01:07 PM   #2
ratotopi
Member
 
Registered: Dec 2011
Posts: 114

Rep: Reputation: 6
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.
 
Old 05-18-2012, 02:56 PM   #3
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
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 /.
 
Old 05-18-2012, 03:07 PM   #4
dgonzalezh
LQ Newbie
 
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by RockDoctor View Post
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.
 
Old 05-18-2012, 03:46 PM   #5
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
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.
 
Old 05-18-2012, 08:28 PM   #6
Knightron
Senior Member
 
Registered: Jan 2011
Location: Australia
Distribution: openSUSE
Posts: 1,465
Blog Entries: 6

Rep: Reputation: 200Reputation: 200Reputation: 200
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.
 
Old 05-18-2012, 08:46 PM   #7
dgonzalezh
LQ Newbie
 
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16

Original Poster
Rep: Reputation: 0
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.
 
Old 05-18-2012, 09:52 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by Knightron View Post
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.
 
Old 05-18-2012, 10:19 PM   #9
dgonzalezh
LQ Newbie
 
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
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.
Attached Files
File Type: txt results.txt (18.9 KB, 77 views)
 
Old 05-18-2012, 10:55 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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.
 
Old 05-18-2012, 11:05 PM   #11
dgonzalezh
LQ Newbie
 
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16

Original Poster
Rep: Reputation: 0
Thumbs up

Quote:
Originally Posted by syg00 View Post
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.
 
Old 05-18-2012, 11:19 PM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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.
 
Old 05-18-2012, 11:32 PM   #13
dgonzalezh
LQ Newbie
 
Registered: Jul 2010
Location: Colombia
Distribution: Debian, CentOS, Ubuntu, Fedora
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
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.
 
  


Reply

Tags
grub rescue



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I need to format grub entry to boot from grub2 into grub legacy? mitchell7man Linux - Software 6 04-03-2010 03:03 AM
Stuck on grub prompt on boot Turner27 Ubuntu 1 03-26-2007 07:22 PM
Fedora - Grub - Stuck at prompt itr1275 Linux - Newbie 16 01-10-2007 03:52 PM
unable to boot, stuck at LILO prompt hagabaka Slackware 10 05-31-2006 08:35 PM
RH 8.1, computer stuck at GRUB prompt, wont respond Sizam Linux - Software 4 08-25-2003 10:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration