Gentoo Archives: gentoo-user

From: Adam Carter <adamcarter3@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Using UUID for root disk in grub requires initramfs?
Date: Fri, 19 Jul 2019 10:58:53
Message-Id: CAC=wYCG3DC7y+2XXprL9tzdZFkfO0ABa_qAVL07STwwqmyFeAQ@mail.gmail.com
In Reply to: Re: [gentoo-user] Using UUID for root disk in grub requires initramfs? by Mick
1 On Fri, Jul 19, 2019 at 8:27 PM Mick <michaelkintzios@×××××.com> wrote:
2
3 > On Friday, 19 July 2019 10:29:09 BST Adam Carter wrote:
4 > > This
5 > > https://wiki.gentoo.org/wiki/GRUB2/Configuration_variables
6 > >
7 > > has
8 > >
9 > > GRUB_DISABLE_LINUX_UUID false If true, ${GRUB_DEVICE} is passed in the
10 > root
11 > > parameter on the kernel command line.
12 > >
13 > > If false, ${GRUB_DEVICE_UUID} is passed in the root parameter on the
14 > kernel
15 > > command line when an initramfs is available.
16 > >
17 > > So it looks like i can't set root= to a UUID unless i use an initramfs -
18 > > can anyone confirm?
19 >
20 > This would be correct if GRUB (with/out initramfs) happened to be the only
21 > way
22 > to configure Linux. Thankfully we have more choices, in Gentoo at least.
23 > ;-)
24 >
25 >
26 > > In /usr/src/linux/admin-guide/kernel-parameters.txt it has;
27 > > root= [KNL] Root filesystem
28 > > See name_to_dev_t comment in init/do_mounts.c.
29 > >
30 > > And in do_mounts.c it mentions PARTUUID= and PARTLABEL= but i dont know C
31 > > so don't know what to make of it.
32 > >
33 > > Background is that after adding a new disk the system doesn't boot, so
34 > i'm
35 > > assuming that the /dev/sdX device names are now pointing to different
36 > > hardware, so i want to fix that by using persistent names.
37 >
38 > You could use UUID, or partition label (if GPT is used on the disk), but
39 > by-
40 > pass GRUB's facility to configure the UUID and use the kernel .config
41 > itself.
42 > For this you will have to configure and compile your own kernel. Use this
43 > kernel option to specify kernel command line options:
44
45
46 I experimented found the following worked in /etc/default/grub;
47
48 GRUB_DEVICE="PARTUUID=d3554d49-02"
49
50 Which writes grub.cfg as;
51 linux /vmlinuz-5.2.0-gentoo root=PARTUUID=d3554d49-02 ro
52 init=/usr/lib/systemd/systemd iommu=pt raid=noautodetect
53
54 PARTUUID looked up with blkid. No initramfs required :)

Replies

Subject Author
[gentoo-user] Re: Using UUID for root disk in grub requires initramfs? Ian Zimmerman <itz@××××××××××××.org>