On Fri, Jul 19, 2019 at 8:27 PM Mick <[email protected]> wrote:

> On Friday, 19 July 2019 10:29:09 BST Adam Carter wrote:
> > This
> > https://wiki.gentoo.org/wiki/GRUB2/Configuration_variables
> >
> > has
> >
> > GRUB_DISABLE_LINUX_UUID false If true, ${GRUB_DEVICE} is passed in the
> root
> > parameter on the kernel command line.
> >
> > If false, ${GRUB_DEVICE_UUID} is passed in the root parameter on the
> kernel
> > command line when an initramfs is available.
> >
> > So it looks like i can't set root= to a UUID unless i use an initramfs -
> > can anyone confirm?
>
> This would be correct if GRUB (with/out initramfs) happened to be the only
> way
> to configure Linux.  Thankfully we have more choices, in Gentoo at least.
> ;-)
>
>
> > In /usr/src/linux/admin-guide/kernel-parameters.txt it has;
> > root=           [KNL] Root filesystem
> >                         See name_to_dev_t comment in init/do_mounts.c.
> >
> > And in do_mounts.c it mentions PARTUUID= and PARTLABEL= but i dont know C
> > so don't know what to make of it.
> >
> > Background is that after adding a new disk the system doesn't boot, so
> i'm
> > assuming that the /dev/sdX device names are now pointing to different
> > hardware, so i want to fix that by using persistent names.
>
> You could use UUID, or partition label (if GPT is used on the disk), but
> by-
> pass GRUB's facility to configure the UUID and use the kernel .config
> itself.
> For this you will have to configure and compile your own kernel.  Use this
> kernel option to specify kernel command line options:


I experimented found the following worked in /etc/default/grub;

GRUB_DEVICE="PARTUUID=d3554d49-02"

Which writes grub.cfg as;
linux /vmlinuz-5.2.0-gentoo root=PARTUUID=d3554d49-02 ro
init=/usr/lib/systemd/systemd iommu=pt raid=noautodetect

PARTUUID looked up with blkid. No initramfs required :)

Reply via email to