LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 02-29-2004, 10:24 PM   #1
deviousdoses
LQ Newbie
 
Registered: Feb 2004
Posts: 18

Rep: Reputation: 0
Grub Nightmares..... Please help!


I've scoured the net and forums, and the traditional method of recovering without a boot loader is not working for me....

By this I mean, boot from the redhat 8 cd, go to rescue mode and chroot /mnt/sysimage...

When I hit linux-rescue, It doesn't find the partition... Grub used to work great for years, but after re-install windows xp it seems it rewrote the mbr and deleted my 8 megabyte /boot partition I was using for the grub loader.

Now I still have my two main linux partitions intact with the grub.conf file looking perfectly matched against an fdisk -l output, everything is there , except I no longer have the /boot partition grub was loading from...

I have successfuly mounted my root file system, but am unable to find "grub-install" or "grub" commands Anywhere? tried using find as well withut any help... I have all the grub config files and what not, but I am unable to run grub-install, as it seems I don't have it?

This is verry confusing as I installed grub almost 3 years ago with the distro Im using, so if I installed grub and have been using it for eyars, why can't I run "grub-install"?

Everywhere I read, it says to boot from redhat cd, type linux-rescue, and it will autmatically mount your linux partition under /mnt/sysimage, then to chroot to that directory and simply run "grub-install" and reboot....

I wish it was that simple, after I run linux-rescue, it runs through a clean linux install, unable to find the linux partitions? I am able to mount it manually from virtual console 2 and navigate through my existing redhat partition, but where the *#% is "grub-install" Am I loosing my mind or just overlooking something really simple???

I wish my floppy drive was working, then I could boot from my recovery disk right into my linux partition... but now I have no bootloader, or rather grub is gone, along with my /boot partition... I want it back!, but it's turned out to be an adventure.... everything is still there so why is this so difficult, again, where is "grub-install"???
 
Old 03-01-2004, 12:00 AM   #2
deviousdoses
LQ Newbie
 
Registered: Feb 2004
Posts: 18

Original Poster
Rep: Reputation: 0
finally found the "grub" and "grub-install

oK, "I've finally found the "grub" and "grub-install" commands, after manually mounting my main linux root partition as /mnt/redhat then under the /sbin dir I found the grub and grub-install commands

when I try to run grub nothing happens, then I forget Im a newbie, tried typying ./grub aha! i get a grub shell.... quit that, then typed ./grub-install
then it's expecting device name.... tried ./grub-install /dev/hd5 as that is where the rfs is.... nothing... also tried it on all mount points, and nothing is happeninng....

I should also mention first that when initially launching ./grub-install I got the error /sbin/grub command not found, and had to edit the grub-install file and put in /mnt/redhat in front of any paths like /usr or /sbin so that it would point to the proper directory... afer doing this, the command seems to run but I'm still getting no where.

Even after finally finding and running grub-install Im still having probs, maybe I shouldn't have edited the grub-install file, but then again until I did so I got errors, no nothing happens.... any ideas?
 
Old 03-01-2004, 02:09 AM   #3
basix
Member
 
Registered: Dec 2003
Distribution: Red Hat Linux 9, Fedora Core 1, *Fedora Core 2*
Posts: 74

Rep: Reputation: 15
Ok, I would like you to know that I am using LILO and not GRUB. Infact I dont have *any* experience with GRUB but I was put in a very similar situation a few weeks ago. So here I go...

The problem: I had to reinstall WinXP and it fscked up my MBR.
The solution: I used the linux bootable disk and logged in as root and ran /sbin/lilo to simply reinstall LILO

That was simple. But your problem is more complicated because you had a dedicated partition for the bootloader '/boot'. If that partition doesnt exist/is fscked up by WinXP then you will have to get some disk partition utility like disk druid or disk magic or something and make a new linux boot partition and then reinstall grub over there.

Also, it was a bad idea to actually edit your grub-install config files because when/if your system boots up those paths wont be existant and you might have problems in the future.

You could use the export $PATH="$PATH:/mnt/redhat/sbin" it tells the Linux OS to search for commands in the given path as well.

And dont pluck your hair out of worry! RedHat is resilient! We will get you through this =)

Last edited by basix; 03-01-2004 at 02:13 AM.
 
Old 03-01-2004, 03:59 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 9,915

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
Once your / is mounted to /mnt/redhat did you use the chroot command?
chroot /mnt/redhat

Then go back and unedit the grub-install file
 
Old 03-01-2004, 09:08 AM   #5
deviousdoses
LQ Newbie
 
Registered: Feb 2004
Posts: 18

Original Poster
Rep: Reputation: 0
grub nightmares...

I've tried to recreate my boot partition with disk druid, but since it's only 8 megs, start cylinder 1 the end cylinder for this partition was also 1, but when I try to create an 8 meg partition for /boot I get an error, cannot create partition, end cylinder must be greater than start cylinder... Argh!...

Again not a linux guru, so not to sure what ya'll mean by did you chroot when / was mounted, I'm geussing "/" means my rfs that I mounted under /mnt/redhat, if that's the case, yes I did chroot to that directory and still no luck....

Looks like I'm getting closer, but still no cigars!!

I am now at least able to manually boot into rescue mode and use virtual console 2 to manually mount my linux partition and locate the grub-install
commands, but I'm stumped...

What should the exact command by to re-install grub on my main hard drive? I have two drives, hdd and hda, with hda1 and hdd1 being the first partitions on these two drives, so is the command simply "grub-install /dev/hdd1" ? I have tried several variables of this like hdd or hda, with no luck...

Also the path command is evading me... how exactly does this command work? It reminds me of the alias command from my amiga shell days, seems like it makes another path to different directorys, so if I want to create a path to my /mnt/redhat partition what is the exact command?, hands are killing me from navigating through shell cd'ing to each directory to use a command...

Thanx again for the help, hopefully I can get grub back up and running again...
 
Old 03-01-2004, 12:55 PM   #6
postb99
LQ Newbie
 
Registered: Jul 2003
Location: France
Distribution: Ubuntu (current stable version)
Posts: 13

Rep: Reputation: 0
Hi,

deviousdoses, didn't you tell you lost the whole /boot partition ? So you would have lost your kernel files too... (vmlinu*).

Maybe you can try the following:
boot on rescue CD and get a shell, backup your home onto another partition : tar -jcvf /path/to/mybackup.bz2 /home, then reinstall your system. Setup should allow you to reuse existing partitions if you did so for /usr for example.

And next time, use lilo ;-)
 
Old 03-01-2004, 12:55 PM   #7
deviousdoses
LQ Newbie
 
Registered: Feb 2004
Posts: 18

Original Poster
Rep: Reputation: 0
Thumbs up Grub Nightmares almost over...

After days of agony, and alot of help from this forum, I am almost back up and runnig with Grub... :-)


David was right, it's 'linux rescue' not "linux-rescue", but either way, it still wouldn't find my linux partitions...

After staring at a shell for a few minutes I began to manually make dirs for my linux mount points, and manually mounted them, then chrooted to the rfs, edited back the "grub-install" to ommit the changes I made, then played with grub shell for time on end....

After what seemed forever of trying to master the grub shell commands and their syntax, I was finally able to figure out I had to find what hd0,x and hd1,x really translated to as far as /dev/hddx...

The syntax had me for a while as well, especially the brackets...finally figured it out with the help from someone on these threads, sorry can't remember your name. So I tried root (hd0,0) the (hd0,1) then (hd1,1) etc, etc....

Looks like root (hdx,x) verifies the partition, then the setup (hdx)
command install grub on that partition....

I got several errors runnning setup (hdx) the first few times, all the same.
Starts out looking for grub stage 1, stage 2 and some other goodies, complains that it can't find the items then, says grub installation failed...


finally afer trying several conbinations, I got it....

I did root (hd1,5), checking partition, linux ext2.
then setup (hd1), checking for stage 1, stage2, etc. found!
said some other good stuff too, probably would have been a good idea to write down, but I'm too lazy.....

Then it said grub installed succesfully!

Woohoo!!!!!!!!!!

The only prob now is that the /etc/grub.conf file was refering to (hd0,4) from before, I geuss that's where the old /boot partition was that is longer there anymore? so I changed it to (hd1,5) as that's where it found all the grub stuff....


Rebooted.....

Crossed my fingers, toes, polarity of the planet... lol


Grub finally pops up!... wohoo!!!!

Not only that, but all my entries are all there just lilke before, my two linux kernels, and my windows xp entry.... It boots into winxp like a champ...

It's all in black and white though. I miss the colour grub loader, it looks exactaly the same as far as setup, but I just miss the redhat logo and the nice sky blue it had....

Now for my last major problem....

It still wont boot any of the linux entries, gives error 15, file not found?!?!?!?!?!?!?!?!?!

I tried editing the entry by hitting "e" then trying to muck around with the "root (hd1,5)" and tried different combination then tried to boot again, only with the same error message....


I know after all this work I'm almost there, must be something easy now that I'm at this point... I just want it to boot my linux partitions again! I know there thereeee, and now that grub is finally installed this should hopefully be a simple resolution.

If you guys need anymore info just let me know and I'll try to provide it, as far as partition tables and config captures, soon as I figure out how to capture a cat output or screenshots of a terminal session....

Thanks for the help....
 
Old 03-01-2004, 01:02 PM   #8
deviousdoses
LQ Newbie
 
Registered: Feb 2004
Posts: 18

Original Poster
Rep: Reputation: 0
/boot partition

I thaught I installed grub on the /boot partition, but it seems like it was also installed on the rfd, as the vmlinz and other kernel files are all there. Plus the grub installer said it found it when I pointed it to (hd1,5), which I think is my original rfs.... Maybe I was wrong and the grub was installed on the first sector on the rfs partition? then again I have no idea what's really going on with all this....

If I re-installed windows xp, it re-wrote my mbr, that's why it booted windows directly, no more grub. But when I did "grub-install (hd1,5)" it installed grub on that partition, which is the second hard drive on my system and is not a primary or first partition? also my bios is being told to not even boot of that drive? wierd stuff, not sure how this grub thingy works, but after installing it again it now boots up right away?

I'm geussing then it must also re-write the MBR from hd0 to point to the grub loader on hd1,5, how else has this happend? anyways Thanx again guyz for all your help.... I'm sure I'll have it figured out anytime now with allyour help...


Thanks again for the help!
 
Old 03-01-2004, 03:13 PM   #9
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,067
Blog Entries: 4

Rep: Reputation: 385Reputation: 385Reputation: 385Reputation: 385
Since both of your threads refer to the same problem, I have merged them. In future, please respond to your own threads instead of starting a new one. This makes it easier for someone with the same problem to follow the fixes.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reinstalling grub. greythorne Ubuntu 23 12-03-2005 01:51 AM
GRUB not reinstalling jboo Linux - Software 5 10-02-2005 10:55 AM
reinstalling GRUB 0perat0r Linux - Newbie 7 05-02-2005 02:30 PM
Reinstalling grub darkangel29 Linux - Newbie 3 04-03-2005 05:53 PM
Reinstalling GRUB Petelow Linux - Newbie 1 05-24-2004 04:03 AM


All times are GMT -5. The time now is 11:46 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration