Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

Device naming in Dracut

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
turtles
Veteran
Veteran
User avatar
Posts: 1713
Joined: Fri Dec 31, 2004 7:30 am

Device naming in Dracut

  • Quote

Post by turtles » Mon Oct 28, 2024 7:55 pm

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: Select all

  
   --- 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: Select all

/dev/mapper/gentoo_root
So from a live USB to enter the chroot I mount the root file system after I run

Code: Select all

 cryptsetup luksOpen /dev/ssd1/gentoo_root gentoo_root
The grub configuration used

Code: Select all

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: Select all

/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
Top
sMueggli
l33t
l33t
Posts: 627
Joined: Sat Sep 03, 2022 9:22 am

  • Quote

Post by sMueggli » Tue Oct 29, 2024 10:03 am

Can you please show the "original" generated grub.cfg or at least /proc/cmdline?
Top
zen_desu
Guru
Guru
Posts: 501
Joined: Fri Oct 25, 2024 3:14 pm
Location: your area

Re: Device naming in Dracut

  • Quote

Post by zen_desu » Tue Oct 29, 2024 2:44 pm

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: Select all

  
   --- 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: Select all

/dev/mapper/gentoo_root
So from a live USB to enter the chroot I mount the root file system after I run

Code: Select all

 cryptsetup luksOpen /dev/ssd1/gentoo_root gentoo_root
The grub configuration used

Code: Select all

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: Select all

/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
Top
turtles
Veteran
Veteran
User avatar
Posts: 1713
Joined: Fri Dec 31, 2004 7:30 am

  • Quote

Post by turtles » Tue Oct 29, 2024 3:50 pm

sMueggli wrote:Can you please show the "original" generated grub.cfg or at least /proc/cmdline?

Code: Select all

BOOT_IMAGE=/kernel-6.6.52-gentoo root=/dev/mapper/gentoo_root
Donate to Gentoo
Top
sMueggli
l33t
l33t
Posts: 627
Joined: Sat Sep 03, 2022 9:22 am

  • Quote

Post by sMueggli » Wed Oct 30, 2024 9:48 am

You should add the cmdline arguments

Code: Select all

rd.luks.uuid=aaaa.... rd.lvm.vg=...
(see https://wiki.gentoo.org/wiki/Dracut#LVM_on_LUKS).
Top
turtles
Veteran
Veteran
User avatar
Posts: 1713
Joined: Fri Dec 31, 2004 7:30 am

  • Quote

Post by turtles » Thu Oct 31, 2024 4:22 am

sMueggli wrote:You should add the cmdline arguments

Code: Select all

rd.luks.uuid=aaaa.... rd.lvm.vg=...
(see https://wiki.gentoo.org/wiki/Dracut#LVM_on_LUKS).
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/a ... eters.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
Top
sMueggli
l33t
l33t
Posts: 627
Joined: Sat Sep 03, 2022 9:22 am

  • Quote

Post by sMueggli » Thu Oct 31, 2024 10:02 am

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.
Top
Post Reply

7 posts • Page 1 of 1

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic