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

Re: Having Grub2 use UUID instead of (hd0,1)?



On Mon, Dec 28, 2009 at 05:40:52AM EST, Andrei Popescu wrote:
> On Fri,25.Dec.09, 16:19:13, Nate Bargmann wrote:
> > Is it possible to tell Grub2 to use the UUID of the partition
> > /boot/grub resides instead of its default (hd0,1) notation?  The reason
> > I ask is that I am using a custom kernel that treats all drives as sda,
> > but Debian's Grub2 pukes on it.  Specifically, installing and updating
> > Grub results in "/dev/sda" in /boot/grub.cfg and then boot fails as
> > grub evidently sees it as an IDE drive, which it is.  It seems as
> > though if Grub could use UUI internally as the kernel does, this issue
> > would be resolved.  So far my Googler has come up empty.
> 
> Hmm, didn't need to do anything special. The default config for grub2 in 
> squeeze and sid has this:
> 
> 
> ,----[ /etc/default/grub ]
> | # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
> | #GRUB_DISABLE_LINUX_UUID=true
> `----

But you still end up with an initial "set root=(hd0,1)" or such like at
the beginning of you grub.cfg stanzas. Which to me does not make sense,
since the ensuing "search" and "linux" statements refer to the UUID of
the partition, and are sufficient to find you kernel and boot it. 

And either the "search" or maybe the "linux" statement, if successful,
appear to point grub to the correct place, since it is also able to find
the initrd image.

I am able to boot a clone of my "lenny" system that lives on a USB stick
and I actually had to manually remove the "set root=" statement, because
it was confusing grub2 - namely a "set root=(hd1,1) .. or hd2, or hd3..
or sda, sdb, sdc.. always resulted in some message or other to the
effect that there was no such partition.

I'm not sure that's what the OP was asking for, though, because I'm
unclear as to how he could have a kernel that treats all drives as sda..

Sounds pretty risky to me.

The good news is that I read somewhere that the grub folks now have
dedicated someone to documenting the program ;-)

CJ



Reply to: