14

I used the Disk Utility to create an encrypted volume on an external drive. When I click the Unlock Volume button in that program, it mounts the drive for me.

Now, I want to automate this process so that it will happen at boot-up.

When I run sudo cryptsetup luksUUID /dev/sdb1, I get this:
ca709269-1e3e-4e9e-9e08-7248f0e6c5a6

So, I create /etc/crypttab like this:
backup_drive UUID=ca709269-1e3e-4e9e-9e08-7248f0e6c5a6 none

And I added this line to /etc/fstab:
/dev/mapper/backup_drive /mnt/backup ext3 default 0 2

When I reboot, Ubuntu tells me that the device is not available to map, so I tell it to skip it. It appears that the /etc/crypttab is not getting run correctly.

How can I debug this?

2 Answers 2

12

I think you need a fourth parameter there to specify the encryption type.

This is what my /etc/crypttab looks like:

home_crypt /dev/disk/by-uuid/6f13e221-69f0-4f0e-9082-e2e7b32fc1dd /mnt/Keys/home-data luks
swap_crypt /dev/sda3 /dev/urandom swap

The Crypttab manpage says that all four fields are mandatory.

To test your settings, you can use the following commands to start and stop the cryptdisks after you make your changes.

cryptdisks_start
cryptdisks_stop
2
  • Thanks, I misunderstood the man page. Also, I like the use of /dev/disk/by-uuid -- that's easy to understand. Oct 12, 2010 at 23:45
  • 1
    FYI for future travelers, the fourth parameter is no longer mandatory Apr 23, 2014 at 3:01
5

The format for the /etc/crypttab file is:

encrypteddiskname UUID=xxxxxxxxxxxx /etc/keyfilename

To get the UUID of the disk you need to run: blkid /dev/sdb1

Do not use the blkid of the /dev/mapper/encrypteddiskname.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .