How to salvage a lvm/luks install from custom install

dm-cryptluks

I was battling with setting up a Mint install on an encrypted hard-drive, and I think I partially succeeded. But I cannot boot the system because some configuration is not correct. I have no idea how to fix it now.

The rough guidelines I followed was along the lines of http://blog.andreas-haerter.com/2011/06/18/ubuntu-full-disk-encryption-lvm-luks.sh

The differences are that I partitioned with GParted. I'm also dual-booting with Windows, and I'm not using extra partition for /home.

  • vg is on extended partition /dev/sda4, within logical partition
    /dev/sda5

  • /boot in on primary partition /dev/sda3

  • bootloader is on /dev/sda

The install went good, I can mount the file-system as in script, from live DVD, but the script in chroot part failed, and the system doesn't boot…

Can anyone tell me what do I have to do to allow boot to mount the encrypted partition?

Is it enough to edit fstab and crypttab only? They seem to reside on the encrypted partition, so not readable by boot…

If it's enough, what they should look like? Everything seems very confusing, and I cannot find a good source I could read about the problem…

UPDATES:

fdisk -l /dev/sda

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   209715199   104754176    7  HPFS/NTFS/exFAT
/dev/sda3       209715200   210763775      524288   83  Linux
/dev/sda4       210763776   625141759   207188992    5  Extended
/dev/sda5       210765824   567281663   178257920   83  Linux
/dev/sda6       567283712   625141759    28929024    7  HPFS/NTFS/exFAT

pvs

PV         VG   Fmt  Attr PSize   PFree
/dev/dm-0  mint lvm2 a-   170.00g    0 

pvscan

PV /dev/dm-0   VG mint   lvm2 [170.00 GiB / 0    free]
Total: 1 [170.00 GiB] / in use: 1 [170.00 GiB] / in no VG: 0 [0   ]

vgscan

Reading all physical volumes.  This may take a while...
Found volume group "mint" using metadata type lvm2

vgs

VG   #PV #LV #SN Attr   VSize   VFree
mint   1   2   0 wz--n- 170.00g    0 

mount /dev/mapper/mint-root /mnt +
cat /mnt/etc/fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/mint-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda3 during installation
UUID={uuidhre} /boot           ext4    defaults        0       2
/dev/mapper/mint-swap none            swap    sw              0       0

cat /mnt/etc/crypttab – manually edited

# <target name> <source device>     <key file>  <options>
lvm_crypt /dev/sda5 none luks

The tutorial for the reference in readable format: http://blog.andreas-haerter.com/2011/06/18/ubuntu-full-disk-encryption-lvm-luks

SOLUTION:

The post install update doesn't work in tutorial. You have to create the crypttab file manually, or fix it up before calling initramfs.

I called everything except intitramfs, opened the /mnt/etc/crypttab with nano, patched the file, and then called chroot with initramfs only. Everything worked smoothly this way.

Best Answer

There's a evident wrong configuration:

lvm_crypt /dev/sda5 none luks

You decrypted the volume and named it lvm_crypt while mounting /dev/mapper/mint-root

Were you asked to input the password during boot ?

Also, did you updated initramfs afterwards ? Because this crypttab need to be embedded since it's for root partition.

EDIT

mint_root /dev/sda5 none luks

And chroot inside, do update-initramfs -u will fix it.

Related Question