My laptop has an encrypted disk. After an apt upgrade
and some hours later a force shutdown my passphrase doesn’t decrypt my disk anymore.
I booted from a debian live usb stick and tried several things:
- Can I decrypt the partition with my passphrase from the live os?
Answer: No. - Is it a problem with the keyboard layout?
Answer: No. - Is the partition still an encrypted one?
Answer: Yes it is and there is still one keyslot. - Is there a problem visible when looking at hexdump output?
Answer: No. - Is there maybe a problem visibile when looking at the hexdump configuration output?
Answer: Apart from the fact that a few blog posts say that everything above 1000 should be random characters: No.
I have no backup of my LUKS headers. My passphrase worked for over one year. How can I access or rescue my data?
Thanks in advance,
Luke
3
Answers
Maybe too much time is gone by since you ask your question but:
This shouldn’t be a problem. I had to do that a lot on different devices. Yes, there is still a small possibility that this could damage something but LUKS is very robust.
Yes, that is definitely possible! Done it myself several times.
Possible. Write your passphrase in the terminal window to check if it is your password and then use the cryptsetup command. And rethink the possibility that you encrypted your drive with another layout. Try to remember how you encrypted it – during a fresh system install; on your working system over the terminal; with a tool; etc. .
This quote is from Gitlab cryptsetup.
Yes it is. Make sure you use an up to date live cd with luks version2.
Doesn’t look like you need a backup of the LUKS header.
EDIT: Some additional ideas:
How did you do the encryption? Is it a special partition like /home?
during the system install then you normally open your partition by
your user password. But that is not the real passphrase for that
partition because there will be a keyfile for opening your partition.
That file is defined in /etc/crypttab.
This quote is also from Gitlab cryptsetup. Maybe you find more needed infos there.
You can try to create a new
master key
for your luks containerThis will create a new passphrase for unlocking luks container and if this works then you can remove the previous passphrase and continue using it.
Most likely you’ve mistyped your password, as I had similar issue and blamed upgrade as well.
You can dump the header and try to brutal force it.
Following steps can help.
Confirm you’ve the right device:
Validate the header:
Try initial few passwords (consider adding
--debug
for more output):Or:
tcryptDump
, but shouldn’t make any difference.Consider to backup the header:
Alternatively run (replace count with Payload offset found in header dump):
You can also consider to backup the whole device using
dd
.Use header file to try different passwords: (quicker than using the actual device)
Brutal force
Having a small header file (as per above steps), you can try to brutal force it.
Assuming you know your original password, create the list of your potential password and their permutations in
passes.txt
(make the list unique bysort -ou passes.txt
).In shell, you can use the following script to try these combinations:
Notes:
--key-slot 0
for quicker checks.--pbkdf-force-iterations
(check how many there are in the header dump), but most likely it won’t help.Live CD
If you think that happened due to upgrade, use different Ubuntu Live CDs to use the above commands (Ubuntu 16, 18, 20 and so on).
Either boot from USB/CD, or install VM VirtualBox (Create Ubuntu VM, then load the ISO to boot from it).
To attach the physical device to VM VirtualBox (not recommended):
.iso
file.VBoxManage internalcommands createrawvmdk
command to create.vmdk
files pointing to the real device. Attach these.vmdk
into the VM (before starting it).VirtualBoxVM
as root (also not recommended).Final steps, copy the header file then test passphrases using older version of
cryptsetup
(cryptsetup --version
).Mounting
Once success, use these commands to mount the filesystem:
Other useful commands: