Re: device-mapper: reload ioctl ... failed: No such file or directory

"David J Iannucci" <[email protected]> Sat, 02 Nov 2024 16:53:43 -0600
Newsgroups dev.linux.lists.cryptsetup
Message-ID <[email protected]>
On Wed, Oct 30, 2024, at 01:10, Milan Broz wrote:
>> I'm using cryptsetup 2.7.5 on Gentoo to try to open an old TrueCrypt
>> volume that I haven't looked at in at least a few years. Yes, I have
>> the passphrase :=)  Below is a trace of what's happening. Without --
>> debug, all I see is the error message:
>> 
>>    device-mapper: reload ioctl on coreswp (254:0) failed: No such file or directory
>> 
>> Any help in figuring this out would be much appreciated.
>
> The log shows, that TrueCrypt part works, you have correct password.
> The issue is only in the last step - activation through kernel dm-crypt.

Thank you for the response. I have tried again after copying the TC file
to local (SSD) disk per your suggestion (I had been accessing it on an
external spinning USB HDD before), and also adding --readonly.
The same error occurs.

It seems I do have dm-crypt:
# lsmod | grep crypt
dm_crypt               49152  0
dm_mod                139264  1 dm_crypt


> I expect that you have device-mapper udev rules properly installed.

I'm not sure - how can I check this? This is a fairly bare-bones Gentoo
install and I'm not a big expert on everything that I should be, so that
might have slipped through the cracks.

But...! I just found something... it seems I am running a systemd-udevd,
which would not have been my choice... I have taken steps to keep
systemd completely off my machine, so this is a surprise. Will consult
Gentoo forums about this.

> Is there anything in syslog?

This is what comes out in /var/log/messages:

Nov  2 16:31:36 linux kernel: loop0: detected capacity change from 0 to 209715200
Nov  2 16:31:36 linux kernel: device-mapper: table: 254:0: crypt: Error allocating crypto tfm
Nov  2 16:31:36 linux kernel: device-mapper: ioctl: error adding target to table


> Where it is mounted? (/mnt path) - some remote nfs/samba?

As mentioned, it was on external drive, but now in my home dir.

Thanks again,
Dave

p.s. I note that simple reply on this list goes only to the sender
     rather than back to the list, which is maybe the way the list
     prefers it? Though in my experience most tech lists like to keep
     this kind of discussion on the list so that more eyes are on
     things, and solutions are documented, but if that's not the case
     here, kindly let me know and I'll use simple reply to individuals
     from now on.


> Could you try to copy the container to local fs and open it from there?
> Also, try to open it read-only (-r flag).
> (There were some issues with detecting direct-io, this tries to avoid them.)
>
> Thanks,
> Milan
> ...
>
>> # Device-mapper backend running with UDEV support enabled.
>> # dm status coreswp  [ opencount noflush ]   [16384] (*1)
>> # Allocating a free loop device (block size: 512).
>> # Trying to open and read device /dev/loop0 with direct-io.
>> # Direct-io is supported and works.
>> # Attached loop device block size is 512 bytes.
>> # Calculated device size is 209714688 sectors (RW), offset 256.
>> # Trying to activate TCRYPT device coreswp using cipher aes-xts-plain64.
>> # DM-UUID is CRYPT-TCRYPT-coreswp
>> # Udev cookie 0xd4dfe53 (semid 65598) created
>> # Udev cookie 0xd4dfe53 (semid 65598) incremented to 1
>> # Udev cookie 0xd4dfe53 (semid 65598) incremented to 2
>> # Udev cookie 0xd4dfe53 (semid 65598) assigned to CREATE task(0) with flags DISABLE_LIBRARY_FALLBACK         (0x20)
>> # dm create coreswp CRYPT-TCRYPT-coreswp [ opencount flush ]   [16384] (*1)
>> # dm reload   (254:0) [ opencount flush securedata ]   [16384] (*1)
>> device-mapper: reload ioctl on coreswp (254:0) failed: No such file or directory
>> # Udev cookie 0xd4dfe53 (semid 65598) decremented to 1
>> # Udev cookie 0xd4dfe53 (semid 65598) incremented to 2
>> # Udev cookie 0xd4dfe53 (semid 65598) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK       (0x20)
>> # dm remove coreswp  [ opencount flush securedata ]   [16384] (*1)
>> # Uevent not generated! Calling udev_complete internally to avoid process lock-up.
>> # Udev cookie 0xd4dfe53 (semid 65598) decremented to 1
>> # DM create task failed, dm_task errno: 0.
>> # dm versions   [ opencount flush ]   [16384] (*1)
>> # dm status coreswp  [ opencount noflush ]   [16384] (*1)
>> # Device status returned -19.
>> # Data device /mnt/disk1/core.swp is OK.
>> # No referenced device missing, some device in use.
>> # Udev cookie 0xd4dfe53 (semid 65598) decremented to 0
>> # Udev cookie 0xd4dfe53 (semid 65598) waiting for zero
>> # Udev cookie 0xd4dfe53 (semid 65598) destroyed
>> # Releasing crypt device /mnt/disk1/core.swp context.
>> # Releasing device-mapper backend.
>> # Closing read only fd for /mnt/disk1/core.swp.
>> # Closed loop /dev/loop0 (/mnt/disk1/core.swp).
>> Command failed with code -5 (device already exists or device is busy).
>> 
>> ----end----
>>