LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I recreate a working grub.conf ??? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-recreate-a-working-grub-conf-518561/)

morgandavis 01-12-2007 12:47 AM

How do I recreate a working grub.conf ???
 
I'm running RHEL4 - breaking grub.conf - so I can learn how to fix it.

I was told to purposely break Linux to learn about it. I want to learn about grub.conf and what happens when I corrupt it purposely. So I vi'd it and changed root to DAVE.

Obviously the system does not boot - but here is my question.

If/when it gets corrupted, how do you guys recreate it?
at the prompt grub> I looked at help and it did not clue me in.

Some article I found discussed reinstalling it with
/sbin/grub-install /dev/hda or (boot device)
But this does not work for me at the grub> prompt.

Here is what I am doing -
So when I reboot and I interrupt the boot process at STAGE2 I open the grub> command prompt and type:
/sbin/grub-install (hd0,0) -- returns unrecognized command.

no luck.
So I try tip #2 at the grub> prompt typing:
root(hd0,0)
setup (hd0)
quit - unrecognized command.

At this point I'm feeling like a tool and I decided that maybe I need to reboot with a CD and run - linux rescue :scratch:
That didn't work either.

THE BIG QUESTION - :Pengy:
How EXACTLY do I get to the prompt at which running the command
/sbin/grub-install --- will actually work?

--REMEMBER YOU HAVE TO RUN TO 1ST BEFORE YOU RUN TO HOME PLATE--

pljvaldez 01-12-2007 01:02 AM

Generally you have to boot with a linux live CD or use your CD to boot into rescue mode. You'll get to a bash terminal w/ rescue mode, not a grub> prompt. With a liveCD, you'll of course be able to open a terminal.

If you want to learn a lot about grub, do the things in this post. You'll be able to use the grub prompt to boot anything (and thus repair your existing grub).

I would not necessarily say you have to break linux to learn it. I prefer to read through config files (always making a backup first) and then do some subtle changes until I understand what I'm doing. Then as I get the hang of it, try something more bold...

Or if you really want to learn linux, they say to use Slackware. Everything is mucking through config files to get it working. No gui helpers at all...

mblames 01-12-2007 03:13 AM

Yep just enter the liveCD u have, and choose rescue option
Mount the RH partition,
#mount -t <file-system> /dev/sd~ /mnt/<wateva_the_dir>
then u need to chroot-ing the mounted RH dir
#chroot /mnt/wateva
and then u need a lil fdisk
#fdisk -l
see for the last time that your RH partition (I assume /dev/sda1)
edit the menu.lst or grub.conf
#vi /etc/grub/menu.lst
and then re-install the grub
#/sbin/grub-install /dev/sda1
then reboot and a lil pray


Regards


All times are GMT -5. The time now is 04:20 PM.