@peterwhite23 Thank you for taking the trouble to test! By having the same results as me, you’ve confirmed that I’m not the only one to struggle with this.
Curiously not! I found it somewhere else; I think that it was from Google’s search AI.
But, I’m glad that you pointed it out. I’ve saved the link.
For whatever reason, yesterday I was completely unable to get it working; today, I have managed, partly thanks to your comments!
The process
For future reference, here’s the process. In this case, my data partition (ubuntu-data) is on /dev/sda5.
sudo snap install snap-tpmctl
sudo mkdir /mnt/data
sudo snap-tpmctl mount-volume /dev/sda5 /mnt/data
# Enter the recovery key when prompted. If you forget to use
# "sudo", this will fail but without an error message.
At this point, /dev/sda5 is unlocked but it isn’t mounted! The directory /mnt/data has been utterly spurious despite being required on the command line.
mount | grep -E 'sda5|data' # Nothing found.
So, it remains to mount the unlocked partition.
ls -l /dev/mapper # Discover the unlocked partition's name.
# In my case, it's "dev-sda5".
sudo mount /dev/mapper/dev-sda5 /mnt/data
Finally, the partition has been mounted in /mnt/data.
You can repeat this process for ubuntu-save (in my case, sda4) if required.
Unmounting and locking
According to the documentation, the way to unmount and lock is this:
sudo snap-tpmctl unmount-volume /mnt/data # or, maybe, /dev/sda5
But, it doesn’t work. It returns an error. The correct way:
sudo umount /mnt/data # Unmount the partition.
sudo cryptsetup luksClose /dev/mapper/dev-sda5 # Lock the LUKS partition.
Bugs
It appears that snap-tpmctl has three bugs:
- Locking and mounting is incomplete; it only unlocks, not mounts.
- Unmounting and locking doesn’t work at all.
- It should return a meaningful error message if you try to mount without using
sudo.
Exactly. I’m a seasoned Ubuntu user (since 2008), and I needed plenty of help to figure it out.
I’ll wait for a response by @Actionparsnip or anyone else, and unless I’m corrected, I’ll raise a bug report for this (which I’ll post here once done).