User:Pietinger/Tutorials/Confusion with root=PARTUUID= and root=UUID=

From Gentoo Wiki
Jump to:navigation Jump to:search

You probably already know that you can have a kernel with an associated INITRAMFS, or a manually configured one without an INITRAMFS. For example, our DIST kernels or a kernel created with genkernel have an associated initramfs. Why does a distinction have to be made ?

Perhaps you are also familiar with the fact that a kernel only mounts the root partition itself if NO initramfs is present. As soon as the kernel has an initramfs, it no longer does this and leaves the mounting of the root partition to the init-script of the initramfs.

So one of these two has to mount the root partition and therefore needs the information where (which) the root partition is ! This is always done with the kernel command line parameter root=

Now it depends on WHO mounts the root partition:

1. If it is the kernel itself, then the following applies:

You can give the kernel a root=/dev/sdXY or root=/dev/nvmeXnYpZ or a root=PARTUUID=... but the kernel does NOT understand root=UUID=... !

2. If it is the initramfs, it is a little bit more complicated, because:

It depends on which method the init-script of the initramfs uses to mount the root partition.

a) IF the init-script starts the external "MOUNT" command, then this external "mount" understands everything (see "man mount") - i.e. a root=PARTUUID= as well as a root=UUID= (and of course a normal root=dev/...).

b) Many initramfs work with busybox. And busybox has a built-in "MOUNT" command ... This built-in mount understands ONLY root=UUID (and of course also root=/dev/...) but NOT root=PARTUUID= !! (I hate the developers of busybox for this).

Because many initramfs now use busybox, many boot managers believe that using root=UUID= is the safest way to tell the initramfs where to find the root partition.

Our grub-mkconfig is even a bit more intelligent: Depending on whether it finds an initramfs or not, it changes the kernel command line parameter root=

So if the grub-mkconfig finds an initramfs it configures the grub so that grub later passes a root=UUID= to the kernel.


But what happens if someone configures a kernel manually (and does not actually need an initramfs), but has nevertheless created an initramfs with dracut in addition? What will grub-mkconfig do if it finds an initramfs ?

You can read about this in this forum post: https://forums.gentoo.org/viewtopic-t-1166054.html

Yes, grub-mkconfig configures the grub so that grub passes a root=UUID= to the kernel, which unfortunately does not understand this and therefore gives a kernel panic.