# [SOLVED] DM-CRYPT "reload ioctl failed: No such file"

## ial

After recent system update (emerge -vuDN world, and also the newest kernel) I had many issues, one by one resolving now. The next one is since yesterday I can't access my encrypted partition. 

Please take a look:

```
# cryptsetup --verbose  create MyName /dev/sda12

Enter passphrase: 

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

Command failed with code 22: Invalid argument
```

Here is what logger says:

```
Jan 11 09:38:08 Ths kernel: device-mapper: table: 254:0: crypt: Error creating IV

Jan 11 09:38:08 Ths kernel: device-mapper: ioctl: error adding target to table
```

Please, help!Last edited by ial on Tue Jan 11, 2011 10:31 am; edited 1 time in total

----------

## ial

I tried to downgrade cryptsetup (from 1.1 to 1.0) but I can not compile the lower version sys-fs/cryptsetup-1.0.6-r2, while the newest one 1.1.3-r1 compiles without any problem. 

Please take a look into compilation errors and try to suggest the solution:

```
 x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../luks -DDATADIR=\"/usr/share\" -DLIBDIR=\"/usr/lib64\" -DPREFIX=\"/usr\" -DSYSCONFDIR=\"/etc\" -DVERSION=\"1.0.6\" -D_GNU_SOURCE 

-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILTIN_LIBDEVMAPPER -DBUILTIN_GCRYPT -march=nocona -O2 -pipe -MT gcrypt.lo -MD -MP -MF .deps/gcrypt.Tpo -c gcrypt.c  -fPIC -DPIC -o .libs/gcrypt.o

 x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../luks -DDATADIR=\"/usr/share\" -DLIBDIR=\"/usr/lib64\" -DPREFIX=\"/usr\" -DSYSCONFDIR=\"/etc\" -DVERSION=\"1.0.6\" -D_GNU_SOURCE 

-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILTIN_LIBDEVMAPPER -DBUILTIN_GCRYPT -march=nocona -O2 -pipe -MT libdevmapper.lo -MD -MP -MF .deps/libdevmapper.Tpo -c libdevmapper.c -o libdevmapper.o 

>/dev/null 2>&1

 x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../luks -DDATADIR=\"/usr/share\" -DLIBDIR=\"/usr/lib64\" -DPREFIX=\"/usr\" -DSYSCONFDIR=\"/etc\" -DVERSION=\"1.0.6\" -D_GNU_SOURCE 

-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILTIN_LIBDEVMAPPER -DBUILTIN_GCRYPT -march=nocona -O2 -pipe -MT gcrypt.lo -MD -MP -MF .deps/gcrypt.Tpo -c gcrypt.c -o gcrypt.o >/dev/null 2>&1

/bin/sh ../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc  -march=nocona -O2 -pipe  -Wl,-O1 -Wl,--as-needed -o libcryptsetup.la -rpath /usr/lib64  setup.lo utils.lo backends.lo libdevmapper.lo 

gcrypt.lo -ldevmapper  -L/usr/lib64 -lgcrypt -lgpg-error -luuid ../luks/libluks.la

x86_64-pc-linux-gnu-gcc -shared  .libs/setup.o .libs/utils.o .libs/backends.o .libs/libdevmapper.o .libs/gcrypt.o -Wl,--whole-archive ../luks/.libs/libluks.a -Wl,--no-whole-archive  -ldevmapper 

-L/usr/lib64 /usr/lib64/libgcrypt.so /usr/lib64/libgpg-error.so -luuid  -march=nocona -Wl,-O1 -Wl,--as-needed -Wl,-soname -Wl,libcryptsetup.so.0 -o .libs/libcryptsetup.so.0.0.0

(cd .libs && rm -f libcryptsetup.so.0 && ln -s libcryptsetup.so.0.0.0 libcryptsetup.so.0)

(cd .libs && rm -f libcryptsetup.so && ln -s libcryptsetup.so.0.0.0 libcryptsetup.so)

rm -fr .libs/libcryptsetup.lax

mkdir .libs/libcryptsetup.lax

rm -fr .libs/libcryptsetup.lax/libluks.a

mkdir .libs/libcryptsetup.lax/libluks.a

(cd .libs/libcryptsetup.lax/libluks.a && x86_64-pc-linux-gnu-ar x /var/tmp/portage/sys-fs/cryptsetup-1.0.6-r2/work/cryptsetup-1.0.6/lib/../luks/.libs/libluks.a)

x86_64-pc-linux-gnu-ar cru .libs/libcryptsetup.a  setup.o utils.o backends.o libdevmapper.o gcrypt.o  .libs/libcryptsetup.lax/libluks.a/libluks_la-af.o .libs/libcryptsetup.lax/libluks.a/libluks_la-pbkdf.o 

.libs/libcryptsetup.lax/libluks.a/libluks_la-keymanage.o .libs/libcryptsetup.lax/libluks.a/libluks_la-keyencryption.o .libs/libcryptsetup.lax/libluks.a/libluks_la-hexprint.o 

.libs/libcryptsetup.lax/libluks.a/libluks_la-random.o .libs/libcryptsetup.lax/libluks.a/libluks_la-sha1.o .libs/libcryptsetup.lax/libluks.a/libluks_la-hmac_sha1.o

x86_64-pc-linux-gnu-ranlib .libs/libcryptsetup.a

rm -fr .libs/libcryptsetup.lax

creating libcryptsetup.la

(cd .libs && rm -f libcryptsetup.la && ln -s ../libcryptsetup.la libcryptsetup.la)

make[2]: Leaving directory `/var/tmp/portage/sys-fs/cryptsetup-1.0.6-r2/work/cryptsetup-1.0.6/lib'

Making all in src

make[2]: Entering directory `/var/tmp/portage/sys-fs/cryptsetup-1.0.6-r2/work/cryptsetup-1.0.6/src'

if x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -DDATADIR=\""/usr/share"\" -DLOCALEDIR=\""/usr/share/locale"\" -DLIBDIR=\""/usr/lib64"\" -DPREFIX=\""/usr"\" -DSYSCONFDIR=\""/etc"\" 

-DVERSION=\""1.0.6"\" -D_GNU_SOURCE    -march=nocona -O2 -pipe -MT cryptsetup.o -MD -MP -MF ".deps/cryptsetup.Tpo" -c -o cryptsetup.o cryptsetup.c; \

        then mv -f ".deps/cryptsetup.Tpo" ".deps/cryptsetup.Po"; else rm -f ".deps/cryptsetup.Tpo"; exit 1; fi

/bin/sh ../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc  -march=nocona -O2 -pipe  -Wl,-O1 -Wl,--as-needed -o cryptsetup -all-static  cryptsetup.o -lpopt ../lib/libcryptsetup.la

mkdir .libs

x86_64-pc-linux-gnu-gcc -march=nocona -O2 -pipe -Wl,-O1 -Wl,--as-needed -o cryptsetup -static cryptsetup.o  /usr/lib64/libpopt.a ../lib/.libs/libcryptsetup.a -ldevmapper -L/usr/lib64 /usr/lib64/libgcrypt.a 

/usr/lib64/libgpg-error.a -luuid

/usr/lib64/libdevmapper.a(libdm-common.o): In function `_check_udev_is_running':

(.text+0xe84): undefined reference to `udev_new'

/usr/lib64/libdevmapper.a(libdm-common.o): In function `_check_udev_is_running':

(.text+0xe98): undefined reference to `udev_queue_new'

/usr/lib64/libdevmapper.a(libdm-common.o): In function `_check_udev_is_running':

(.text+0xeac): undefined reference to `udev_queue_get_udev_is_active'

/usr/lib64/libdevmapper.a(libdm-common.o): In function `_check_udev_is_running':

(.text+0xebb): undefined reference to `udev_queue_unref'

/usr/lib64/libdevmapper.a(libdm-common.o): In function `_check_udev_is_running':

(.text+0xec3): undefined reference to `udev_unref'

/usr/lib64/libdevmapper.a(libdm-common.o): In function `_check_udev_is_running':

(.text+0xfc4): undefined reference to `udev_unref'

collect2: ld returned 1 exit status

make[2]: *** [cryptsetup] Error 1

make[2]: Leaving directory `/var/tmp/portage/sys-fs/cryptsetup-1.0.6-r2/work/cryptsetup-1.0.6/src'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/var/tmp/portage/sys-fs/cryptsetup-1.0.6-r2/work/cryptsetup-1.0.6'

make: *** [all] Error 2

emake failed

 * ERROR: sys-fs/cryptsetup-1.0.6-r2 failed:

 *   (no error message)

 *

 * Call stack:

 *     ebuild.sh, line  56:  Called src_compile

 *   environment, line 3556:  Called die

 * The specific snippet of code:

 *       emake || die

 *

```

----------

## ial

I have already found the solution:

http://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions#7._Issues_with_Specific_Versions_of_cryptsetup

"If you are using a plain device and you need a compatible mode, just specify cipher, key size and hash algorithm explicitly. For compatibility with cryptsetup 1.0.x defaults, simple use the following:

cryptsetup create -c aes-cbc-plain -s 256 -h ripemd160 <name> <dev>"

----------

