Score:0

How do I programmatically mount zfs at boot?

pk flag

I encrypted my hard drive with zfs, running ubuntu 22.04.

I'm an idiot and forgot my password. However, I'm pretty confident that it is contained in a list of ~300 passwords that I know.

When I boot, I see a field to enter password, with text under it saying "Please unlock disk keystore-rpool"

Problem is, I only get 3 attempts at the password before the maximum number of attempts is reached. After I fail 3 times, I see a terminal with the error:

command: mount -o zfsutil -t zfs rpool/ROOT/ubuntu_{redacted} /root//
message: zfs_mount_at() failed: encryption key not loadedzfs_mount_at() failed: encryption key not loadedmount: mounting rpool/ROOT/ubuntu_{redacted} on /root// failed: Permission denied
Error: 2

Failed to mount rpool/ROOT/ubuntu_{redacted} on /root//.
Manually mount the filesystem and exit

And the user in the terminal is (initramfs).

When I try to run the zfs_mount_at() failed: encryption key not loaded command in this terminal, I immediately get the following same error as in the message above.

At this point I get stuck and am forced to hard reboot.

My question is: can I write a script to programmatically try 3 passwords from the list, wait until I can try again (not sure how to set the wait part up, currently I have to manually hard reboot), and try the next 3, until the password succeeds?

Any help would be greatly appreciated here, the hard drive is pretty important, and I learned this lesson the hard way.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.