grub dependencies

Nathan Coulson conathan at gmail.com
Sun Jun 19 22:31:52 PDT 2011


On Sun, Jun 19, 2011 at 7:43 PM, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:
> 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
> line:
>
>  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"
> ...
> 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.
>
> Thoughts?
>
>   -- Bruce

Personally, I have never used grub-mkconfig, but I am also familar
with how grub.cfg works (as well as menu.lst).

if grub does not find a .cfg file, it just gives you a grub prompt.

I do not recall too many support issues with the old static config
made by hand, and we can point to the manual for more advanced
configuration.  Having basic knowledge on what you'd need to type
manually to boot linux would also be a plus (set root=(); linux
/boot/vmlinuz root=/dev/sda1), in those cases where grub.cfg fails.

I don't think we should advise never to use grub-mkconfig, but instead
advise what is needed if one wishes to use it. (the root symlink,
vmlinuz names).  Just touch on it briefly, or even point towards a
hint.

on that note, how hard would it be to patch grub to not use /dev/root?


-- 
Nathan Coulson (conathan)
------
Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com



More information about the lfs-dev mailing list