Computing.Net > Forums > Linux > Reinstall GRUB files??

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Reinstall GRUB files??

Reply to Message Icon

Name: El-Trucha
Date: November 21, 2004 at 05:38:04 Pacific
OS: Redhat Linux 9
CPU/Ram: 1.4 GHz/480 MB
Comment:

Hello every1!!
OK...I reinstalled WinXP on my first partition of my first HD...anmd it seems that GRUB was installed there, and now I cant choose which OS to boot!! :(
How do I reinstall GRUB without reinstalling Linux??
Thanx!! ;)

El-Trucha
http://www.masterleito.ath.cx
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx



Sponsored Link
Ads by Google

Response Number 1
Name: Guy
Date: November 21, 2004 at 07:07:26 Pacific
Reply:

Boot Linux from floppy boot disk (you do have one don't you?) or rescue CD, then:

/sbin/grub-install /dev/hda (for example)

Guy


0

Response Number 2
Name: HaTcH
Date: November 21, 2004 at 07:18:08 Pacific
Reply:

I've used Gentoo linux, so thats is how I'll approach it..

Slap the Live CD in the tray and boot from it. Theres a bunch of steps in the hand book (which is onlien that you have to follow to properly mount your boot partition and such. The steps the hand book said were liek this:

# mount /dev/hda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/hda1 /mnt/gentoo/boot
*or whatever your partitioning scheme is.

At this point you should be able to cd into boot and make sure theres a /grub directory, and files. If so, then lets keep going. If not, I forgot something.

Theres somethign in here you have to do to make sure the system knows where grub is, you could probably just mount the cdrom, export PKGDIR=/mnt/cdrom, and then run this, but I'm not 100% sure about that... But assuming you can, Re-emerge Grub (wont take too long)
# emerge grub
your grub.conf file should be fine...

# grub-install --root-directory=/boot /dev/hda
*be sure to change like /boot and /dev/hda. If you install to /dev/hda, it will write to the MBR and let you boot, which is what you want me thinks.

# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Unmount all your mounts and restart.

(I know that the grub steps here work, but its the getting to this point which is tough)

What we needed to do: When you reinstalled XP, it put its own boot loader onto the MBR of C:\. We need to put grub back. Thats where the install to /dev/hda comes in.

Hope this helps.


0

Response Number 3
Name: El-Trucha
Date: November 21, 2004 at 09:21:50 Pacific
Reply:

Umm...I cant access the boot folder in /mnt/hdb3!! :(
It just appears as if there were no files in there...and when I try to enter there from a shell...and try the "grub-install /mnt/hdb3" command, it says its a read only filesystem!!
I tried un-readonly-ing-it but it doesnt work!! :@
I cant delete files from anywhere in hdb3!! :(
What do I do now?? hdb3 is a Linux partition, not NTFS...
And why is the boot folder empty??
Thanx!! ;)

El-Trucha
http://www.masterleito.ath.cx
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx


0

Response Number 4
Name: egkenny
Date: November 21, 2004 at 10:27:33 Pacific
Reply:

El-Trucha why are you giving this command? "grub-install /mnt/hdb3"
I thought you wanted to restore the GRUB boot loader. The GRUB boot loader is usually installed on the Master Boot Record (MBR) of the first hard drive. In most cases this is /dev/hda. I have done this many times.

Here is how I would put the GRUB boot loader on the first drive:
1. boot with the first RedHat 9 CD
2. at the comamnd line type:
linux rescue
3. take the default for several more questions until you get the command line again
4. type the following command:
chroot /mnt/sysimage
5. restore the boot loader by typing:
grub-install /dev/hda

If you want to test your GRUB boot first without writing it to your hard drive you can write it to a floppy instead with the command:
grub-install /dev/fd0

After you know it works OK then you can write it to the hard drive.

If need to change the GRUB menu you must edit the GRUB configuration file. This file is called "/boot/grub/grub.conf"


0

Response Number 5
Name: El-Trucha
Date: November 21, 2004 at 13:16:56 Pacific
Reply:

Hmm...I did all the steps, but I ended up on a console that said "grub>"!!
What do I type in now??
I typed in "reboot", then it took me back to the regular console, and I typed in "reboot" again and it just rebooted, but to WinXP, not GRUB!! :(
What now??
Thanx!! ;)

El-Trucha
http://www.masterleito.ath.cx
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx


0

Related Posts

See More



Response Number 6
Name: Guy
Date: November 21, 2004 at 18:47:31 Pacific
Reply:

Please get close to a clean Linux boot as you can. Then give us the output of:

fdisk -l /dev/hda

fdisk -l /dev/hdb

cat /etc/fstab

cat /etc/mtab

df

-Guy



0

Response Number 7
Name: El-Trucha
Date: November 22, 2004 at 13:56:03 Pacific
Reply:

Well, I got this:


fdisk -l /dev/hda

Device B. Start End Blocks Id System
/dev/hda1 * 1 5169 39077608 7 HPFS/NTFS

fdisk -l /dev/hdb
Device B. Start End Blocks Id System
/dev/hdb1 * 1 3742 28289488+ 7 HPFS/NTFS
/dev/hdb2 3743 3756 105840 83 Linux
/dev/hdb3 3757 5039 9699480 83 Linux
/dev/hdb4 5040 5169 982800 f Win95
Ext'd (LBA)
/dev/hdb5 5040 5169 962800 Linux swap

cat /etc/fstab

cat: /etc/fstab: No such file or directory


cat /etc/mtab

rootfs /rootfs rw 0 0
/dev/root.old / ext2 rw 0 0
/proc /proc proc rw 0 0
/dev/pts /dev/pts devpts rw 0 0
none /tmp/ramfs ramfs rw 0 0
/proc/bus/usb /proc/bus/usb usbdevfs rw 0 0
/tmp/cdrom /mnt/source iso9660 ro 0 0
/tmp/loop0 /mnt/runtime cramfs ro 0 0
/dev/hdb3 /mnt/sysimage ext3 rw 0 0
/dev/hdb2 /mnt/sysimage/boot ext3 rw 0 0
none /mnt/sysimage/dev/pts devpts rw 0 0
none /mnt/sysimage/proc proc rw 0 0

df

Filesystem 1K-blocks Used Available Use%
rootfs 6120 3402 2368 59%
/dev/root.old 6120 3402 2368 59%
/tmp/cdrom 653440 653440 0 100%
/dev/hdb3 9546816 7409716 1652128 82%
/dev/hdb2 102486 15435 81759 16%


-Guy

sh: -Guy: Command not found


No, j/k...:P

Thanx!! ;)


El-Trucha
http://www.masterleito.ath.cx
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Reinstall GRUB files??

Edit Grub File With Mandrake www.computing.net/answers/linux/edit-grub-file-with-mandrake/24596.html

Booting RH9 from GRUB bootloader www.computing.net/answers/linux/booting-rh9-from-grub-bootloader/20549.html

grub problem www.computing.net/answers/linux/grub-problem/6811.html