Trying to mount encrypted file system failing

2

I had created an encrypted file system using the following commands:

# dd if=/dev/zero of=/opt/vol
# losetup -e aes /dev/loop0 /opt/vol
Password:
# mkfs.ext4 /dev/loop0

The above device was mounted as follows:

# mount -t ext4 -o loop -o rw -o encryption=aes /opt/vol /mnt/enc
Password:
# 

I used to store data in the mounted location (/mnt/enc). Recently I re-installed my OS. So, before that, I backed up the /opt/vol file elsewhere. After re-installing ubuntu 15.10, I copied the file back to the same location (/opt/vol). Then I tried remounting the same file in ubuntu 15.10 and noticed the below error:

# losetup_e -e aes /dev/loop0 /opt/vol
Password:
# mount_e -t ext4 -o loop -o rw -o encryption=aes /opt/vol /mnt/enc
lt-mount: wrong fs type, bad option, bad superblock on /dev/loop1,
   missing codepage or helper program, or other error
   In some cases useful info is found in syslog - try
   dmesg | tail or so
# dmesg | tail
[   81.215500] EXT4-fs (loop1): VFS: Can't find ext4 filesystem
[  235.538008] EXT4-fs (loop1): VFS: Can't find ext4 filesystem
[  348.594842] EXT4-fs (loop1): VFS: Can't find ext4 filesystem
#

I had to re-compile util-linux from source (version 2.22), as I found that '-e' option was not supported from util-linux-2.23 onwards as mentioned here. Hence after compiling, I linked the util-linux-2.22 losetup and mount binaries to losetup_e and mount_e respectively.

Bharath Kanakasabha

Posted 2015-11-09T02:33:46.120

Reputation: 21

Answers

0

I have not come across this way of doing things, and I'm unable to reproduce how you tried to mount it (I use Ubuntu 14.04 LTS), however I believe I have a solution - this worked for me.

Instead of trying to mount the raw device, mount the loopback device, so to mount it:

losetup -e aes /dev/loop0 /opt/vol
mount /dev/loop0 /mnt/enc

I never knew that losetup could directly handle an encrypted device before - thats pretty cool, and would seem to add an amount of plausible deniability as the losetup command doesn't fail on wrong password - it just does not let you mount the filesystem as its scrambled if the password is wrong !

davidgo

Posted 2015-11-09T02:33:46.120

Reputation: 49 152

Thanks @davidgo. Tried doing as you mentioned. The same error is returned "Can't find ext4 filesystem". However it is weird that it is reporting the error for loop1, instead of loop0, even though I mounted loop0. Following is the error: [ 2038.299368] EXT4-fs (loop1): VFS: Can't find ext4 filesystem – Bharath Kanakasabha – 2015-11-09T05:49:38.807

Wait, it might be possible that I have corrupted the raw volume by mounting using earlier command. Will copy the volume again and update the results of mounting /dev/loop0 – Bharath Kanakasabha – 2015-11-09T05:54:52.913

Nope. Same error again – Bharath Kanakasabha – 2015-11-09T06:04:07.403

Similar looking issue: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/919736

– Bharath Kanakasabha – 2015-11-09T06:14:12.100