Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] ugrd reporting RuntimeError: Unknown device mapper
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
vrghost
n00b
n00b


Joined: 03 Oct 2003
Posts: 57
Location: London

PostPosted: Sat Nov 16, 2024 8:31 pm    Post subject: [SOLVED] ugrd reporting RuntimeError: Unknown device mapper Reply with quote

Currently trying to move to a encrypted root fs, following this article:
https://wiki.gentoo.org/wiki/Full_Disk_Encryption_From_Scratch

So far, I have managed to create the volume, encrypt it, reboot the server using live CD, mount the encrypted volume using the key stored on the efi volume, then mounted everything, chrooted into the environment and at the stage of trying to run ugrd, but I am getting the following error message:
Code:

DEBUG    | ugrd.InitramfsGenerator                    | [root] Device mapper info: {'major': '253', 'minor': '0', 'holders': [], 'slaves': ['nvme0n1p7'], 'uuid': 'CRYP
T-LUKS2-2713385e5e674394964d3814c52a425f-root', 'name': 'root'}
Device config: {'partuuid': '327a9d8a-1990-4ae7-b6b9-0145dd51fb03'}
INFO     | ugrd                                       | Dumping config dict:

ERROR    | ugrd                                       | Unknown device mapper device type: None
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/ugrd/main.py", line 66, in main
    generator.build()
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 76, in build
    self.run_build()
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 207, in run_build
    self.run_hook(task, force_exclude=True)
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 126, in run_hook
    if function_output := self.run_func(function, *args, **kwargs):
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 92, in run_func
    if function_output := function(self):
                          ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 415, in autodetect_root_dm
    _autodetect_dm(self, '/')
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 382, in _autodetect_dm
    raise RuntimeError("Unknown device mapper device type: %s" % blkid_info.get('type'))
RuntimeError: Unknown device mapper device type: None


Full debug log can be found at
https://bpa.st/HXNQ

And the config.toml
/etc/ugrd/config.toml


Looking at blkid
Code:

/dev/sda3: BLOCK_SIZE="2048" LABEL="Gentoo-amd64-20241103" TYPE="hfsplus" PARTLABEL="HFSPLUS" PARTUUID="f2196140-2caf-4dc9-95d2-d046c3259d84"
/dev/nvme0n1p5: UUID="5b60094d-fadd-4116-954b-8544ee0e7280" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="5bb7f630-99aa-4de1-b0ce-82caf81ca76e"
/dev/nvme0n1p3: BLOCK_SIZE="512" UUID="4E42EFAC42EF974D" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="b2c07de3-3012-425f-9691-1e249ef480c8"
/dev/nvme0n1p1: UUID="6EA6-1714" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="28907a67-617d-44e7-92b3-ec2627aab188"
/dev/nvme0n1p6: UUID="254ea3a9-0131-465d-bf89-7def5aa063e2" TYPE="swap" PARTUUID="cbb85061-5429-49f3-98f6-2a724a4f8767"
/dev/nvme0n1p4: BLOCK_SIZE="512" UUID="78D493E8D493A742" TYPE="ntfs" PARTUUID="4d23f5b8-743c-40a2-beb1-4a4f8a9a271b"
/dev/loop0: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/mapper/root: LABEL="rootfs" UUID="f84e336d-06d5-4eba-9278-330861fb604b" UUID_SUB="3ab52124-63e3-41ea-b0ce-63e184fb90b7" BLOCK_SIZE="4096" TYPE="btrfs"
/dev/sda2: SEC_TYPE="msdos" UUID="4B0E-13DB" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI boot partition" PARTUUID="f2196140-2caf-4dc9-95d3-d046c3259d84"
/dev/nvme0n1p7: PARTUUID="327a9d8a-1990-4ae7-b6b9-0145dd51fb03"
/dev/nvme0n1p2: PARTLABEL="Microsoft reserved partition" PARTUUID="406656e7-33e7-4955-bc66-5c47eb17a002"
/dev/sda4: PARTLABEL="Gap1" PARTUUID="f2196140-2caf-4dc9-95d5-d046c3259d84"
/dev/sda1: PARTLABEL="Gap0" PARTUUID="f2196140-2caf-4dc9-95d0-d046c3259d8


/dev/nvme0n1p7 does not have a type; this is where the encrypted data for /dev/mapper/root is; not certain if that is the issue, but should it have a type, or is used looking at the wrong device?


Last edited by vrghost on Sun Nov 17, 2024 6:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
zen_desu
n00b
n00b


Joined: 25 Oct 2024
Posts: 22

PostPosted: Sat Nov 16, 2024 10:22 pm    Post subject: Reply with quote

Can you share your config?

blkid won't be able to detect the device type if the LUKS headers are detached.

If you have detached headers, you must define that in the config, and the name for the cryptsetup entry should match the name it's opened/mapped to.

Here's an example for detached headers:

https://github.com/desultory/ugrd/blob/main/examples/detached_headers.toml

You can define the mountpoint used for the external storage which contains the header file under auto_mounts.
_________________
µgRD dev
Wiki writer
Back to top
View user's profile Send private message
vrghost
n00b
n00b


Joined: 03 Oct 2003
Posts: 57
Location: London

PostPosted: Sat Nov 16, 2024 10:47 pm    Post subject: Reply with quote

Sorry zen_desu, did not check the above link, seems like it is broken


Here is my config file. Tried to add efi as a mount point to ensure it mounts it for the key header

[URL] https://bpa.st/NAPA[/url]

But not certain I've understood how ugrd correctly, can I just define a new mount by adding:
Code:

auto_mounts = ['/efi']
[mounts.efi]
type = "vfat"
uuid = "6EA6-1714"


And is it even the right thing to do, my expectation was to get to the header_file

Code:

[cryptsetup.root]
# The UUID of the encrypted volume, mounted at /dev/mapper/root
uuid = "327a9d8a-1990-4ae7-b6b9-0145dd51fb03"
header_file = "/efi/lheader/luks_header.img"
Back to top
View user's profile Send private message
zen_desu
n00b
n00b


Joined: 25 Oct 2024
Posts: 22

PostPosted: Sat Nov 16, 2024 11:02 pm    Post subject: Reply with quote

I would not set the kernel version in the config file unless you can't pass the --kver arg or it's just there for testing.

If you specify "/efi" in auto_mounts, it will automatically make the mount config for whatever is mounted at /efi, so the manual config is not required.

I think that 'label = "rootfs"' is not doing anything, you could have that specified under a mount config, but it will detect your root config by default.

For your "cryptsetup.root" config section, you do not need to define the uuid or partuuid, it will detect it, but that uuid you have defined seems to be the partuuid, so that is an issue.

Code:
modules = [
  "ugrd.kmod.standard_mask",
  "ugrd.crypto.cryptsetup",
]

# specify the output directory for the created image
out_dir = "/usr/src/initramfs"

# Optionally supply a kernel version, uses the current kernel version if not specified
#kernel_version = "linux-6.6.58-gentoo-r1"
# lspci based detection is usually helpful
kmod_autodetect_lspci = true

auto_mounts = ['/efi']  # Automatically create mount config for /efi on the host

# Maps the root LUKS device to /dev/mapper/root
[cryptsetup.root]
# The header must be specified since it's detached
header_file = "/efi/lheader/luks_header.img"


I think this config should work as long as you pass --kver as a cmdline arg (installkernel will do this for you)
_________________
µgRD dev
Wiki writer
Back to top
View user's profile Send private message
vrghost
n00b
n00b


Joined: 03 Oct 2003
Posts: 57
Location: London

PostPosted: Sat Nov 16, 2024 11:46 pm    Post subject: Reply with quote

Much appreciated @zen_desu

Think I followed all your suggestions



Code:


# The initramfs will be built in /tmp/initramfs if "build_dir" is not specified not specified
out_dir = "/usr/src/initramfs"

# Optionally supply a kernel version, uses the current kernel version if not specified
kernel_version = "linux-6.6.58-gentoo-r1"
# lspci based detection is usually helpful
kmod_autodetect_lspci = true
# lsmod detection can be helpful, but can bring in unnecessary modules
#kmod_autodetect_lsmod = true

# Wait a few seconds for storage to settle after modules are loaded if external or slow storage is used
#mount_wait = true
#mount_timeout = 3

# The location of the gpg public key, if using a smartcard and gpg encrypted keyfile
#sc_public_key = "/etc/ugrd/pubkey.gpg"

auto_mounts = ['/efi']  # Automatically create mount config for /boot on the host

# Optionally specify the root mountpoint information manually
#[mounts.root]
# The label of the root filesystem, a uuid or partuuid could be used instead
label = "rootfs"

# This is necessary if the keyfile is on another device.
# The keyfile could be added as a dependency. if it's on the same device.
#[mounts.efi]
#type = "vfat"
#uuid = "6EA6-1714"


# If the root is a LUKS volume, specify the LUKS volume information
[cryptsetup.root]
# The UUID of the encrypted volume, mounted at /dev/mapper/root
#uuid = "327a9d8a-1990-4ae7-b6b9-0145dd51fb03"
header_file = "/efi/lheader/luks_header.img"
# If a GPG encrypted key file is used, the key_type must be set to gpg.
#key_type = "gpg"
# The key file must either be included as a dependency, or it must be under an external mountpoint.
#key_file = "/efi/lheader/rootfs.luks.gpg"
                                               



Still same result, still the error message

Code:

ERROR    | Unknown device mapper device type: None
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/ugrd/main.py", line 66, in main
    generator.build()
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 76, in build
    self.run_build()
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 207, in run_build
    self.run_hook(task, force_exclude=True)
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 126, in run_hook
    if function_output := self.run_func(function, *args, **kwargs):
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 92, in run_func
    if function_output := function(self):
                          ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 415, in autodetect_root_dm
    _autodetect_dm(self, '/')
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 382, in _autodetect_dm
    raise RuntimeError("Unknown device mapper device type: %s" % blkid_info.get('type'))
RuntimeError: Unknown device mapper device type: None
Back to top
View user's profile Send private message
zen_desu
n00b
n00b


Joined: 25 Oct 2024
Posts: 22

PostPosted: Sat Nov 16, 2024 11:54 pm    Post subject: Reply with quote

vrghost wrote:
Much appreciated @zen_desu

Still same result, still the error message

Code:

ERROR    | Unknown device mapper device type: None
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/ugrd/main.py", line 66, in main
    generator.build()
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 76, in build
    self.run_build()
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 207, in run_build
    self.run_hook(task, force_exclude=True)
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 126, in run_hook
    if function_output := self.run_func(function, *args, **kwargs):
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 92, in run_func
    if function_output := function(self):
                          ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 415, in autodetect_root_dm
    _autodetect_dm(self, '/')
  File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 382, in _autodetect_dm
    raise RuntimeError("Unknown device mapper device type: %s" % blkid_info.get('type'))
RuntimeError: Unknown device mapper device type: None


Can you share the full output? https://github.com/desultory/ugrd/blob/1.24.2/src/ugrd/fs/mounts.py#L375-L382

it's throwing that error because you have detached headers, so blkid doesn't report partition type. The only way for it to treat it as a luks partition is if you have cryptsetup config defined with the name found in the virtual block device info, like "/sys/block/dm-x/dm/name". That name must match the name in the config.

The error message there could be improved, this typically happens for detached headers with a mismatched name.
https://github.com/desultory/ugrd/pull/122
_________________
µgRD dev
Wiki writer
Back to top
View user's profile Send private message
vrghost
n00b
n00b


Joined: 03 Oct 2003
Posts: 57
Location: London

PostPosted: Sun Nov 17, 2024 8:08 am    Post subject: Reply with quote

Good morning zen_desu

Sorry, I went to sleep. Thank you so very much for this help, and guessing that was your PR to ugrd.

Think I got one step forward, or one step back, if the issue is that it just can't figure out what to do with the rootfs mount without the hederfile


Here is the full output (without change)
https://bpa.st/BUUA

I was trying to mount efi rather than boot, but I don't know enough about ugrd.

Am I understand correctly that when you add
Code:
auto_mounts = ['/efi']


Or in the original one
Code:
auto_mounts = ['/boot']


Are we telling ugrd to mount it when building initramfs OR are we telling initramfs to mount it during its load/boot?

Same with the three lines:
Code:

[mounts.efi]
type = "vfat"
uuid = "6EA6-1714"

Are we telling ugrd or initramfs to mount it

Also where would I put my header_file, and do I put root before or after efi (as initramfs presumably need to mount root then efi to complete the boot, but needs efi to get hold of the key file open the encrypted file


I tried the above, moving header_dfile to the section of mounts.efi, but then it seems to read it as a mount parameter
Quote:

Traceback (most recent call last):
File "/usr/lib/python-exec/python3.12/ugrd", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3.12/site-packages/ugrd/main.py", line 63, in main
generator = InitramfsGenerator(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/zenlib/logging/loggify.py", line 50, in __init__
super().__init__(*args, **kwargs)
File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 27, in __init__
self.load_config(config) # The user config is loaded over the base config, clobbering kwargs
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 50, in load_config
self[config] = value
~~~~^^^^^^^^
File "/usr/lib/python3.12/site-packages/ugrd/initramfs_generator.py", line 55, in __setitem__
self.config_dict[key] = value
~~~~~~~~~~~~~~~~^^^^^
File "/usr/lib/python3.12/site-packages/ugrd/initramfs_dict.py", line 62, in __setitem__
return self.handle_parameter(key, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/ugrd/initramfs_dict.py", line 112, in handle_parameter
return handle_plural(func)(self, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/zenlib/util/handle_plural.py", line 35, in wrapper
function(self, *(other_args + (key, value,)))
File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 110, in _process_mounts_multi
_process_mount(self, mount_name, mount_config)
File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 69, in _process_mount
_validate_mount_config(self, mount_name, mount_config)
File "/usr/lib/python3.12/site-packages/zenlib/util/dict_check.py", line 31, in _contains
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/ugrd/fs/mounts.py", line 47, in _validate_mount_config
raise ValueError("Invalid parameter in mount: %s" % parameter)
ValueError: Invalid parameter in mount: header_file
Back to top
View user's profile Send private message
vrghost
n00b
n00b


Joined: 03 Oct 2003
Posts: 57
Location: London

PostPosted: Sun Nov 17, 2024 8:44 am    Post subject: Reply with quote

@zen_desu

Tried to understand your comment:
Quote:
It's throwing that error because you have detached headers, so blkid doesn't report partition type. The only way for it to treat it as a luks partition is if you have cryptsetup config defined with the name found in the virtual block device info, like "/sys/block/dm-x/dm/name". That name must match the name in the config.



So looking at the device
Code:
(chroot) livecd /efi/lheader # ls /sys/block/dm-0/
alignment_offset  capability  discard_alignment  dm      events_async       ext_range  holders   integrity  power  range      ro    slaves  subsystem  uevent
bdi               dev         diskseq            events  events_poll_msecs  hidden     inflight  partscan   queue  removable  size  stat    trace


That SHOULD be the decrypted device (mounted as /dev/mapper/root), but may have misunderstood things

How would I confirm the name is the same as what is configured with cryptsetup?

Think I named the FS on the device roofs (because the instructions told me to), is that the issue?
Quote:
mkfs.btrfs -L rootfs /dev/mapper/root
[/code]
Back to top
View user's profile Send private message
zen_desu
n00b
n00b


Joined: 25 Oct 2024
Posts: 22

PostPosted: Sun Nov 17, 2024 3:50 pm    Post subject: Reply with quote

Did you remove anything from that output, it seems like the final config dict is removed, but i see:

Code:

DEBUG    | ugrd.InitramfsGenerator.InitramfsConfigDict | Adding unknown internal parameter to processing queue: cryptsetup
DEBUG    | ugrd.InitramfsGenerator                    | Loaded config:
modules:
  - ugrd.base.core
  - ugrd.fs.mounts
  - ugrd.base.cmdline
  - ugrd.base.banner
  - ugrd.kmod.kmod
  - ugrd.fs.cpio
  - ugrd.base.checks
  - ugrd.base.base
  - ugrd.kmod.nosound
  - ugrd.kmod.novideo
  - ugrd.kmod.nonetwork
  - ugrd.kmod.standard_mask


It isn't able to process your cryptsetup config because it never added the module for it, so it ends up ignoring your config.


With detached headers you have to be sure you have `modules = ["ugrd.crypto.cryptsetup"]` at the least.
_________________
µgRD dev
Wiki writer


Last edited by zen_desu on Sun Nov 17, 2024 4:02 pm; edited 1 time in total
Back to top
View user's profile Send private message
zen_desu
n00b
n00b


Joined: 25 Oct 2024
Posts: 22

PostPosted: Sun Nov 17, 2024 3:53 pm    Post subject: Reply with quote

vrghost wrote:

Are we telling ugrd to mount it when building initramfs OR are we telling initramfs to mount it during its load/boot?


The 'mounts' in ugrd are to wrap things that end up being mounted by some function or go in the fstab within the image. With basic mounts, they get added to the fstab. So making the `auto_mounts = ['/efi']` config makes it add a fstab line in the initramfs to mount that device.

Manually defining a mount like:

Code:
[mounts.test]
type = "vfat"
uuid = "1234-asdf"


Will make a fstab entry for a device with that config to be mounted at "/test"

If you had that device already mounted at "/test", adding `auto_mounts = ['/test']` would create the same config at runtime, so the outcome would be the same, but it will raise an exception if it cannot find that device/mountpoint. The automated portion also tries to add kmods based on the device type, while normal config only checks the filesystem.

vrghost wrote:

I tried the above, moving header_dfile to the section of mounts.efi, but then it seems to read it as a mount parameter


The `header_file` config is for "cryptsetup" config, shown here: https://github.com/desultory/ugrd/blob/main/docs/configuration.md#ugrdcryptocryptsetup
_________________
µgRD dev
Wiki writer
Back to top
View user's profile Send private message
vrghost
n00b
n00b


Joined: 03 Oct 2003
Posts: 57
Location: London

PostPosted: Sun Nov 17, 2024 6:05 pm    Post subject: Reply with quote

THANK YOU SO VERY MUCH @zen_desu!!!!


Full config in the end, but seems like as soon as I uncommented ugrd.crypto.cryptsetup, we got further
Code:

modules = [
  "ugrd.kmod.standard_mask",
  "ugrd.crypto.cryptsetup", # This is included by the gpg module
#  "ugrd.crypto.gpg", # This is included by the smartcard module
#  "ugrd.crypto.smartcard",
]


Quote:

cryptsetup:
root:
header_file: rootfs.luks.header.img
retries: 5
partuuid: 327a9d8a-1990-4ae7-b6b9-0145dd51fb03
argon2: False


Once that was done it started complaining about kernel modules missing, I THINK that is because the script believes it is running 6.6.58, and the kernel is linux-6.6.58-gentoo-r1, if anyone else have this issue after all this, ls /mod/libs, put the name the kernel have there into the config file, in my case the module directory was called 6.6.58-gentoo-r1

Code:

# Optionally supply a kernel version, uses the current kernel version if not specified
kernel_version = "6.6.58-gentoo-r1"
# lspci based detection is usually helpful
kmod_autodetect_lspci = true
# lsmod detection can be helpful, but can bring in unnecessary modules
#kmod_autodetect_lsmod = true




Code:

# This config will decrypt the LUKS volume with uuid "fdf442da-0574-4531-98c7-55227a041f1d", mapping it to "/dev/mapper/root"
# It will attempt to mount the btrfs volume with label "rootfs" to /target_rootfs
# It will pull all current kernel modules from lspci -k results
# It will try to process the cmdline and mount the rootfs based on the root= parameter

modules = [
  "ugrd.kmod.standard_mask",
  "ugrd.crypto.cryptsetup", # This is included by the gpg module
#  "ugrd.crypto.gpg", # This is included by the smartcard module
#  "ugrd.crypto.smartcard",
]

# Mask the parse_cmdline function to prevent it from running
#mask.init_pre = 'parse_cmdline'

# The initramfs will be built in /tmp/initramfs if "build_dir" is not specified not specified
out_dir = "/usr/src/initramfs"

# Optionally supply a kernel version, uses the current kernel version if not specified
#kernel_version = "linux-6.6.58-gentoo-r1"
# lspci based detection is usually helpful
kmod_autodetect_lspci = true
# lsmod detection can be helpful, but can bring in unnecessary modules
#kmod_autodetect_lsmod = true

# Wait a few seconds for storage to settle after modules are loaded if external or slow storage is used
#mount_wait = true
#mount_timeout = 3

# The location of the gpg public key, if using a smartcard and gpg encrypted keyfile
#sc_public_key = "/etc/ugrd/pubkey.gpg"

auto_mounts = ['/efi']  # Automatically create mount config for /boot on the host

# Optionally specify the root mountpoint information manually
#[mounts.root]
# The label of the root filesystem, a uuid or partuuid could be used instead
label = "rootfs"

# This is necessary if the keyfile is on another device.
# The keyfile could be added as a dependency. if it's on the same device.
#[mounts.efi]
#type = "vfat"
#uuid = "6EA6-1714"


# If the root is a LUKS volume, specify the LUKS volume information
[cryptsetup.root]
header_file = "rootfs.luks.header.img"
#header_file = "/efi/lheader/luks_header.img"
#uuid = "f84e336d-06d5-4eba-9278-330861fb604b"
# The UUID of the encrypted volume, mounted at /dev/mapper/root
# If a GPG encrypted key file is used, the key_type must be set to gpg.
#key_type = "gpg"
# The key file must either be included as a dependency, or it must be under an external mountpoint.
#key_file = "/efi/lheader/rootfs.luks.gpg"
Back to top
View user's profile Send private message
zen_desu
n00b
n00b


Joined: 25 Oct 2024
Posts: 22

PostPosted: Sun Nov 17, 2024 6:17 pm    Post subject: Reply with quote

You're welcome.

By default, it tries to use the current running kernel version, like the output of "uname -r".
If you have shell completion for bash/zsh, you should be able to add a "--kver" arg to ugrd and tab complete kernels from "/lib/modules".
--kver or --kernel-version get processed the same as "kernel_version" in the config.

reading over your config some, you have:

Code:
[cryptsetup.root]
header_file = "rootfs.luks.header.img"


It should check that file exists, but doesn't ensure it will be available at boot time. If it's under a mountpoint, you must ensure that mountpoint is configured, and that the path for the header file matches up. I think your prior config should have worked as long as the file is at that path:

Code:
auto_mounts = ['/efi']  # Automatically create mount config for /boot on the host

# If the root is a LUKS volume, specify the LUKS volume information
[cryptsetup.root]
header_file = "/efi/lheader/luks_header.img"

_________________
µgRD dev
Wiki writer
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
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