On Sat, Jul 20, 2024 at 02:11:41PM +0100, [email protected] wrote:
> Thanks Agustin & Leandro for highlighting this issue, and for finding a
> workaround.
> 
> After some investigation, I think I have narrowed the problem down to
> changes in behaviour of the automatic setup of entries in the /dev/
> filesystem with the newer trixie tooling. It appears that although it
> was safe to assume that cryptmount devices would always be named
> "/dev/mapper/<target_name>", there is a tendency for these to be
> automatically renamed into symlinks of the form
> "/dev/disk/by-id/dm-name-<target_name>". This even appears to occur when
> mke2fs is run on a a device in /dev/mapper/, which subsequently disappears.

Hi,

Thanks for caring of this.

Seems that there are some strange differences between what happens when
plain cryptsetup is used and when is cryptmount what is used. I am not sure
that cryptmount is the only one to blame here, may be has just triggered a
problem somewhere else.

I have been trying to look more carefully at what happens externally in
both cases (for cryptmount, only with flags=nofsck, which should be enough
for a first approach). Results are shared below in the hope they can add
something useful.

Regards,

### ------- The cryptmount way (using flags=nofsck) -------

$ cryptmount LUKS-test

Succeeds, but no  LUKS-test under /dev/mapper.
Device is accesible under mount point /media/luks-testdir

$ find /dev -name '*LUKS-test*'
/dev/disk/by-id/dm-name-LUKS-test

# cryptsetup status LUKS-test
/dev/mapper/LUKS-test is active and is in use.

with no LUKS-test entry under /dev/mapper.

# grep -ri LUKS-test /var/ 2> /dev/null
Relevant line:
/var/log/syslog:2024-07-23T10:26:11.807221+02:00 mybox (udev-worker)[29914]: 
dm-7: Failed to create/update device symlink '/dev/mapper/LUKS-test', ignoring: 
File exists

# find /sys/ -iname '*LUKS-test*'

# grep -ri LUKS-test /sys/ 2> /dev/null
/sys/devices/virtual/block/dm-7/dm/name:LUKS-test

$  cryptmount -u LUKS-test
Target "LUKS-test" does not appear to be mounted

$ mount:
 /dev/mapper/LUKS-test on /media/luks-testdir type ext4 
(rw,relatime,stripe=8191)

# umount /dev/mapper/LUKS-test
succeeds even if /dev/mapper/LUKS-test is not present

# cryptsetup close LUKS-test

OK.

### -------- The cryptsetup way ---------------------------

# cryptsetup open /dev/sdc1  LUKS-test

$ find /dev -name '*LUKS-test*'
/dev/disk/by-id/dm-name-LUKS-test
/dev/disk/by-id/dm-uuid-CRYPT-LUKS1-*******MY-DEVICE-UUID*******-LUKS-test
/dev/mapper/LUKS-test

# cryptsetup status LUKS-test
/dev/mapper/LUKS-test is active.

with LUKS-test entry under /dev/mapper (as previously reported by find).

# find /sys/ -iname '*LUKS-test*'

# grep -ri LUKS-test /sys/ 2> /dev/null
/sys/devices/virtual/block/dm-7/dm/uuid:CRYPT-LUKS1-*******MY-DEVICE-UUID*******-LUKS-test
/sys/devices/virtual/block/dm-7/dm/name:LUKS-test

# mount /dev/mapper/LUKS-test /media/luks-testdir/

mount:
/dev/mapper/LUKS-test on /media/luks-testdir type ext4 (rw,relatime,stripe=8191)

# umount /dev/mapper/LUKS-test

# cryptsetup close LUKS-test

-- 
Agustin

Reply via email to