On Wed, Feb 15, 2017 at 5:58 AM, marco restelli <mreste...@gmail.com> wrote:
>
>> The short version is that the kernel is very limited in what it can
>> take in the root= option on the command line, and grub and other
>> bootloaders don't do anything to ID the root filesystem other than
>> passing whatever root= parameter you specify (I'd be interested in any
>> info to the contrary).
>
> I have always generated grub.cfg files with grub-mkconfig. In some
> cases I see here
>
> search --no-floppy --fs-uuid --set=root <disk-UUID>
> linux   /kernel-XYZ root=/dev/sda4 ro
>
> As far as I understand it, the first line searches the partition where
> the kernel is located identifying it through the UUID. Then the second
> line loads the kernel passing /dev/sda4 as the system root.
>
> On the bootable USB stick, with an initramfs, however I have
>
> search --no-floppy --fs-uuid --set=root <disk-UUID>
> linux   /kernel-XYZ root=UUID=<another-disk-UUID> ro
>
> so now also the root filesystem is identified by its UUID.

Correct.  Just note that "root" in GRUB lingo is the filesystem that
contains all the grub binaries, the kernels, and so on.  That is
typically /boot on a linux system.  Unless they happen to be the same
filesystem it isn't the same root you pass to the kernel.  If it were
then you would have the same UUID in the second example.

>
>> Anytime you see something like root=UUID=* that is being handled by an
>> initramfs.
>
> I understand that this parameter is passed by the kernel to the init
> script inside the initramfs which then uses "busybox findfs" to
> translate the UUID into a device name. Is this correct?
>

I suppose that is one way it could be done, but of course it could be
implemented in other ways.  As far as I can tell Dracut does not use
busybox findfs.  I didn't do a careful read but a quick look at the
source suggests that it is actually using udev and referencing
/dev/disk/by-uuid and so on.  I suspect the logic is that if udev
could find the root device on the host when the initramfs was being
built, then it should be able to find it in the initramfs if the same
software is used to do it.

-- 
Rich

Reply via email to