View previous topic :: View next topic |
Author |
Message |
hacatu n00b
Joined: 02 Feb 2025 Posts: 3
|
Posted: Mon Feb 03, 2025 12:06 am Post subject: Cannot get Ugrd to make an initramfs |
|
|
Hi all, I'm trying to do a fresh install of Gentoo.
I set up LUKs on LVM (unnecessary but that's what I did so I can't change it without starting over).
So I have `nvme0n1` partitioned into `nvme0n1p1 -> /efi`, `nvme0n1p2 -> /boot`, `nvme0n1p3 -> LVM VG1`.
Then the LVM volume group `VG1` is partitioned into `/dev/VG1/cryptswap` and `/dev/VG1/cryptroot`.
`cryptroot` is a luks contained locked by a password, and `cryptswap` can be unlocked by a password, or by a keyfile stored in `cryptroot`.
The intention of doing this is so that the swap can be unlocked without having to put in an extra password, but the keyfile is locked whenever `cryptroot` is locked.
From what I understand, ugrd should be able to automagically detect the mounted file systems and make an initramfs to unlock the root partition
(and also magically other partitions that are needed, so for example it should not unlock `cryptswap` since it is not needed to boot the main kernel.
I cannot get it to work. I would really appreciate any help or hints.
If I run it via installkernel (ie automatically on `make install` in the kernel source tree), `/usr/lib/kernel/install.d/52-ugrd.install` fails when it tries to execute `ugrd` because on `/usr/lib/python3.12/site-packages/ugrd/crypto/cryptsetup.py` line 175, I get `keyerror: '/dev/mapper/dm-1'` (I never asked about dm-1 implicitly or explicitly btw).
If I just run `ugrd`, it fails because it can't find the kernel sources. This would make sense, because on the liveCD we have linux 6.6.67 whereas `sys-kernel/gentoo-sources` installs 6.6.74, however, `ugrd --kver 6.6.74` also fails because it can't find kernel sources.
Installkernel use flags: `systemd ugrd systemd-boot`
systemd use flags: `boot`
ugrd use flags: none
relevant global use flags: `cryptsetup lvm`
/etc/kernel/install.conf (the only installkernel config I set up):
Code: |
layout=bls
initrd_generator=ugrd
uki_generator=none
|
/etc/ugrd/config.toml:
Code: |
modules = [
"ugrd.kmod.standard_mask",
"ugrd.fs.fakeudev"
]
kmod_autodetect_lspci = true
#auto_mounts = ['/boot', '/efi']
#primary_console = "ttyS1"
# ...
#[cryptsetup.root]
#uuid = "..."
|
This fails, regardless of which if any of the three commented-out groups I uncomment (I tried `primary_console` due to one of the ugrd examples on their github) (I know that is totally wrong, but it was the closest example I saw to luks on lvm). It also fails whether or not I add a `[cryptsetup.swap]` block explaining where the keyfile is. It's always the same error posted above
I can't post long files exactly because I'm unable to ssh into the computer with the livecd. For some reason, I can access the internet just fine from that machine, but I cannot even ping it on my LAN, let alone `ssh-copy-id` or ssh into it.
I can probably copy some files onto a usb or something if there are any particular logs that would be helpful.
I did not set the kernel command line anywhere, which feels fishy and wrong. I've installed gentoo a couple of times in the past, but usually in a vm not hardware, and I've never tried to do advanced disk setups -- it's REALLY hard compared to arch where mkinitcpio just works.
What files can I post to make this easier to diagnose? Is there an easy way to fix ssh or otherwise transfer large files? Should I give up on ugrd and try dracut or something else? Or try with a dist kernel? Or incinerate the whole install and redo it with luks on gpt partitions instead of lvm partitions?
Edit: Rebooting fixed the ssh issue, so I can copy and paste easily now
Edit2: I switched to dracut and it mostly works, but systemd-boot is shooting it in the back of the head and killing the system before I can read it. However, I was able to view the error by recording the screen with my phone haha
The dracut config `/etc/dracut.conf.d/00.conf` is
Code: |
hostonly="yes"
add_dracutmodules+=" crypt systemd-cryptsetup resume lvm btrfs systemd dm "
compress="xz"
kernel_cmdline+=" root=UUID=... rd.luks.uuid=... "
|
And the error that systemd-boot tries to hide from me is
Code: |
dracut: FATAL: Don't know how to handle 'root=live:CDLABEL-Gentoo-amd64-20250126'
|
in other words, the live cd kernel command line somehow leaked into my install, but the handbook describes how to fix this so I should hopefully be able to figure it out!
Edit3: Yay that fixed it! My system boots now! I'm not sure if I should mark this as solved, since I'm happy to use dracut but I technically did not resolve the original problem of not being able to use ugrd |
|
Back to top |
|
|
zen_desu Tux's lil' helper
Joined: 25 Oct 2024 Posts: 124
|
|
Back to top |
|
|
hacatu n00b
Joined: 02 Feb 2025 Posts: 3
|
Posted: Mon Feb 03, 2025 6:44 am Post subject: |
|
|
You are totally right, I have ugrd 1.27. And yeah, later I realized the kver should be "6.6.74-gentoo" not "6.6.74", so tab completion would have fixed that.
I will test the git version of ugrd tomorrow to confirm it works. Thanks for all your work on it, it's very cool! |
|
Back to top |
|
|
zen_desu Tux's lil' helper
Joined: 25 Oct 2024 Posts: 124
|
|
Back to top |
|
|
hacatu n00b
Joined: 02 Feb 2025 Posts: 3
|
Posted: Mon Feb 03, 2025 5:35 pm Post subject: |
|
|
Ok awesome! I just tested the git version and it does generate an initramfs now when I rebuild initkernel to use it and `make install` the kernel.
The initramfs does not work, but that's probably because of something I'm doing wrong.
I get
Code: |
...
md: If you don't use raid, use raid=noautodetect
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
/dev/root: Can't open blockdev
VFS: Cannot open root device 'UUID=...<the root id of the decrypted luks partition" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
... nvme0n1
... nvme0n1p1 ...
... nvme0n1p2 ...
... nvme0n1p3 ...
List of all bdev filesystems:
...
btrfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
...
|
This looks like output from the initramfs kernel and not the main kernel (especially in context). That makes me think that while dracut needed the kernel command line set or it accidentally got the one from the livecd, ugrd does not need the kernel command line set. I think that it is trying to open the decrypted luks root partition since it saw its uuid in the kernel command line, but failing since it is not unlocked yet. I'll see if that changes if I make the kernel command line empty
Edit: No, making the cmdline empty just makes it say `Cannot open root device "" or unknown-block(0,0): error -6` instead
Although this is almost certainly my fault, `bootctl list` shows `initrd: /boot//gentoo/6.6.74-gentoo/microcode-amd` (not an initrd lol) and the initrd in that folder is not actually getting updated if I stat it and look at the time stamp |
|
Back to top |
|
|
zen_desu Tux's lil' helper
Joined: 25 Oct 2024 Posts: 124
|
Posted: Mon Feb 03, 2025 6:03 pm Post subject: |
|
|
when using installkernel, it should first install the initramfs in the "staging area", then it will copy that to your ESP/BOOT/wherever.
It seems installkernel (or your bootloader) is only finding the microcode image, I think this could be because an initrd generator isn't being used by installkernel.
The initrd_generator= target is generally set by changing the USE flag on the installkernel package, if you're setting it manually it may help to confirm it's set properly and installing to the right place. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
|
Nowa Developer
Joined: 25 Jun 2014 Posts: 478 Location: Nijmegen
|
Posted: Mon Feb 03, 2025 8:50 pm Post subject: |
|
|
Quote: | /etc/kernel/install.conf (the only installkernel config I set up): |
Please don't manually override the install.conf unless you are actually doing something that installkernel does not natively support. /etc/kernel/install.conf is a recipe for confusion and weirdness if you don't know what you are doing because it opens the door for creating a mismatch between the configuration and the hooks that are actually installed by the installkernel package and its dependencies. _________________ OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400 |
|
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
|
|