0

I have a linux mint 18 installation with a luks encrypted / and swap partitions. / which is /dev/sda6 unlocks and mounts fine at boot up. The system then goes into emergency mode. journalctl says timeout trying to reach the swap partition.

I tried running cryptsetup open --type luks /dev/sda5 sda5_cryptand that returns Device /dev/sda5 is not a valid LUKS device.

  • 2
    If the swap partition got zotted by a dirty shutdown, you might just have to destroy the swap partition entirely - including the encrypted container - and recreate it. – DopeGhoti Apr 17 '17 at 22:31
1

DopeGhoti is correct.

To confirm a corrupted LUKS header, you can use the following command:

cryptsetup luksDump /dev/sda5

You should get the same error message.

To fix it, re-create the LUKS container, setup the swap again, and take a backup of the LUKS header. Something like this:

cryptsetup luksFormat /dev/sda5
cryptsetup open --type luks /dev/sda5 sda5_crypt
mkswap -L SWAP /dev/mapper/sda5_crypt
swapon -L SWAP
cryptsetup luksHeaderBackup /dev/sda5 --header-backup-file /root/sda5_luks_header.img

The LUKS header is so vulnerable. There's only one copy so when you lose it, there's no way to unlock the device. Unless... you have a backup ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.