Linux - GeneralThis 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
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.
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"???
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?
Distribution: Red Hat Linux 9, Fedora Core 1, *Fedora Core 2*
Posts: 74
Rep:
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 =)
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...
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.
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....
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...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.