VeraCrypt icon indicating copy to clipboard operation
VeraCrypt copied to clipboard

device-mapper: reload ioctl on veracrypt1 failed: Invalid argument Command failed

Open john-larfour opened this issue 4 years ago • 12 comments

Hello, I have a a veracrypt container created a few years ago in a Debian machine. Today I tried to open this container in a Ubuntu machine but Veracrypt throw me this error:

device-mapper: reload ioctl on veracrypt1 failed: Invalid argument 
Command failed.

I tried to don't use kernel crypto and the container is mounted but with a corrupted file system.

What could be? is the container corrupted? or I have any change to open it correctly with kernel crypto?

Thanks

john-larfour avatar Oct 14 '21 20:10 john-larfour

I have a similar issue on Arch Linux (5.10.75-1-lts). I just created a Veracrypt volume, and tried to mount it. After giving the password it showed me the error device-mapper: reload on ioctl on veracrypt1 failed: invalid argument Command failed

Output of sudo dmeg:

[556826.084840] device-mapper: table: 254:1: crypt: unknown target type
[556826.084844] device-mapper: ioctl: error adding target to table
[556838.493607] audit: type=1131 audit(1636289072.640:3488): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[556838.901000] audit: type=1334 audit(1636289073.050:3489): prog-id=859 op=UNLOAD
[556838.901016] audit: type=1334 audit(1636289073.050:3490): prog-id=858 op=UNLOAD
[556838.901019] audit: type=1334 audit(1636289073.050:3491): prog-id=857 op=UNLOAD
[556946.245963] device-mapper: table: 254:1: crypt: unknown target type
[556946.245965] device-mapper: ioctl: error adding target to table

wvdgoot avatar Nov 07 '21 11:11 wvdgoot

From what I have seen by searching this error on internet, this device-mapper error is caused by an issue of the dm-crypt kernel module (either missing or buggy). Using cryptsetup with LUKS volume should have the same issue. @john-larfour : I'm not sure why you can't access the content of the volume after disabling kernel-crypto in VeraCrypt. Can you be more specific about the error you are getting? @wvdgoot : can you try using using losetup and cryptsetup to create a LUKS volume backed by a file and see if you have the same error? You can use the information from https://wiki.archlinux.org/index.php?title=Dm-crypt/Encrypting_a_Non-Root_File_System&oldid=302464.

idrassi avatar Nov 07 '21 18:11 idrassi

@idrassi, thanks for your help. Yesterday I checked the available drives with lsblk though, and somehow I picked the wrong drive the first few times. I don't know if it was there the whole time, or that I have done something in the mean time but Veracrypt works now without any problems.

wvdgoot avatar Nov 08 '21 16:11 wvdgoot

@idrassi @john-larfour here. This is the command I use: sudo veracrypt -m=nokernelcrypto /volume /mount Then the volume is mounted correctly but if I type ls /mount This is the output for each folder inside: ls: cannot access 'mount/folder': Structure needs cleaning

If I open the folder I found only a lost+found folder inside

john-larfour2 avatar Nov 11 '21 19:11 john-larfour2

-m=nokernelcrypto

worked for me, thanks!

(using veracrypt command line for ubuntu-20.04 under WSL with Win11-ARM64, ubuntu 22.04)

bogorad avatar Aug 30 '22 22:08 bogorad

@john-larfour @john-larfour2 I'm in the same boat as you, have you managed to fix it?

ghost avatar Dec 15 '22 03:12 ghost

@wvdgoot I sometimes get that issue when I've run an update that requires a restart (kernel usually) and try to mount an encrypted volume after without having rebooted yet. Rebooting clears that for me.

An7ar35 avatar Dec 16 '22 13:12 An7ar35

Same issue on Arch Linux and 6.6.26-1-lts kernel.

marek22k avatar Apr 14 '24 10:04 marek22k