18

I have installed an Ubuntu machine with two encrypted LUKS partitions: one for / and one for /home.

I've reinstalled the machine to upgrade to 10.04. Again, the / is installed using LUKS, and I'm able to mount the /home using:

mkdir /media/home
sudo cryptsetup luksOpen /dev/sda2 home
sudo mount -t ext3 /dev/mapper/home /media/home

The problem is, this cryptfs mapper disappears after boot, so I putting the appropriate line in fstab fails.

How do I set the cryptfs to prompt for password and unlock the drive at boot?

Thanks,

Adam

2 Answers 2

17

Seems that I needed to edit the /etc/crypttab file, which is the crypto equivalent to fstab, and add the following line:

# create a /dev/mapper device for the encrypted drive
home    /dev/sda2       none luks

And add the following to /etc/fstab:

# /home LUKS
/dev/mapper/home /home ext4 rw 0 0

Now I get two password prompts at boot, as needed.

3
  • 4
    you would also have to update the initramfs image with update-initramfs for this change to take effect.
    – dward
    Mar 17, 2013 at 7:10
  • Is this still applicable for Ubuntu 20.04? Jul 9, 2020 at 1:12
  • Answering my own (immediately above) question: our initial tests show that it (this answer) does still apply and work on 20.04. Jul 9, 2020 at 9:42
-3

I had the same problem!! However, everything is taken care of after this command! You should try it out :-)

sudo update-initramfs -u -k all
3
  • 6
    Care to explain what that command does?
    – Flimm
    Nov 10, 2011 at 23:42
  • 1
    @Flimm , the command re-create your ramdisk , for all the kernel installed. You might configured crypttab , but this needs to be copied into your ramdisk , if you use a crypted root
    – daisy
    Apr 25, 2012 at 12:00
  • 2
    This answer should include an in-depth explanation, it is not clear that it relates to the question at all.
    – Langston
    Jul 28, 2015 at 3:37

You must log in to answer this question.

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