[Newbie]GRUB issue - Linux

This is a discussion on [Newbie]GRUB issue - Linux ; Hi,
I had installed Fecora Core 3 and Windows XP on my laptop. GRUB was working
fine allowing me to boot into either.
However recently I re-installed XP and now the boot loader doesn't show up
(I don't get the ...

[Newbie]GRUB issue

Hi,

I had installed Fecora Core 3 and Windows XP on my laptop. GRUB was working
fine allowing me to boot into either.

However recently I re-installed XP and now the boot loader doesn't show up
(I don't get the menu that gives me the option to boot into XP or Ferdora).
I tried booting from the installation disk and re-installing only the boot
loader, but that didn't work. I also tried "linux rescue" which then went to
the shell - strangely there isn't a /boot/grub.conf .

I really can't seem to figure this out. It would be great if someone out
there could let me know what I should be doing. Thanks!

Re: GRUB issue

Well, are you sure your XP re-installation did not overwrite the whole
linux distro? try running fdisk to check what partitions eist.

Don't forget that when you run the rescue you end up with a mini-file
system in ram - you have to mount the hard disk (some rescue disks do
it for you) elsewhere

e.g.
mount /dev/hda3 /hardisk (assuming /hardisk exists)
then you would look in /hardisk/boot for grub.conf

Re: [Newbie]GRUB issue

DJP wrote:
>Hi,
>
>I had installed Fecora Core 3 and Windows XP on my laptop. GRUB was working
>fine allowing me to boot into either.
>
>However recently I re-installed XP and now the boot loader doesn't show up
>(I don't get the menu that gives me the option to boot into XP or Ferdora).
>I tried booting from the installation disk and re-installing only the boot
>loader, but that didn't work. I also tried "linux rescue" which then went to
>the shell - strangely there isn't a /boot/grub.conf .
>
>I really can't seem to figure this out. It would be great if someone out
>there could let me know what I should be doing. Thanks!
>
>
>
>
>
The booting process goes like this: load the very first sector of the
disk, called MBR - master boot record which contains the partition table
and the booting code. The booting code transfers control to the code
from the first sector of the active partition. Read here:http://www.pcguide.com/ref/hdd/file/structMBR-c.html.

Installing windows re-wrote your MBR and also changed your active
partition to wherever windows is installed. You have to reinstall grub,
thing for which you have 2 options:
a) install directly into MBR (= change your "default" booting code with
grub's)
b) change your active partition to the linux partition, then install
grub on the first sector of the linux partition (= keep "default"
booting code, but control is now further transferred to grub, not to the
windows loader)

Personally I prefer the second way, because if (when) I have to
reinstall Windows in the future, the next time it will be enough to
change the active partition, without reinstalling GRUB. Do the following:
- start with "linux rescue" option
- run "fdisk /dev/hda", type "p" (=print partitions), then "t"+number
of windows partition (toggle active flag => windows off), then
"t"+number of linux partition(toggle active flag => linux on), "w" =
write, "q" = quit. Please remember to check these commands in fdisk, I
wrote them from memory.
- chroot /dev/hdaX , where X is the number of the linux partition
(=change root directory from CD to hard disk). This is why in "linux
rescue" you didn't have any /boot/grub.conf - you were on the CD (or
virtual) filesystem, not on the hdd.
- grub install /dev/hda_number_of_linux_partition
- edit /boot/grub/menu.conf and check if your configuration is ok (it
should be if it used to work). For windows you should have an entry like
this:
title Windows
rootnoverify (hd0, windows_partition_number)
chainloader +1
In the grub.conf the "windows_partition_number" is numbered starting
from 0 not from 1, so it should be with one unit less than what fdisk
tells you (e.g. if fdisk says /dev/hda3 ==> grub partition hd0,2 )

If you want to install grub in MBR, skip the fdisk step above, and
call "grub-install /dev/hda" instead of "grub-install /dev/hdaX"

Re: GRUB issue

wrote in message
news:1110200461.993064.305290@l41g2000cwc.googlegr oups.com...
> Well, are you sure your XP re-installation did not overwrite the whole
> linux distro? try running fdisk to check what partitions eist.

No it hasn't overwritten it. XP has been installed to a different partition
and when I get the command prompt in the rescue mode I am able to see my
Linux files - so I think it is safe.
> Don't forget that when you run the rescue you end up with a mini-file
> system in ram - you have to mount the hard disk (some rescue disks do
> it for you) elsewhere
>
> e.g.
> mount /dev/hda3 /hardisk (assuming /hardisk exists)
> then you would look in /hardisk/boot for grub.conf

I was able to do an "ls" and saw the rest of the usual files and
directories(/usr, /dev, etc.) without doing the mount. Anyways I was just
looking for grub.conf as weak way of verifying that the boot loader was
installed. Even if I do find it I haven't a clue what I can do with it to
fix my problem. I just mentioned it in the post thinking that it may help in
diagnosing the problem.

Re: GRUB issue

DJP wrote:
> wrote in message
> news:1110200461.993064.305290@l41g2000cwc.googlegr oups.com...
>
>>Well, are you sure your XP re-installation did not overwrite the whole
>>linux distro? try running fdisk to check what partitions eist.
>
>
> No it hasn't overwritten it. XP has been installed to a different partition
> and when I get the command prompt in the rescue mode I am able to see my
> Linux files - so I think it is safe.
>
> > Don't forget that when you run the rescue you end up with a mini-file
>
>>system in ram - you have to mount the hard disk (some rescue disks do
>>it for you) elsewhere
>>
>>e.g.
>>mount /dev/hda3 /hardisk (assuming /hardisk exists)
>>then you would look in /hardisk/boot for grub.conf
>
>
> I was able to do an "ls" and saw the rest of the usual files and
> directories(/usr, /dev, etc.) without doing the mount. Anyways I was just
> looking for grub.conf as weak way of verifying that the boot loader was
> installed. Even if I do find it I haven't a clue what I can do with it to
> fix my problem. I just mentioned it in the post thinking that it may help in
> diagnosing the problem.
>
>
This is a well known problem. When you reinstall windows xp, it
overwrites the MBR. all you have to do is reinstall your grub in the mbr
use your fc3 disk, go in the rescue mode.
then you have to chroot as follows
$chroot /mnt/sysimage
then reinstall grub as follows
$grub
once inside grub
grub > root (hd0,7) if your boot partition is hda8 or
grub > setup (hd0) this will install grub in the MBR assuming you once
had a working grub.
all the best
jc

Re: [Newbie]GRUB issue

DJP wrote:
> However recently I re-installed XP and now the boot loader doesn't show up
> (I don't get the menu that gives me the option to boot into XP or Ferdora).
> I tried booting from the installation disk and re-installing only the boot
> loader, but that didn't work. I also tried "linux rescue" which then went to
> the shell - strangely there isn't a /boot/grub.conf .
>

Others have given excellent advice on how to restore your MBR.
I thought I'd just add that I believe grub.conf is in
/boot/grub/grub.conf (not just /boot/grub.conf) -- handy to know
when you want to change which OS is the default on a dual-boot
system. There's also a symbolic link in /etc/grub.conf.
This is one of those occasions when the "locate" command is your
friend.

-- Ron

Re: GRUB issue

> This is a well known problem. When you reinstall windows xp, it overwrites
> the MBR. all you have to do is reinstall your grub in the mbr
> use your fc3 disk, go in the rescue mode.
> then you have to chroot as follows
> $chroot /mnt/sysimage
> then reinstall grub as follows
> $grub
> once inside grub
> grub > root (hd0,7) if your boot partition is hda8 or
> grub > setup (hd0) this will install grub in the MBR assuming you once had
> a working grub.
> all the best
> jc

Alternatively use GAG, put this in your MBR. Using this you never have to
worry too much.

JCE

Re: GRUB issue

it can also be in /boot/grub/menu.lst

Re: GRUB issue

Folks, I need some help ASAP. I just did the following:

1.) Used the FC3 CD to boot using the linux rescue option
2.) Did "chroot /mnt/sysimage"
3.) Did "grub-install /dev/hda1"
(/dev/hda2 is my Windows partition, /dev/hda5 is my Linux partition and
/dev/hda1 is my boot partition - I think, I am not sure this makes any
sense - Newbie here)

After that I was able to boot into Fedora. But now GRUB doesn't allow
me to boot into XP. XP was set as the default OS to boot into - GRUB
doesn't boot into XP, it just keeps repeatedly showing the GRUB screen
asking me to choose which OS I want to boot into. Once I chose XP,
something like chainloader +1
GRUB loading stage2
is shown on screen and then it comes back to the GRUB screen.

I have some really important documents in my Windows partition and I am
seriously freaking out. It would be great if someone could help me out
with this. I also tried the edit command with XP selected in the GRUB
screen (I got two lines there which read:
rootnoverify(hd0,0)
chainloader +1)
- I don't know if this is of any help)

Re: GRUB issue

wrote in message
news:1110622963.871805.59030@l41g2000cwc.googlegro ups.com...
> Folks, I need some help ASAP. I just did the following:
>
> 1.) Used the FC3 CD to boot using the linux rescue option
> 2.) Did "chroot /mnt/sysimage"
> 3.) Did "grub-install /dev/hda1"
> (/dev/hda2 is my Windows partition, /dev/hda5 is my Linux partition and
> /dev/hda1 is my boot partition - I think, I am not sure this makes any
> sense - Newbie here)
>
> After that I was able to boot into Fedora. But now GRUB doesn't allow
> me to boot into XP. XP was set as the default OS to boot into - GRUB
> doesn't boot into XP, it just keeps repeatedly showing the GRUB screen
> asking me to choose which OS I want to boot into. Once I chose XP,
> something like chainloader +1
> GRUB loading stage2
> is shown on screen and then it comes back to the GRUB screen.

You should have typed "grub-install /dev/hda". What you did blew away the
Windows boot records on /dev/hda1, your Windows partition. You need to
restore that somehow.

Do you have a Windows installation CD that you can use to get to rescue mode
for Windows?
> I have some really important documents in my Windows partition and I am
> seriously freaking out. It would be great if someone could help me out
> with this. I also tried the edit command with XP selected in the GRUB
> screen (I got two lines there which read:
> rootnoverify(hd0,0)
> chainloader +1)
> - I don't know if this is of any help)

Ahh, this is much easier. You can grab the NTFS kernel modules, or recompile
them for your kernel, with the tools athttp://sourceforge.net/projects/linux-ntfs/. This will allow you to read
those files, although I don't recommend writing them from Linux, that kernel
support is pretty limited.

Re: GRUB issue

On Sat, 12 Mar 2005 02:22:43 -0800, domnicjp thoughtfully wrote:
> Folks, I need some help ASAP. I just did the following:
>
> 1.) Used the FC3 CD to boot using the linux rescue option 2.) Did "chroot
> /mnt/sysimage"
> 3.) Did "grub-install /dev/hda1"
> (/dev/hda2 is my Windows partition, /dev/hda5 is my Linux partition and
> /dev/hda1 is my boot partition - I think, I am not sure this makes any
> sense - Newbie here)
>
> After that I was able to boot into Fedora. But now GRUB doesn't allow me
> to boot into XP. XP was set as the default OS to boot into - GRUB doesn't
> boot into XP, it just keeps repeatedly showing the GRUB screen asking me
> to choose which OS I want to boot into. Once I chose XP, something like
> chainloader +1
> GRUB loading stage2
> is shown on screen and then it comes back to the GRUB screen.
>
> I have some really important documents in my Windows partition and I am
> seriously freaking out. It would be great if someone could help me out
> with this. I also tried the edit command with XP selected in the GRUB
> screen (I got two lines there which read: rootnoverify(hd0,0)
> chainloader +1)
> - I don't know if this is of any help)

I use NTFS RPMS to access my XP NTFS partitions from FC3
ttp://linux-ntfs.sourceforge.net/rpm/fedora3.html

Re: GRUB issue

Hi,

Please can you give me precise instructions as to what to do. I am new
to Linux and seem to have burnt my fingers over this. I have some
really important data on the Windows partition and I can't seem to get
at it. I downloaded the rpm package from the site you mentioned. I
double clicked on it and it says it installed the package, however I am
not sure how to use it. Am I supposed to build it on my machine? If so
how?

If not, where exactly has it been installed? 'Cuz I can't seem to see
it anywhere?

Also, how do I use it to get my data?

Any help would be GREATLY appreciated.

Re: GRUB issue

On Sat, 12 Mar 2005 21:53:21 -0800, domnicjp thoughtfully wrote:
> Hi,
>
> Please can you give me precise instructions as to what to do. I am new to
> Linux and seem to have burnt my fingers over this. I have some really
> important data on the Windows partition and I can't seem to get at it. I
> downloaded the rpm package from the site you mentioned. I double clicked
> on it and it says it installed the package, however I am not sure how to
> use it. Am I supposed to build it on my machine? If so how?
>
> If not, where exactly has it been installed? 'Cuz I can't seem to see it
> anywhere?
>
> Also, how do I use it to get my data?
>
> Any help would be GREATLY appreciated.

No offense but if you are asking how to install NTFS rpm there
is a link at the top of the rpm page to very detailed instructions.

Please can you guys advice on what I seem to be doing wrong - basically
I just need to get at the data in /dev/hda2. Any help will be GREATLY
appreciated. TIA.

Re: GRUB issue

domnicjp@gmail.com wrote:
> Thanks for your replies! I am sorry I didn't notice the instructions
> page - I am a bit frazzled at the thought of having all my data lost.
>
> Anyways I followed the instructions on the page and got the right
> package and did what was asked. However it doesn't seem to be working.
>
> Firstly when I do an fdisk, this is what I get:
>
> /sbin/fdisk -l
>
> Disk /dev/hda: 60.0 GB, 60011642880 bytes
> 255 heads, 63 sectors/track, 7296 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
> Device Boot Start End Blocks Id System
> /dev/hda1 * 1 5099 40957686 7 HPFS/NTFS
> /dev/hda2 5100 7295 17639370 f W95 Ext'd (LBA)
> /dev/hda5 5100 7295 17639338+ 83 Linux
>
> Now I am trying to get at /dev/hda2 which I see is W95 Ext'd(LBA), so
> am I doing something wrong by mounting it as NTFS?
>

Please note that an extended partition is a container
for partitions called logical disks. In Linux, the
logical disks are partitions from 5 onward. An extended
partition cannot contain directly a file system, and
it is not mountable as such.

In your case, the partition /dev/hda2 contains the
partition /dev/hda5. Have a look at the cylinder numbers.

As there are no other logical disks, the extended partition
is actually unnecessary in this case (DO NOT ATTEMPT
TO DELETE IT - you'll lose your Linux).

The idea of extended partitions got necessary as soon as
the disks grew so large that more than 4 partitions was
sensible. The primary partition table lies inside the
MBR (Master Boot Record), the very first block of the
whole disk. As it has to contain the initial bootstrap
code and the partition table, there is room for only
four partition descriptors. The scheme of four partitions
was designed for an IBM PC/XT with a 10 megabyte disk.

--

Tauno Voipio
tauno voipio (at) iki fi

Re: GRUB issue

Hi again,

I just realised that I made a mistake in posting my query earlier. I am
trying to get at the data in /dev/hda1, but I keep getting the
following error: