veracrypt / VeraCrypt

Disk encryption with strong security based on TrueCrypt
https://www.veracrypt.fr
Other
6.99k stars 955 forks source link

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

Open john-larfour opened 3 years ago

john-larfour commented 3 years ago

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

wvdgoot commented 3 years ago

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
idrassi commented 3 years ago

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.

wvdgoot commented 3 years ago

@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.

john-larfour2 commented 3 years ago

@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

bogorad commented 2 years ago

-m=nokernelcrypto

worked for me, thanks!

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

ghost commented 1 year ago

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

An7ar35 commented 1 year ago

@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.

marek22k commented 7 months ago

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

Moritzer commented 5 months ago

Same issue on Zorin Linux 6.5.0-35 generic Kernel.

NullCode1337 commented 2 months ago

@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.

thank you for this reply. Can confirm this also happens on Arch Linux 6.10.8-zen1-1-zen after an upgrade occurs that needs a restart, all it needs is a reboot to fix veracrypt mounting