On Mi, 11.09.24 11:43, Fredrik Hugosson (fredrik.hugosson@xxxxxxxx) wrote: > Hi! > > I'm trying to use the systemd-cryptsetup@.service<mailto:systemd-cryptsetup@.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@.service<mailto:fsck@.service> and mount@.service<mailto:mount@.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@.service<mailto:systemd-cryptsetup@.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@mmcblk0p1.service<mailto:system-cryptsetup@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