0

I have a computer with Xubuntu 16.04. I want to create an encrypted data partition with LUKS. I started following this tutorial (which is for Ubuntu 16.10) but have encountered problems :

  • The command to encrypt the partition seemed to work fine showing no error : sudo cryptsetup luksFormat /dev/sdb1
  • But GParted showed me afterwards a warning sign saying that LUKS is not taken in charge ! And when I tried to open the encrypted partition ( sudo cryptsetup luksOpen /dev/sdb1/ crypthome ) it returns an error, saying that the device does not exist - to which GParted and lsblk don't agree - or that its access is forbidden.

Any idea what is wrong ?

7
  • perhaps /crypthome does not exist?
    – pim
    Oct 31, 2017 at 10:58
  • From what I see in tutorials, it does not need to exist when you issue the command. Besides, the error refers to the partition not existing or being not accessible, not the folder. Oct 31, 2017 at 14:47
  • Ah! I missed something! /cryptohome is a name, not a folder, you probably can't use a name with a /
    – pim
    Oct 31, 2017 at 14:51
  • Actually, if you copy-paste the command into a text editor, you'll see that it's not '/cryptohome' but 'crypthome' and that the '/' belongs to "/dev/sdb1/ ". Nov 1, 2017 at 20:10
  • It's worse! /dev/sdb1 should have no /!
    – pim
    Nov 2, 2017 at 6:10

1 Answer 1

0

The gparted software included in ubuntu 16.04 does not support luks, and I find the tutorial you followed a little bit misleading (it talks about mounting the partition before creating the filesystem).

Here is a procedure I just tested on 16.04 (my partition is /dev/vda1, you will need to replace this name on your computer):

  • Create a partition, you can do it using cfdisk, fdisk, ... If you need to resize of move it, gparted can be used too.

  • Encrypt the partition with sudo cryptsetup luksFormat /dev/vda1, it will ask you to confirm with a capital YES, and ask you to enter your passphrase twice.

  • Enable you partition with sudo cryptsetup luksOpen /dev/vda1 crypthome. Your problem was caused by putting a / at the end of /dev/vda1.

  • Format your partition with sudo mkfs.ext4 /dev/mapper/crypthome

  • Create a mount point with sudo mkdir /mnt/crypthome

  • Mount the filesystem with sudo mount /dev/mapper/crypthome /mnt/crypthome

  • Fix the permissions for the current user : sudo chown $USER:users /mnt/crypthome -R

And that's it.

Then unmounting can be done like this:

sudo umount /dev/mapper/crypthome
sudo cryptsetup luksClose /dev/vda1

And mounting:

sudo cryptsetup luksOpen /dev/vda1
sudo umount /dev/mapper/crypthome
2
  • That is also what I found, but thanks for confirming and summarizing it ! Nov 2, 2017 at 9:53
  • And I may also suggest sudo chown $USER:users /mnt/crypthome -R instead to that the group of the mounting folder is 'users' instead of 'root'. Nov 2, 2017 at 10:06

You must log in to answer this question.

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