[systemd-devel] Mapped device not becoming active
Lennart Poettering
lennart at poettering.net
Wed Sep 11 12:28:03 UTC 2024
On Mi, 11.09.24 11:43, Fredrik Hugosson (fredrik.hugosson at axis.com) wrote:
> Hi!
>
> I'm trying to use the systemd-cryptsetup at .service<mailto:systemd-cryptsetup at .service> to open a LUKS encrypted device, everything works nice except that systemd never realizes that the corresponding device-unit is active, which leads to fsck at .service<mailto:fsck at .service> and mount at .service<mailto:mount at .service> waiting for the device to become active. I can fsck and mount manually so the cryptsetup service succeded, which also is what systemctl status systemd-cryptsetup at .service<mailto:systemd-cryptsetup at .service> shows.
>
> The HW is an embedded product on ARM 64 bit architecture, built on Yocto 5.0 (April 2024), with kernel 5.15 and systemd 255
>
> Using udevadm monitor I can verify that both ADD and CHANGE events are sent, and udevadm info tells me that both the encrypted device and the mapped device is tagged with :systemd:. Interestingly, the mapped device had SYSTEMD_READY=0 set according to udevadm info, probably because ID_PART_TABLE_TYPE and ID_FS_USAGE is missing. Adding a specific udev rule matching this device and setting SYSTEMD_READY=1 (and verifying with udevadm info) did not help.
>
> This is the udevadm monitor output when running "systemctl start system-cryptsetup at mmcblk0p1.service<mailto:system-cryptsetup at mmcblk0p1.service>"
>
>
> KERNEL[1109702.593010] add /devices/virtual/bdi/253:2 (bdi)
>
> KERNEL[1109702.593175] add /devices/virtual/block/dm-2 (block)
>
> KERNEL[1109702.593314] change /devices/platform/e0000000.n_ahb/e0004000.sdmmc0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1 (block)
>
> KERNEL[1109702.593440] change /devices/virtual/block/dm-2 (block)
>
> UDEV [1109702.603430] add /devices/virtual/bdi/253:2 (bdi)
>
> UDEV [1109702.606624] add /devices/virtual/block/dm-2 (block)
>
> UDEV [1109702.616340] change /devices/virtual/block/dm-2 (block)
>
> UDEV [1109702.622257] change /devices/platform/e0000000.n_ahb/e0004000.sdmmc0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1 (block)
>
>
> On my host system, I have noticed that some udev rules stemming from
> LVM2 mention device mapper, do we need to also install LVM2 to make
> device mapping work? In that case do we need the whole LVM2 or only
> some subset? I have tried various combinations of these rules on my
> product but nothing seems to solve the issue.
No, you do not need LVM for LUKS. You do need libdevmapper (i.e. DM
userspace) for it though, because libcryptsetup needs that.
This is typically an integration issue with your distro. Please ping
them.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list