I installed Ubuntu 11.10 with the alternate CD and encrypted the whole system (except boot) with the encrypted LVM. Update 2020: Encrypted LVM can be selected at the Installation type step of the Ubuntu install, click on Advanced features and choose Use LVM and Encrypt ...
Everything works great as before, but I would like to change the password of the encrypted LVM. I tried to follow the Tips and Tricks of this article, but it does not work. After typing:
sudo cryptsetup luksDump /dev/sda5
It says: "Device /dev/sd5 doesn't exist or access denied." I thought the encrypted partition is /dev/sda5. Any help how to change the password?
Using the Disks application:
In Ubuntu 18.04 or newer there is the possibility of using (Gnome) Disks. Thanks for the hint, Greg Lever, after clicking around I found what Greg mentioned:
If you get an error, close GNOME Disks and open it in a terminal:
sudo gnome-disks
(This helped @ScriptAutomate, thank you for the tip.)
Or using the command-line:
Here is the answer that worked for me, after Hamish helped me to realize my typo.
WARNING (for older Ubuntu versions, newer (e.g. 19.04) should be bug-fixed but be careful anyway): If you only have one key and remove it before adding another, you will render your disk inaccessible after rebooting! This also means you can not add a new key anymore afterwards. Thanks waffl and khaimovmr for these helpful comments.
First, you need to find out which is the encrypted LVM partition, it may be sda3, but it can also be sda5 (default on Ubuntu LVM), sdX2, ...:
To add a new password, use
luksAddKey
:To remove an existing password, use
luksRemoveKey
, by typing the passphrase to remove:View currently used slots of the encrypted partition (make sure at least one slot is shown):
Cited from this blog. Thanks.
Be aware: Flimm experienced that Ubuntu's system keyboard layout changed from Dvorak to Qwerty. You cannot see which keyboard layout you are using (bug #1862656) and you cannot choose to display the password (bug #1862654). Also, you only get three tries before being forced to wait for 60 seconds (bug #1862660). Thanks flimm for the helpful comment!
Download "Disks" from Software Manager. Run it. Select your encrypted device partition. Click gear icon. Select "Change passphrase". That's it
To see the slots used:
And to find out which partition to use
And if it is listed by uuid, use
Then use
or
and for faster reference (assuming only 1 entry in /etc/crypttab)
Without thinking I set the passphrase to be really long, and it became a pain to type. I ended up using the following to change it to something more manageable.
The encrypted partition may well be using
/dev/sda5
(note the a in sda5) and that is the device you probably need to use (unless that is just a typo in your question).However the encrypted device itself will have another name - something like
/dev/mapper/cryptroot
. For the device name you could:/etc/crypttab
- this will have both the partition and the mapper name in it, but only for permanent partitionsmount
and see what the mapper name is - this is useful when you have plugged in an encrypted disk via USB. (Though I'm not sure how you then find the actual underlying device name).On Ubuntu 18.04 run
gnome-disks
and you can point and click to change the passphrase for the encryption.I had issues locating partition name, so created this guide:
Locate your LMV partition
Check LVM partition meta by dumping it
Add new key (you can have multiple keys)
After dumping it again, you should see multiple keys
Delete old key if desired