Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Where's my GRUB?

Question posted by: ambrnewlearner (Expert) on June 26th, 2008 08:47 AM
Well,
I installed Red hat linux a few days ago and recently I tried to repair my XP installation on same machine. It displayed the following message when I expected it to repair my XP-"Setup is performing requested operations on your hard disk" or something similar (I don't actually remember the message displayed). But instead of repairing XP it did something unexpected. My GRUB boot loader got lost into nowhere.

When I tried booting with DamnSmallLinux LiveCD and searched for older Linux parttions on my PC, then I found that both Linux and Linux Swap partitions are fine and all files are in order. I have set of Redhat bootable CD's .

I want to bring GRUB back so that I can boot into Redhat linux installed on my PC.

Hope I have given enough information and if you expert need more information, tell me so that I can provide them to you.

THANKS in advance..............

============
AmbrNewlearner
============
micmast's Avatar
micmast
Member
71 Posts
June 26th, 2008
11:37 AM
#2

Re: Where's my GRUB?
You gave enough info, you could have also said I tried to repair XP after installing any linux distro...

Microsoft doesn't care that you have grub/lilo or any other bootloader installed and will simply remove it and install the windows bootloader. There are a few solutions to solve this problem.

The first is use the SuperGrub Boot Disk: http://www.supergrubdisk.org/

Another option, but a bit more difficult, is using a liveCD (I would say ubuntu or something, or maybe even fedora/redhat, but I haven't tried those). When you use a liveCD you have to follow the following steps:
(I assume everything below is done as root in a terminal)

1. mount your linux partition; for example: mount /dev/sda2 /mnt/sda2
2. Mount /dev, /proc and /sys to the correct directories of your original system
mount --bind /dev /mnt/sda2/dev
mount --bind /proc /mnt/sda2/proc
mount --bind /sys /mnt/sda2/sys

3. The next step is going back to your orginal machine.
chroot /mnt/sda2

Now everything you do, will be applied to the linux version on your sda2 device instead of on the CDROM.

4. Reinstall grub
grub-install

5. If you want to leave the chroot environment, you have to do the following steps:

umount /proc (Not 100% sure this is required)
CTRL+D (The keycombination)
umount /mnt/sda2/dev
umount /mnt/sda2/proc
umount /mnt/sda2/sys

That should reinstall the grub on your MBR. But the supergrubdisk is a lot quicker & easier :D

Hope this helps

Reply
ambrnewlearner's Avatar
ambrnewlearner
Expert
457 Posts
June 27th, 2008
09:48 AM
#3

Re: Where's my GRUB?
THANKS micmast......I will try as you advised me to do and then I will reply back with the result.

============
AmbrNewlearner
============

Reply
ambrnewlearner's Avatar
ambrnewlearner
Expert
457 Posts
July 4th, 2008
08:21 AM
#4

Re: Where's my GRUB?
Quote:
You gave enough info, you could have also said I tried to repair XP after installing any linux distro...

Microsoft doesn't care that you have grub/lilo or any other bootloader installed and will simply remove it and install the windows bootloader. There are a few solutions to solve this problem.

The first is use the SuperGrub Boot Disk: http://www.supergrubdisk.org/

Another option, but a bit more difficult, is using a liveCD (I would say ubuntu or something, or maybe even fedora/redhat, but I haven't tried those). When you use a liveCD you have to follow the following steps:
(I assume everything below is done as root in a terminal)

1. mount your linux partition; for example: mount /dev/sda2 /mnt/sda2
2. Mount /dev, /proc and /sys to the correct directories of your original system
mount --bind /dev /mnt/sda2/dev
mount --bind /proc /mnt/sda2/proc
mount --bind /sys /mnt/sda2/sys

3. The next step is going back to your orginal machine.
chroot /mnt/sda2

Now everything you do, will be applied to the linux version on your sda2 device instead of on the CDROM.

4. Reinstall grub
grub-install

5. If you want to leave the chroot environment, you have to do the following steps:

umount /proc (Not 100% sure this is required)
CTRL+D (The keycombination)
umount /mnt/sda2/dev
umount /mnt/sda2/proc
umount /mnt/sda2/sys

That should reinstall the grub on your MBR. But the supergrubdisk is a lot quicker & easier :D

Hope this helps

Instead of going with supergrubdisk, I tried manual recovery of GRUB as you advised.
I booted into damn small linux live cd and then I did as you advised. Everything went fine till following command.
chroot /mnt/hdd2

When I executed above command, I got on to bash of my hdd2 partitions linux.
Then I entered following at the terminal--->
grub-install

But I get a error- "Format of install_device not recognised". I tried various combinations for install_device but couldnot find the appropriate one. So what should I do now.

THANKS for your help....

Reply
micmast's Avatar
micmast
Member
71 Posts
July 4th, 2008
09:35 AM
#5

Re: Where's my GRUB?
o sorry, I made a small error
it should be: grub-install /dev/<your harddrive>

That should install it.

Reply
ambrnewlearner's Avatar
ambrnewlearner
Expert
457 Posts
July 4th, 2008
04:11 PM
#6

Re: Where's my GRUB?
Quote:
o sorry, I made a small error
it should be: grub-install /dev/<your harddrive>

That should install it.

Hello,
I did as you advised but still GRUB doesnot comes up.......
_______________
grub-install /dev/hdd5

I have enclosed below a screenshot of terminal when I executed the commands at Damn Small Linux terminal. (point your mouse pointer over the image so that you can view the enlarged and original image).




It says- "installation finished-No errors reported". But my GRUB sill don't appear when I boot my PC i.e. IBM/Windows bootloader is still the defaullt bootloader.

What is wrong now.
THANKS for your help in advance.........

Reply
ambrnewlearner's Avatar
ambrnewlearner
Expert
457 Posts
July 5th, 2008
03:31 PM
#7

Re: Where's my GRUB?
SUCCESS.......
problem solved. I made a mistake. I typed

grub-install /dev/hdd5
instead of

grub-install /dev/hdd.

THANKS for help...........

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,891 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Linux / Unix / BSD Forum Contributors