I can't install grub and i can no longer access linux
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 can't install grub and i can no longer access linux
Okay,
here the story begins
I had 2 HDDs, one no.1, XP installed. On no.2, Linux installed with grub loader, so that i can use it to either boot into windows or linux.
When i removed one HDD, the other OS couldn't be launched. i.e. if i remove no.1, linux fails to load, if i remove no.2, XP fails to load.
So, it came to my mind to fix the mbr and partition table of no.1, so, i UNPLUGGED no.2 to securely deal with no.1 XP HDD. >>> SUCCEEDED AND I CAN LOG INTO XP BY SELECTING WHICH HDD TO BOOT FROM FROM THE BIOS WINDOW AT PC STARTUP.
Now, i re-plugged no.2 (whcih contained Linux), and unplugged no.1.
As i've expected, linux won't launch, it comes to this screen and stops>>>
Grub _ (blincking cursor).
Now, i'm trying to install grub via the rescue CD. I made tons of searches here and i've tried all this commands but unfortunately, they FAILED NOTE: what's between square brackets, is the response or the result of command execution >>>
sh-3.00# boot /dev/hdb (my boot partition is hdb1) [COMMAND not found]
sh-3.00# locate grub or find grub [couldn't find group slocate in the /etc/groupfile. Fatal error: this is a result of the group missing something, i can't remember]
sh-3.00# chroot /mnt/sysimage [WORKS]
grub> find /boot/grub/stage1 [not working, i can't remeber the message]
grub> grub-install /dev/hdb1 or hdb2 [both not working]
HOW CAN I INSTALL THIS PIECE OF GRUB CRAP AGAIN? I CAN'T ACCESS MY LINUX, PLEASE GIVE ME ANY CLUES
This tells grub to boot a file called vmlinuz which is stored in the first partition of your second hard drive, and to tell the kernel to start read-only and use hdb2 as the / partition. If you need clarification on any of the commands just ask. Remember that grub supports autocompletion via the Tab key, similarly to bash. If you aren't sure of the name of your kernel image file this might help you find it. If you can tell us what distro you're using (Fedora 4 from your profile?) and what your hard drive partition arrangement is we might be able to give more specific instructions.
This should allow you to get back into your Linux install. From there you might have more luck with grub-install.
Last edited by Gethyn; 06-20-2006 at 05:44 PM.
Reason: Original grub instructions were incorrect, now fixed
Fetch a grub package for your distribution, boot a liveCD or a resucue CD and install grub again. Then alter GRUB config file (usually menu.lst but in some cases grub.conf).
Edit:
Quote:
sh-3.00# boot /dev/hdb (my boot partition is hdb1) [COMMAND not found]
Well, there most definitely is not such command/program in a normal Linux installation such as "boot", that you could run from a normal shell, so this is not a surprise really. In Grub command prompt this might work, maybe, but not in a bash or so.
sh-3.00# locate grub or find grub [couldn't find group slocate in the /etc/groupfile. Fatal error: this is a result of the group missing something, i can't remember]
How come you don't have group slocate? well, if not, then create it: "groupadd slocate" and then edit /etc/group and add yourself in slocate. Do a "updatedb" and after that locate ought to work..find command might not work like "find grub", but try "find / -name grub" instead.
sh-3.00# chroot /mnt/sysimage [WORKS]
Well, this just chroots to /mnt/sysimage so /mnt/sysimage becomes virtually /
grub> find /boot/grub/stage1 [not working, i can't remeber the message]
Again, that syntax might not work. Find works like "find <where to start looking> -<option> <parameter>" so you might use this instead: "find / -name /boot/grub/stage1"
grub> grub-install /dev/hdb1 or hdb2 [both not working]
I'm not familiar with this command; are you intended to run it from a shell like bash, or from the grub command prompt?
I can't understand the >> root hd(1,0) <<
i tried it and it gave Error 11: Unrecognized device string
I'm using FC4,
My partition arrangement came after i typed in >> fdisk -l /dev/hdb >>>
/dev/hdb1 boot=* ID=83 System=linux
/dev/hdb2 ID=84 System=Linux Swap/Solaris
/dev/hdb3 ID=f System=W95 Ext'd (LBA)
/dev/hdb5 7 HPFS/NTFS
/dev/hdb6 C W95 FAT32 (LBA)
When i found it not working, i ignored it (forgive me, this might sound silly, but i'm not a linux hard user)
i tried the next command you wrote, it gave ERROR 12 (invalid device requested)
About your reply b0uncer , well, i don't understand a relatively large part of it , but i'm gonna try the modification of the commands .
About the grub-install commnand, i guess it should work, but it's not working
(where x is your primary drive if you want the bootloader on the mbr) from above it looks like you were selecting a partition, i believe you must give the disk device, not it's partition.)
Oops...sorry, I should have looked at my grub configuration file first, the instruction I gave you was wrong (fixed in previous post in case someone comes to it later on). Try this instead:
As I said before, 'vmlinuz' may not be quite the right name. For the second line, I suggest typing 'kernel /boot/vm<Tab> ro' (where <Tab> is the Tab key). This should hopefully find the right filename for you.
You said you didn't understand the root (hd1,0). (I know, I didn't type it correctly last time, sorry about that). It's telling grub what to use as the root directory/partition to find files. For reasons I don't know, grub uses a different convention to Linux. It counts from 0, the first number is the number of the drive, and the second number is the number of the partition. So (hd1,0) is the second drive, first partition. It should correspond to hdb1. Hope that makes more sense!
Once you get into Linux, try doing as ethics says, type (as root) 'grub-install hda' - assuming you want to put grub on the boot sector of your first drive.
Unfortunately, the problem is persistant. Yes, i found that you've written the first command wrongly, and this is actually not the problem , because i tried after searching the command with the correct parentheses position, BUT IT DIDN'T WORK EITHER. It tells me something like incorrect device, or device not found. Don't tell me you don't know what is your partition config. , because i've tried all possible things>>>hd1,0 hd0,1 hd0,0, hd1,1, etc.......
As for ethics, i've logged to the root prompt, till i reached your third code command, but it didn't work too, outputting the same error>>>device not found or something like this.
I'm sure i've been trying the commands with all possible combinations with correct typing.
Please give me further help. This is getting really deep
Just a thought: did you use LVM (logical volume management) when setting up your Fedora install? If so, you may well need to feed rather different commands to your grub to get it to boot. This is part of the reason that I avoid LVM.
Now here's an idea, don't know why I didn't think of this before. Can you boot into Windows, with both hard drives plugged in, as they were when you installed Fedora? If so, download a program called explore2fs. This will allow you to read files from your Fedora partition, assuming that you used the default ext3 filesystem. Find the /boot/grub/grub.conf file. This will contain the commands passed to grub at boot time. Try posting the contents of the file up here, and tell us how your drives were arranged at the time of installation.
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd1,1)
# kernel /boot/vmlinuz-version ro root=/dev/hdb2
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=1
timeout=5
splashimage=(hd1,1)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.11-1.1369_FC4)
root (hd1,1)
kernel /boot/vmlinuz-2.6.11-1.1369_FC4 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.11-1.1369_FC4.img
title Windows XP
rootnoverify (hd0,0)
chainloader +1
I hope this might help you.
At installation, i had my one HDD (containing XP) connected as MASTER while the 2nd HDD was connected as SLAVE (on which i installed FC4).
Okay, can you make a grub floppy? If you can, try plugging your hard drives back in as they were at install, and boot the computer from the floppy. When grub starts, try putting in
The fist bootable disk is known to Grub as (hd0) and has XP inside.
The second disk is known to Grub as (hd1) and FC resides in it.
Grub has been installed in the MBR and that is always the first bootable disk or (hd0).
Removing (hd1) will deny Grub the access of its configuration file and Grub will be unable to execute this statement and it must stop
Code:
splashimage=(hd1,1)/boot/grub/splash.xpm.gz
Removing (hd0) will not work either because the original (hd1) suddenly becomes (hd0) to Grub while the FC installed disk/partition references are all pointing to the second disk.
Both XP and Linux need the correct disk/partition reference to boot. Any attempt to change it will cause a mismatch. If it is desirable to alter the disk order this should be done once and then revise the disk/partition reference in Linux
/boot/grub/menu.lst and /etc/fstab
For XP it is more complicated and often necessitates a re-installation. However both Grub and Lilo can rearrange the disk order on-the-fly to avoid the re-installation.
Gethyn's suggestion will boot if the the (hd0) and (hd1) are present and the disk order has not been changed.
One can access any Linux with a Live CD. Grub can do everything other boot loader can do. The crap bit is usually user-related. Don't take my word for it. Take a look at the last link of my signature.
Guys, i love you . I damn love you. THANK YOU VEEEEEERY MUCH.
Status> MY GRUB + FC ARE BACK ONLINE.
As you said saikee , the GRUB floppy, isn't just a lethal weapon, it's ,, it's ,,, it's an EMP gun (one like that in ERASER )
I've used your LONG command Gethyn and it worked, but instead of just booting, i used this command (for anyone else who has a similar problem)>>>> setup (hd0) , noting that i've only plugged in my linux HDD so that i won't corrupt anything on the XP one (otherwise, my elder brother will KILL ME )
But i'm really happy.
But one more thing
It's been a looooong time since i last used my linux, so, i've forgotten my root password. I can't remember it by any means. I've squeezed my memory cells , but IN VAIN
Is there any way i could reset my root password. (in XP, hiren's boot CD has a utility to reset the Administrator == root (in linux) password), so, isn't there here any similar utility???
Last edited by Dark Templar; 06-22-2006 at 03:23 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.