Upgrading from loop-aes to cryptsetup

1

Once upon a time, I had an encrypted external disk that I would mount thus:

# losetup -e AES128 /dev/loop1 /dev/sdb1
# fsck /dev/loop1
# mount /dev/loop1 /mnt/wd
# ls /wd

There are those that say that the modern way to do this is:

# apt-get install cryptsetup
# cryptsetup create -c aes -s 128 wd /dev/sdb1
# fsck /dev/mapper/wd
# mount /dev/mapper/wd /mnt/wd

But this doesn't work. Can anyone help?

I suspect it's as simple as AES128 not being quite the same as -c aes -s 128.


To be precise, I'm using Ubuntu 12.04, and the old way still works, but is deprecated and no longer works on Debian or newer Ubuntu. The new way seems to be ok, but the fsck fails:

fsck from util-linux 2.20.1
e2fsck 1.42 (29-Nov-2011)
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/mapper/wd

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device&gt;

If I say

#cryptsetup status wd

then I get:

/dev/mapper/wd is active.
  type:    PLAIN
  cipher:  aes-cbc-plain
  keysize: 128 bits
  device:  /dev/sdb1
  offset:  0 sectors
  size:    3907024002 sectors
  mode:    read/write

I suspect it's something as simple as AES128 not being the same as aes-cbc-plain / 128, but I'm damned if I can find out what it should be instead.

John Lawrence Aspden

Posted 2013-06-21T21:21:57.063

Reputation: 713

Answers

2

For those who landed on this page with the same problem, do the following:

cryptsetup open _path_to_file_or_device_  SOME_NAME  --type plain -c aes -s 128 -h sha256 

mount /dev/mapper/SOME_NAME /media/mount_point/

Example:

cryptsetup open /dev/sdb1 my_enc_disk --type plain -c aes -s 128 -h sha256

mount /dev/mapper/my_enc_disk /media/my_enc_disk

VanagaS

Posted 2013-06-21T21:21:57.063

Reputation: 151