grub dependencies

Bruce Dubbs bruce.dubbs at
Sun Jun 19 19:43:20 PDT 2011

Bryan Kadzban wrote:
> Bruce Dubbs wrote:
>> Another solution may be to do:
>>    cd /dev
>>    ln -sv <root partition> root
>> before running a program that needs grub-probe.
> Ew!  :-)
> /dev/root is *never* a real device, and anything that requires it to be
> is broken by design.  There were several long arguments about this on
> linux-hotplug a few years ago (somebody from Debian, I believe, wanted
> to make a /dev/root symlink from udev; it never happened).
> I *very* much prefer the patch in the thread you linked to: stop
> stat()ing devices that don't need it.

I tried making the changes in the grub thread, but it didn't work.
Creating a symlink in /dev did.   At least the instructions do not fail.

The problem is that in newer kernels, /proc/self/mountinfo provides the 

  13 1 8:15 / / rw,relatime - ext3 /dev/root ...

Now that's real helpful (not).

Creating a symlink is temporary because it will go away upon reboot.  I 
can see an argument for adding that to the bootscripts, eg,

   rootpartition = `mount|head -n1|cut -f1 -d" "`
   ln -s /dev/$rootpartition root

because several of the grub- commands will not work on an LFS system 
without it.  OTOH, I do not recommend using the grub- commands at all 
within LFS after the basic boot capability is set up.
The scripts in /etc/grub.d/ are quite complicated.  The also insist that 
the kernel names be in the form of

    /boot/vmlinuz-* /vmlinuz-* /boot/kernel-*

I like to name my kernels in the form of linux* so none were picked up.
I'm leaning towards just eliminating the use of grub-mkconfig other than 
for a warning not to use it.  We can just use a

cat  > /boot/grub/grub.cfg << "EOF"
If you already have GRUB2 loaded, upgrading is a bit trickier.  Running:

   grub-install --grub-setup=/bin/true /dev/sda

to an existing grub location (/boot/grub/ by default) will completely 
disable the ability to boot from the disk (including the grub command 
line) until you run:

   grub-setup /dev/sda

Perhaps we should not try to do the testing as currently described and 
just do:

   grub-install /dev/sda

instead.  That means that /boot/grub/grub.cfg better be right.  In any 
case I think that would allow the system to get to the grub command 
prompt even with a missing .cfg file.


   -- Bruce

More information about the lfs-dev mailing list