LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   WinXP deleted my Grub (https://www.linuxquestions.org/questions/linux-newbie-8/winxp-deleted-my-grub-306422/)

thesalmon83 03-26-2005 04:56 PM

WinXP deleted my Grub
 
I had to install Fedora first and WinXP after, and I figured it would prompt me before modifying my MBR. but it didn't...

I don't re-install my linux because it took me a long time to get it to work as well as it was working. How can I just reinstall Grub so that I can load it again?

visaris 03-26-2005 05:09 PM

Sure, if you can boot off a gentoo live cd:
Gentoo-Live-cd

Then mount all your linux partitions.
Code:

mount /dev/hda(x) /mnt/gentoo
mount /dev/hda(y) /mnt/gentoo/boot
mount -t proc none /mnt/gentoo/proc
swapon /dev/hda(z)
mount -t devfs none /mnt/gentoo/dev (edit: always do this!)

Where (x) is your root partition, (y) is your boot partition, and (z) is your swap partition.

Once this is done, you can chroot to /mnt/gentoo and run grub
Code:

chroot /mnt/gentoo /bin/bash
grub

Once you get to the grub prompt ("grub>"), just set it up like it was before. On my system, the setup is like so:
Code:

root (hd0,0)
setup(hd0)
quit

Then exit the chroot environment, unmount, and reboot with:
Code:

exit
swapoff /dev/hda(z)
umount /mnt/gentoo/proc
umount /mnt/gentoo/boot
umount /mnt/gentoo/dev (edit: always do this!)
umount /mnt/gentoo
reboot


thesalmon83 03-26-2005 05:12 PM

is there a way to do it with my Fedora DVD?

bulliver 03-26-2005 05:13 PM

Just for clarity, you don't have to use a gentoo livecd, you can use any live cd which has grub on it, which is pretty much all of them...

thesalmon83 03-26-2005 05:24 PM

visaris, the information you gave me seems to be useful, but I don't know what devfs or chroot is :-/

Also, the link you gave me is for a 600+ MB iso file, but I'm reading that there's a smaller (about 50MB) Gentoo LiveCD for Rescue, would it serve the same purpose? I don't want to wait 2 hours or get lost in other software that comes with the whole distribution...

bulliver 03-26-2005 05:33 PM

You don't need to know what chroot is at this point, just copy visaris's commands verbatim. If you do want to find out what chroot does then see the manpage, but basically it just changes the '/' directory to somewhere arbitrary, in this case your already installed linux system.

And yes the minimal live cd should work, although I cannot guarantee it has grub on it (but I am sure it does...).

If you still have fedora install disks you can use disk 1 to boot your system and reinstall grub from there...

type 'linux rescue' from the cdrom boot prompt

visaris 03-26-2005 05:37 PM

I'm a retard, there are a few changes I need to make to my directions. It doesn't matter if your distro uses devfs. All that matters is that gentoo does. Because you are booting off the gentoo cd, follow those directions _with_ the devfs parts.

chroot is a really neat command. What it does is pretend like your current linux environment no longer exists, and creates a new "sub-environment". The reason I tell you to use this is because you will boot up off the cd, and then once all your partitions are mounted right, you will "chroot" to your harddrive partition. This will create a new sub-environment that thinks it is running off of the harddrive instead of off the cd you just booted with. Once that has been done, any commands you type will be "running off" your harddrive. That way when you type "grub" and set up your boot loader again, it will be using all the same versions and executable files, etc that are included with your distro.

And yes, I think the minimal cd will work. It doesn't matter if the boot cd you use has grub; we will be using the grub that comes with _your_ distro. (chroot, remember?)

thesalmon83 03-26-2005 05:38 PM

I do have the Fedora installation disc, it's just one a DVD.
When I start from it, it asks me to format or upgrade my installation before it asks me to install grub.

How can I install grub from it only?


I'm now downloading the minimal version of Gentoo LiveCD and I'll try booting with it soon.

Nalorin 03-26-2005 05:47 PM

at the VERY first page (the black and red and blue one or whatever, where it tells you the options that you can use for the install instructions... it only stays like that for about 10-30 seconds, then automatically goes to the install gui for fedora.

so basically, if your computer is set to boot from cd:

1) turn on your computer with Fedora DVD in the drive...
2) AS SOON AS it loads the VERY First screen from off the dvd, type at the > "linux rescue" instead of "linux ide=nodma i8042.nomux etc.etc"
3) follow steps and bingo!


P.S. Thanks - it actually answered my question, which was the same :p!

thesalmon83 03-26-2005 06:10 PM

I booted with the Fedora Core DVD and typed "linux rescue", it went into Anaconda in rescue mode and told me that some file already exists and the whole system stoped and told me it was now ready to be turned off.

I'm having trouble getting Windows to recognize my CD burner in Nero for some reason, so I can't try the LiveCD.

Does anyone know a way around this?

thesalmon83 03-26-2005 06:13 PM

I remember a friend used to have a program on that loaded linux after clicking an icon on his desktop... does anyone know if this would help me? name of the program?

visaris 03-26-2005 06:35 PM

I've never done this, but it may work.

http://www.tprthai.net/bootmgr.htm

Once you do get your burner working in windows/linux, do yourself a favor and burn that gentoo linux cd. There is nothing better than a bootable linux cd that just dumps you to a command prompt without any bullsh!t.

michaelk 03-26-2005 07:28 PM

Using the install DVD boot to rescue mode.
The root partition should be mounted to /mnt/sysimage.

Enter the commands:

chroot /mnt/sysimage
grub-install

This should reinstall grub. You will not need to add an entry for XP to the /etc/ grub.conf file

title windows or dos partition 2
rootnoverify (hd0,1)
chainloader +1

Change hd0,1 to match where your xp partition ID.


All times are GMT -5. The time now is 07:53 PM.