* [gentoo-user] Using UUID for root disk in grub requires initramfs?
@ 2019-07-19 9:29 Adam Carter
2019-07-19 10:27 ` Mick
0 siblings, 1 reply; 6+ messages in thread
From: Adam Carter @ 2019-07-19 9:29 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 884 bytes --]
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?
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.
[-- Attachment #2: Type: text/html, Size: 1600 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] Using UUID for root disk in grub requires initramfs?
2019-07-19 9:29 [gentoo-user] Using UUID for root disk in grub requires initramfs? Adam Carter
@ 2019-07-19 10:27 ` Mick
2019-07-19 10:58 ` Adam Carter
0 siblings, 1 reply; 6+ messages in thread
From: Mick @ 2019-07-19 10:27 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1680 bytes --]
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:
Processor type and features -->
...
[*] Built-in kernel command line
(root=PARTUUID=XXXXXXXXXXXXXXXXXXXXXXXXX other_options_here)
As long as you use 'make oldconfig' for subsequent kernels the UUID will be
retained.
--
Regards,
Mick
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] Using UUID for root disk in grub requires initramfs?
2019-07-19 10:27 ` Mick
@ 2019-07-19 10:58 ` Adam Carter
2019-07-19 16:37 ` [gentoo-user] " Ian Zimmerman
0 siblings, 1 reply; 6+ messages in thread
From: Adam Carter @ 2019-07-19 10:58 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]
On Fri, Jul 19, 2019 at 8:27 PM Mick <michaelkintzios@gmail.com> 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 :)
[-- Attachment #2: Type: text/html, Size: 2640 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-user] Re: Using UUID for root disk in grub requires initramfs?
2019-07-19 10:58 ` Adam Carter
@ 2019-07-19 16:37 ` Ian Zimmerman
2019-07-19 16:59 ` Mike Gilbert
2019-07-19 23:19 ` Adam Carter
0 siblings, 2 replies; 6+ messages in thread
From: Ian Zimmerman @ 2019-07-19 16:37 UTC (permalink / raw
To: gentoo-user
On 2019-07-19 20:58, Adam Carter wrote:
> 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 :)
I don't get this. blkid is userspace. The _kernel_ needs to know what
the root fs device is, before it even starts pid 1.
With initramfs, this egg/chicken problem is hidden: the initramfs itself
is the initial root fs, and during the pivot to the real root fs
userspace programs [1] are already available.
[1]
Well, usually just 1 of them: busybox.
--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] Re: Using UUID for root disk in grub requires initramfs?
2019-07-19 16:37 ` [gentoo-user] " Ian Zimmerman
@ 2019-07-19 16:59 ` Mike Gilbert
2019-07-19 23:19 ` Adam Carter
1 sibling, 0 replies; 6+ messages in thread
From: Mike Gilbert @ 2019-07-19 16:59 UTC (permalink / raw
To: gentoo-user
On Fri, Jul 19, 2019 at 12:37 PM Ian Zimmerman <itz@very.loosely.org> wrote:
>
> On 2019-07-19 20:58, Adam Carter wrote:
>
> > 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 :)
>
> I don't get this. blkid is userspace. The _kernel_ needs to know what
> the root fs device is, before it even starts pid 1.
The kernel init code is able to find a device given its PARTUUID.
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/init/do_mounts.c?h=v4.19.59#n172
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] Re: Using UUID for root disk in grub requires initramfs?
2019-07-19 16:37 ` [gentoo-user] " Ian Zimmerman
2019-07-19 16:59 ` Mike Gilbert
@ 2019-07-19 23:19 ` Adam Carter
1 sibling, 0 replies; 6+ messages in thread
From: Adam Carter @ 2019-07-19 23:19 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
On Sat, Jul 20, 2019 at 2:37 AM Ian Zimmerman <itz@very.loosely.org> wrote:
> On 2019-07-19 20:58, Adam Carter wrote:
>
> > 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 :)
>
> I don't get this. blkid is userspace. The _kernel_ needs to know what
> the root fs device is, before it even starts pid 1.
>
Sorry I was misleading by not using chronological order. The steps are;
1. Use blkid to look up the PARTUUID of the root partition
2. Add this to /etc/default/grub as GRUB_DEVICE="PARTUUID=d3554d49-02"
3. run grub-mkconfig
4. Reboot
[-- Attachment #2: Type: text/html, Size: 1396 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-07-19 23:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-19 9:29 [gentoo-user] Using UUID for root disk in grub requires initramfs? Adam Carter
2019-07-19 10:27 ` Mick
2019-07-19 10:58 ` Adam Carter
2019-07-19 16:37 ` [gentoo-user] " Ian Zimmerman
2019-07-19 16:59 ` Mike Gilbert
2019-07-19 23:19 ` Adam Carter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox