View previous topic :: View next topic |
Author |
Message |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Sat Feb 08, 2025 1:39 pm Post subject: my initramfs does not seem right |
|
|
I rebuilt my kernel and init, but the int seems to have only firmware in it and no hooks to help with decrypting the root device or importing the ZFS pool.
I referred to this for how to extract the contents as well as list what is in the archive.
https://wiki.gentoo.org/wiki/Custom_Initramfs#Extracting_the_cpio_archive
I know I previously ran a similar command, but it escapes me. I checked my bash history and am not finding it there, but when I run emerge --config gentoo-kernel, the initramfs it generates just has firmware despite me specifying modules. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sat Feb 08, 2025 3:53 pm Post subject: |
|
|
did you forget to make/add an init file to the image you made?
the initramfs needs kmods/firmware, and userspace tools to do whatever it is that initramfs needs to do. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Sat Feb 08, 2025 4:09 pm Post subject: |
|
|
But, I ran emerge --config gentoo-kernel and it handled all that previously. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sat Feb 08, 2025 4:16 pm Post subject: |
|
|
what use flags do you have in sys-kernel/installkernel? _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Sat Feb 08, 2025 4:18 pm Post subject: |
|
|
So, I previously was using dracut to build the init, so I had dracut configured globally. Since I tried ugrd just now, I swapped it out for ugrd. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sat Feb 08, 2025 4:23 pm Post subject: |
|
|
you're using the zfs branch right?
Can you share the output when it builds? or possibly:
If you run it manually, the build dir is left in /tmp/initramfs_build and can be explored. The main init file should have something like:
Code: |
#!/bin/sh -l
# Begin init_pre
mount_base
edebug Creating run dir: "$(mkdir -pv /run/ugrd)"
export_exports
parse_cmdline
readvar loglevel > /proc/sys/kernel/printk
print_banner
load_modules
# Begin init_main
mount_fstab
zpool_import
# Begin init_mount
mount_root
# Begin init_final
do_switch_root
# END INIT
|
When using zfs, it needs to build twice and there will be a controlled failure the first time, because the ZFS modules will be missing. You have the sys-fs/zfs-kmod package right? _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Sat Feb 08, 2025 7:08 pm Post subject: |
|
|
Cool, yes, I see that now and the structure and scripts look good.
Hmm, I see the crypt part, but I don't see where it gets the UUID or device to know what to unlock. I set that in the config.toml file, do I need to do anything with efibootmgr?
I will reboot to see if this incarnation worked, every time I reboot, I have to manually mount a bunch of different FS .
EDIT:
Darn EFI, it removed that boot entry ... I need to boot up to the admin USB and then run efibootmgr again.
EDIT:
After updating the boot options with efibootmgr, I get the same issue I got earlier, I see the spl and zfs kernel modules are loaded, but no other output after that.
Last edited by o5gmmob8 on Sat Feb 08, 2025 7:17 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sat Feb 08, 2025 7:15 pm Post subject: |
|
|
o5gmmob8 wrote: | Cool, yes, I see that now and the structure and scripts look good.
Hmm, I see the crypt part, but I don't see where it gets the UUID or device to know what to unlock. I set that in the config.toml file, do I need to do anything with efibootmgr?
I will reboot to see if this incarnation worked, every time I reboot, I have to manually mount a bunch of different FS .
EDIT:
Darn EFI, it removed that boot entry ... I need to boot up to the admin USB and then run efibootmgr again. |
Are you building for a root other than the one in use at build time? You shouldn't need to define any UUIDs if building for the "current system", it will detect uuiids, etc.
the "export_exports" section of the initramfs profile has all the vars which are detected at build time, and may be used at runtime.
efibootmgr may remove entries which fail.
If you're running ugrd manually, you must specify an output file path, or it just puts the image in /tmp _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Sat Feb 08, 2025 7:24 pm Post subject: |
|
|
I'm still in the 'install' phase, so I'm booting up to the admin CD / USB and then chrooting to the actual disk. I thought I mentioned earlier that my installation to the internal disk got messed up, so I'm booting up to USB for the time being. I don't think it should cause any issues.
Quote: | unlock external USB: cryptsetup ...
import pool: zpool import -R /mnt/gentoo z_1000.2
mount dev run sys proc ...
mount /dev/sdb1 /efi
mount /dev/sdb1 /boot/efi
chroot /mnt/gentoo
ugrd ... |
Thanks for all helping me through this, I apologize for taking up so much time. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sat Feb 08, 2025 7:32 pm Post subject: |
|
|
o5gmmob8 wrote: | I'm still in the 'install' phase, so I'm booting up to the admin CD / USB and then chrooting to the actual disk. I thought I mentioned earlier that my installation to the internal disk got messed up, so I'm booting up to USB for the time being. I don't think it should cause any issues.
Quote: | unlock external USB: cryptsetup ...
import pool: zpool import -R /mnt/gentoo z_1000.2
mount dev run sys proc ...
mount /dev/sdb1 /efi
mount /dev/sdb1 /boot/efi
chroot /mnt/gentoo
ugrd ... |
Thanks for all helping me through this, I apologize for taking up so much time. |
Thanks for helping test this for me.
Are you mounting /dev/sdb1 to both /efi and /boot/efi, or is that a typo?
What bootloader are you using, typically either /efi or /boot should be your ESP mountpoint.
If you're just running ugrd, and using the ZFS branch, the default config and "ugrd /<esp mountpoint>/initramfs-name.img" should work, but you'll need to manually add a boot entry for this, most likely. If you already have the zfs kmods installed, you should be able to "emerge --config gentoo-kernel{-bin}" to reinstall the kernel with a new initramfs.
If you're able to share the log when running these commands, that would help. If your EFI is removing boot entries, it may be that they aren't installed to the ESP correctly.
For testing, it may be easiest to boot into a known-working setup, and then from there, you can generate a new "test" image against the running kernel, etc. You can then configure your bootloader to use this new initramfs in an entry, if you efi stub boot that can be done with something like:
Code: | ugrd /<esp mountpouint>/initramfs-test.img
efibootmgr -c -d /dev/sdb -L gentoo-1.2.3-test -l vmlinuz-1.2.3 -u "initrd=amd-uc.img initrd=initramfs-test.img" |
This expects the kernel is named "vmlinuz-1.2.3" and is in the ESP root, along with the "initramfs-test.img" file. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Sat Feb 08, 2025 8:02 pm Post subject: |
|
|
Yes, I mount it in both places because otherwise dracut complained. As I run ZFS, I only have 2 partitions, the EFI boot partition (VFAT) and a ZPOOL encrypted with LUKS. /boot is not a separate filesystem, it is on the root FS.
Yes - I'm doing that with efibootmgr, but I suspect that I need a more permanent solution since it gets removed automatically if the device isn't present. For example, the admin CD is recognized every time I boot up. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sat Feb 08, 2025 8:18 pm Post subject: |
|
|
o5gmmob8 wrote: | Yes, I mount it in both places because otherwise dracut complained. As I run ZFS, I only have 2 partitions, the EFI boot partition (VFAT) and a ZPOOL encrypted with LUKS. /boot is not a separate filesystem, it is on the root FS.
Yes - I'm doing that with efibootmgr, but I suspect that I need a more permanent solution since it gets removed automatically if the device isn't present. For example, the admin CD is recognized every time I boot up. |
What are all the USE flags you have set for installkernel? I'm not sure why dracut would want both of those mounts, maybe it's making a UKI?
If an entry is unbootable for any reason, the firmware may remove it.
Installkernel may be installing files to /boot on your rootfs, which is encrypted, so your system firmware won't be able to see those options.
Depending on installkernel config, it may be installing files to /efi, but I don't see why /boot/efi should also be a mountpoint.
In any case, if you have kernels at the root of your ESP, you can make a ugrd image "next" to them and simply add an entry with efibootmgr, I don't see why that wouldn't work.
The admin cd being recognized is likely because it has a bootloader at the "default" efi path, so the system sees the device as bootable and can use it. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Sun Feb 09, 2025 2:06 am Post subject: |
|
|
I originally installed installkernel with the dracut use flag. I have since unmasked the latest version and rebuilt it without dracut, but with ugrd.
The EFI does not auto detect it as it does with the admin CD / USB or if I plug in any bootable Linux USB stick. So, I must be missing a configuration somewhere.
Yeah, so what I did before was to just mount it to make it happy, and then copy files into the appropriate directory in the EFI partition. But yeah, I'm not sure if I'm extracting the files out of the cpio archive properly, but when I have been today, I only see firmware in there, no actual init script (for dracut). The ugrd one looks better, but I was never prompted for a password. I believe the path I passed in was correct for the initramfs and I believe the default kernel supports xz compressed inits. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sun Feb 09, 2025 2:39 am Post subject: |
|
|
o5gmmob8 wrote: | I originally installed installkernel with the dracut use flag. I have since unmasked the latest version and rebuilt it without dracut, but with ugrd.
The EFI does not auto detect it as it does with the admin CD / USB or if I plug in any bootable Linux USB stick. So, I must be missing a configuration somewhere.
Yeah, so what I did before was to just mount it to make it happy, and then copy files into the appropriate directory in the EFI partition. But yeah, I'm not sure if I'm extracting the files out of the cpio archive properly, but when I have been today, I only see firmware in there, no actual init script (for dracut). The ugrd one looks better, but I was never prompted for a password. I believe the path I passed in was correct for the initramfs and I believe the default kernel supports xz compressed inits. |
did you see ugrd log anything when it ran? It should have printed the version, etc, then prompted for the LUKS password. I'm not sure what it would have stalled on before then. If you can share the init file it makes and the /etc/profile from the initramfs that would help debug this. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Sun Feb 09, 2025 12:25 pm Post subject: |
|
|
So, back to my original question, regarding cpio. It appears my original init was uncompressed as it was 60M in size. This is the cmd I ran to extract its contents, but the contents don't seemingly match with what was run at boot time, so I think this was not what I ran earlier to view the init:
https://wiki.gentoo.org/wiki/Custom_Initramfs
Code: | cpio --extract --make-directories --format=newc --no-absolute-filenames < initramfs.cpio |
Why is it only extracting the firmware in the current directory and not the actual init script? When I try to boot that init, it fails, but I am at least able to explore the initramfs and see there are many more files there.
Back to ugrd, when I attempt to boot that initramfs, all I see is that it loaded spl and zfs kernel modules, that's it.
https://bpa.st.MR6A
I do see the proper UUID and ZFS Pool name listed there, but I'm never prompted for the LUKS passphrase. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sun Feb 09, 2025 4:10 pm Post subject: |
|
|
o5gmmob8 wrote: | So, back to my original question, regarding cpio. It appears my original init was uncompressed as it was 60M in size. This is the cmd I ran to extract its contents, but the contents don't seemingly match with what was run at boot time, so I think this was not what I ran earlier to view the init:
https://wiki.gentoo.org/wiki/Custom_Initramfs
Code: | cpio --extract --make-directories --format=newc --no-absolute-filenames < initramfs.cpio |
Why is it only extracting the firmware in the current directory and not the actual init script? When I try to boot that init, it fails, but I am at least able to explore the initramfs and see there are many more files there.
|
You ran this on dracut? I think dracut is "special" in how it makes images so they have multiple layers. Dracut may come with a tool that can be used to handle the CPIO's it makes.
Quote: |
Back to ugrd, when I attempt to boot that initramfs, all I see is that it loaded spl and zfs kernel modules, that's it.
https://bpa.st.MR6A
I do see the proper UUID and ZFS Pool name listed there, but I'm never prompted for the LUKS passphrase. |
Can you share the init file it makes too?
I think that profile is fine but it looks like you're on a slightly older version, unless you have additional non-root mounts configured.
If you build the image with the "ugrd.base.debug" module it should give you a shell early into the boot process. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Sun Feb 09, 2025 7:19 pm Post subject: |
|
|
I updated the branch so now it should properly detect DM devices backing ZFS volumes. The old version didn't do that properly, sorry for that. I tested on a vm with 2 LUKS devices backing my ZFS root and it seems to work ![Very Happy :D](images/smiles/icon_biggrin.gif) _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Mon Feb 10, 2025 2:34 am Post subject: |
|
|
Cool, I will try again.
I managed to get the dracut init booting. I think either I fat fingered an entry in efibootmgr or I didn't update the entry properly. It's not intuitive to me at least. At least I think I can work through my init issues. EFI kicked my butt. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Mon Feb 10, 2025 2:36 am Post subject: |
|
|
o5gmmob8 wrote: | Cool, I will try again.
I managed to get the dracut init booting. I think either I fat fingered an entry in efibootmgr or I didn't update the entry properly. It's not intuitive to me at least. At least I think I can work through my init issues. EFI kicked my butt. |
When working with entries, I feel "efibootmgr -u" gives you a good idea of what is added. It's mostly important to ensure the entries are made with the right path info, "/" on the entry is the ESP root, so maybe /boot on your running system. The output can be a bit dense so it helps to carefully read it, ensuring the boot order is checked in addition to the entry itself.
The nice part about using ugrd with manually added entries is that you don't need to add any uuids to the command line. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Mon Feb 10, 2025 2:56 am Post subject: |
|
|
I think I have the latest ugrd, zfs branch:
https://bpa.st/WYKA
I re-ran it and wrote stdin and stderr to the logfile too:
https://bpa.st/2INA
I'll catch up with you tomorrow.
Thanks again, |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Mon Feb 10, 2025 3:02 am Post subject: |
|
|
Thanks for that log info, it's hard to tell here but are you sure you have the latest branch? Some of the line numbers from the traceback don't seem to match up with the latest ZFS branch.
You can use:
Code: | EGIT_OVERRIDE_BRANCH_DESULTORY_UGRD=zfs emerge ugrd -1 |
_________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
o5gmmob8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 17 Oct 2003 Posts: 518
|
Posted: Mon Feb 10, 2025 10:30 am Post subject: |
|
|
It is complaining about /dev/mapper/gentoo not existing. I think it must be looking for the device mapper name that is typically used during installation, but dracut uses a different convention. It did find the dracut mapping, but still expected gentoo to exist.
https://bpa.st/EDLQ |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zen_desu Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 25 Oct 2024 Posts: 133
|
Posted: Mon Feb 10, 2025 2:48 pm Post subject: |
|
|
o5gmmob8 wrote: | It is complaining about /dev/mapper/gentoo not existing. I think it must be looking for the device mapper name that is typically used during installation, but dracut uses a different convention. It did find the dracut mapping, but still expected gentoo to exist.
https://bpa.st/EDLQ |
If you're making your own config, the mapped names must match for validation, as in if you have "/dev/mapper/foo" config for cryptsetup should start with [cryptsetup.foo]
If autoconfig works (it should let you know if it fails) that config is not necessary. If you want to configure something you must use the currently mapped name, or disable validation. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
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
|
|