Bug 261543

Summary: [ZFS] file in encrypted dataset disappears on first reboot
Product: Base System Reporter: Taceant Omnes <taceant>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Not A Bug    
Severity: Affects Only Me    
Priority: ---    
Version: 13.0-RELEASE   
Hardware: amd64   
OS: Any   

Description Taceant Omnes 2022-01-29 02:24:54 UTC
A file in encrypted dataset disappears after first reboot.

How to reproduce:
1. Create an encrypted dataset like so (after creating a file with a passphrase)
zfs create -o encryption=on -o keyformat=passphrase -o keylocation=file:///root/pass zroot/enc
2. Create file in encrypted dataset, for example like so
cat > /zroot/enc/testfile
3. Reboot
4. Look for testfile, it has disappeared.


# freebsd-version
13.0-RELEASE-p6

I can reproduce this every time I try.

Further remarks:
- The issue does not manifest if the dataset is not encrypted. I have not tested other types of encryption so don't know if it manifests or not.
- The issue happens only on the first reboot after creating the dataset. In other words, if I create a file after the first reboot and reboot again, the file does not disappear.
- The issue manifests also in a FreeBSD VirtualBox guest running on Archlinux host.
- The issue does not manifests in a Xubuntu 21.10 VirtualBox guest running on Archlinux  host. This suggests that the issue is in the FreeBSD kernel and not in the part of the ZFS code that is shared with Linux.
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2022-01-29 09:40:10 UTC
There must be some trivial explanation for this.
Like the dataset not getting mounted after it's created or after a reboot, etc.
Please check such basic things and follow up.
Comment 2 Taceant Omnes 2022-01-29 10:06:21 UTC
(In reply to Andriy Gapon from comment #1)

Thanks for your feedback. I asked for help in the Questions mailing list.
Comment 3 Taceant Omnes 2022-01-29 13:09:28 UTC
Got answers in the mailing list. It is not a bug. There is a difference between Xubuntu and FreeBSD in what respects auto-mounting of encrypted sets at startup, but that is a different subject. I will try to close this issue now.