help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dual grub install?


From: Jake Thomas
Subject: Re: dual grub install?
Date: Mon, 4 Jun 2012 13:17:55 -0700 (PDT)

Hi Hugo!

    It certainly appears that you have two partitions each with a VBR 
bootloader that boots Windows. Since the Linux installer does not install 
Windows bootloaders, I would guess that you already had the second 
Windows-booting partition before you installed Linux. Maybe you had a recovery 
partition that could boot Windows? Or some backup bootloader partition? Or two 
installations of Windows? There is the possibility that both boot entries boot 
the same partition, which I will explain below, but that would imply that the 
thing that generated grub.cfg made a mistake, which I kinda doubt.


    Can you check to see if Grub really is booting two different partitions? 
I'll explain how to do this.


    Do either of the boot entries yeild an error and then keep booting? Like a 
"no such device blah blah blah" or "could not find device blah blah blah"?


     Your boot entries are redundant when it comes to setting the root. First 
they set the root according to hd# and partitition#, and then they go on and 
set the root partition by UUID. You only need to set the root once, though the 
redundancy can be a good thing should one fail.


    The hd# of a hard drive can change from boot to boot. Ultimately the hd# of 
each hard drive is determined by the firmware. Things that can cause change are 
unplugging and/or adding drives, which drive you boot off of, and other 
factors. This is why UUID is prefered. Simply give each partition its own 
unique identifier (randomly generated and put in for you when you format the 
partition, unless you specify a UUID), and specify by that. The UUID is a part 
of the filesystem. So given that the partition has a filesystem, it has a UUID, 
provided the filesystem has a spot for the UUID to go. I don't know whether 
Grub has to understand the filesystem or not to be able to read the UUID. In a 
normal world, each partition only has one UUID. It might be technically 
possible for a paritition to have more than one UUID if it simultaneously has 
more than one filesystem, but no one I know of has a serious reason to do so.


    Anyways, assuming your partitions have one and only one UUID, perhaps the 
first partition has a UUID of 76B2A189B2A14F05, and the second partition does 
not have a UUID of CE769EA1769E89BB, or the second paritition has a UUID of 
CE769EA1769E89BB and the first partition does not have a UUID of 
76B2A189B2A14F05. In either of those two cases, Grub would boot the same thing 
from each entry.



  Watch this:

Let's say the first partition has a UUID of 76B2A189B2A14F05, and Grub runs the 
following:

set root='(hd0,msdos2)'

#Ok, now the root is the second partition

search --no-floppy --fs-uuid --set=root 76B2A189B2A14F05

#Ok, now the root is the first partition

chainloader +1

#booting root partition, partition #1



Ok, let's still say that the first partition has a UUID of 76B2A189B2A14F05, 
but you choose the first entry:


set root='(hd0,msdos1)'

#Ok, now the root is the first partition

search --no-floppy --fs-uuid --set=root CE769EA1769E89BB

#Root is still the first partition because no device with a UUID of 
CE769EA1769E89BB exists.
#An error should be printed to the screen now.

chainloader +1

#booting root partition, partition #1



In the above scenerio, both entries boot the same partition, but one prints an 
error and one doesn't. 






We can reverse this to still boot the same partition, but flipped:




Let's say the second partition has a UUID of CE769EA1769E89BB, and Grub runs 
the following:

set root='(hd0,msdos1)'

#Ok, now the root is the first partition

search --no-floppy --fs-uuid --set=root CE769EA1769E89BB

#Ok, now the root is the second partition

chainloader + 1

#booting root partition, partition #2


Ok, let's still say that the second partition has a UUID of CE769EA1769E89BB, 
but you choose the second entry:


set root='(hd0,msdos2)'

#Ok, now the root is the second parition

search --no-floppy --fs-uuid --set=root 76B2A189B2A14F05

#Root is still the second partition because no device with a UUID of 
76B2A189B2A14F05 exists.
#An error should be printed to the screen now.

chainloader +1

#booting root partition, partition #2


In the above scenerio, both entries boot the same partition, but one prints an 
error and one doesn't.



You can check the UUIDs of the first partition and the second partition by 
booting into Linux and using blkid, like
the following:

sudo blkid /dev/sda1

and

sudo blkid /dev/sda2

Replace "/dev/sdaX" with whatever you need to replace it with to point at the 
right drive. For example, it could be sdb
or sdc. Or it might be hda or hdb or whatever instead of sda or sdb or whatever.

If partition #1 has a UUID of CE769EA1769E89BB and partition #2 has a UUID of 
76B2A189B2A14F05, and Grub does not print
an error when booting either, you can be pretty sure that you really do have 
two partitions that boot Windows, as far
as I know. This would be weird as well, because you'd think that the thing that 
generates grub.cfg would have caught
that there were two last time, which it didn't.

Cheers,
Jake




reply via email to

[Prev in Thread] Current Thread [Next in Thread]