View previous topic :: View next topic |
Author |
Message |
turtles Veteran
Joined: 31 Dec 2004 Posts: 1696
|
Posted: Mon Oct 28, 2024 7:55 pm Post subject: Device naming in Dracut |
|
|
Greetings Gentooers I just stumbled thru my first install using Dracut to generate a initramfs.
Its a Linux router 'appliance', GPT partitioned drive, old dos style BIOS, openRC.
I am wondering why and how Dracut just makes up names for stuff like LVM volume groups and dm_crypt luks devices?
The reason I ask is it did not follow how I named them,
for example this system has several gpt partitions one is LVM and one of the volume groups has an encrypted root that is the Gentoo root (/) it needs to switch_root to.
When I built the system I named the LVM volume path /dev/ssd1/gentoo_root and the volume group is gentoo_root
like so
Code: |
--- Logical volume ---
LV Path /dev/ssd1/gentoo_root
LV Name gentoo_root
VG Name ssd1
|
Then when ran I cryptsetup on the LV I made the dm_crypt device gentoo_root
and it resides at
Code: | /dev/mapper/gentoo_root |
So from a live USB to enter the chroot I mount the root file system after I run
Code: | cryptsetup luksOpen /dev/ssd1/gentoo_root gentoo_root |
The grub configuration used Code: | root=/dev/mapper/gentoo_root |
I fumbled thru the Dracut guide a few times
https://wiki.gentoo.org/wiki/Dracut
The initramfs that Dracut makes expects completely different names,
for my LVM LV name it chose Code: | /dev/mapper/ssd1-gentoo_root |
and the dm_crypt Luke volume to be named luks-<UUID> where <UUID> is the uuid of the luks volume.
I poked around in Dracut and its configs and did not see a way to tell Dracut how I would like things named.
I instead got it working by just changing the root= parameter in my grub.cfg which is fine for me and it boots fine.
However I am curious if there is a way to specify / override device naming in Dracuts udev (or whatever it uses) to name devices ?
It would be a useful thing to add to the Dracut Gentoo wiki to aid other users (unless I missed something)
Or if you cant use custom names then it would be preferable for users to generate the UDEV or whatever generated names earlier in the install process so there is not a conflict with grub or another boot loader.
In the past when I had made initramfs and initrd's all the info was put in by hand, and after the initrd ran there was no need to have a that info in fstab or crypttab as the root device is already mounted.
But with Dracut I'd imagne there should be a dratab file that contains logical volume names and luks names and mount points?
Its nice that Dracut tries to auto-magicly generate that info from a running system, but it is not getting it correct from mine, or ther may be cases when a user needs to change something, so I think Dracut would work better for me if it was setup like /etc/grub.d and have auto generated files the user can edit if needed.
Also it did not seem to correctly copy over any kernel modules to the initramfs, I was under the impression it would.
That was not a show stopper as all I had to do was compile in the crypt stuff, but again it would be good if that was more clear in the wiki.
Thanks in advance for any advice, thought and or feedback on using Dracut. _________________ Donate to Gentoo |
|
Back to top |
|
|
sMueggli Guru
Joined: 03 Sep 2022 Posts: 500
|
Posted: Tue Oct 29, 2024 10:03 am Post subject: |
|
|
Can you please show the "original" generated grub.cfg or at least /proc/cmdline? |
|
Back to top |
|
|
zen_desu n00b
Joined: 25 Oct 2024 Posts: 31
|
Posted: Tue Oct 29, 2024 2:44 pm Post subject: Re: Device naming in Dracut |
|
|
turtles wrote: | Greetings Gentooers I just stumbled thru my first install using Dracut to generate a initramfs.
Its a Linux router 'appliance', GPT partitioned drive, old dos style BIOS, openRC.
I am wondering why and how Dracut just makes up names for stuff like LVM volume groups and dm_crypt luks devices?
The reason I ask is it did not follow how I named them,
for example this system has several gpt partitions one is LVM and one of the volume groups has an encrypted root that is the Gentoo root (/) it needs to switch_root to.
When I built the system I named the LVM volume path /dev/ssd1/gentoo_root and the volume group is gentoo_root
like so
Code: |
--- Logical volume ---
LV Path /dev/ssd1/gentoo_root
LV Name gentoo_root
VG Name ssd1
|
Then when ran I cryptsetup on the LV I made the dm_crypt device gentoo_root
and it resides at
Code: | /dev/mapper/gentoo_root |
So from a live USB to enter the chroot I mount the root file system after I run
Code: | cryptsetup luksOpen /dev/ssd1/gentoo_root gentoo_root |
The grub configuration used Code: | root=/dev/mapper/gentoo_root |
I fumbled thru the Dracut guide a few times
https://wiki.gentoo.org/wiki/Dracut
The initramfs that Dracut makes expects completely different names,
for my LVM LV name it chose Code: | /dev/mapper/ssd1-gentoo_root |
and the dm_crypt Luke volume to be named luks-<UUID> where <UUID> is the uuid of the luks volume.
|
Yeah, Dracut does this because it uses udev to name devices based on type and uuid.
At the same time, GRUB tries to add a path for root= if a mapped device is used, like with lvm or luks.
I think the best way to make GRUB work nicely with Dracut is to configure the root= in the grub default's so it doesn't pull it from the running system and end up confusing dracut.
turtles wrote: |
I poked around in Dracut and its configs and did not see a way to tell Dracut how I would like things named.
I instead got it working by just changing the root= parameter in my grub.cfg which is fine for me and it boots fine.
However I am curious if there is a way to specify / override device naming in Dracuts udev (or whatever it uses) to name devices ?
It would be a useful thing to add to the Dracut Gentoo wiki to aid other users (unless I missed something)
|
I think syntax like:
rd.luks.name=<uuid>=name
can be used, but I have not tested this.
If you can help update the wiki with this info, that would be great.
turtles wrote: |
Or if you cant use custom names then it would be preferable for users to generate the UDEV or whatever generated names earlier in the install process so there is not a conflict with grub or another boot loader.
In the past when I had made initramfs and initrd's all the info was put in by hand, and after the initrd ran there was no need to have a that info in fstab or crypttab as the root device is already mounted.
But with Dracut I'd imagne there should be a dratab file that contains logical volume names and luks names and mount points?
|
I think in hostonly mode, dracut may use the host fstab or crypttab if you use systemd. I think the point of dracut is kinda to be dynamic, like it should use config passed in the cmdline or react to devices being added with udev.
turtles wrote: |
Its nice that Dracut tries to auto-magicly generate that info from a running system, but it is not getting it correct from mine, or ther may be cases when a user needs to change something, so I think Dracut would work better for me if it was setup like /etc/grub.d and have auto generated files the user can edit if needed.
Also it did not seem to correctly copy over any kernel modules to the initramfs, I was under the impression it would.
That was not a show stopper as all I had to do was compile in the crypt stuff, but again it would be good if that was more clear in the wiki.
Thanks in advance for any advice, thought and or feedback on using Dracut. |
I believe most "Dracut config" is generally about what modules it pulls or uses, from there how it works should be adjusted with cmdline parameters. If you're trying to make Dracut more static, I think you're working against its intended design/use. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1696
|
Posted: Tue Oct 29, 2024 3:50 pm Post subject: |
|
|
sMueggli wrote: | Can you please show the "original" generated grub.cfg or at least /proc/cmdline? |
Code: | BOOT_IMAGE=/kernel-6.6.52-gentoo root=/dev/mapper/gentoo_root |
_________________ Donate to Gentoo |
|
Back to top |
|
|
sMueggli Guru
Joined: 03 Sep 2022 Posts: 500
|
|
Back to top |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1696
|
Posted: Thu Oct 31, 2024 4:22 am Post subject: |
|
|
Ahh ok thanks sMueggli,
I am not familiar with the 'rd.luks and rd.lvm' kernel command line parameters,
so your saying they are just for specifying the device names and if their not set I get those auto generated udev ones?
I looked for documentation on the at
https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html
but rd. is a broad search term.
Presumably order does not matter? Say if the system is LUKS on LVM
or LVM on LUKS?
Cheers. _________________ Donate to Gentoo |
|
Back to top |
|
|
sMueggli Guru
Joined: 03 Sep 2022 Posts: 500
|
Posted: Thu Oct 31, 2024 10:02 am Post subject: |
|
|
The kernel does not need to understand the rd.* parameters. See "man 7 dracut.cmdline" for a description of the rd.* parameters.
I do not think that the order of parameters matter. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|