Ubuntu 22.04 on encrypted ZFS and wrong crypttab setup
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubiquity (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
I have installed Ubuntu 22.04 with ZFS and its native encryption (using the official installer, Ubiquity, no hacking at all). And everything was working great!
I decided to add a second NVMe drive, to install Windows on it. And I found a weird Windows behavior, because it was crashing, not booting etc.
The next day I found that my SWAP space is HUGE, more than 200 GB, but should be 2 gigs only.
I have started looking at this weird issue:
root@bzieba-
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 238,5G 0B -2
root@bzieba-
/dev/mapper/
root@bzieba-
cryptoswap /dev/nvme0n1p2 /dev/urandom swap,initramfsr
And here is the issue!
nvme0n1p2 was my Ubuntu NVMe, but now, after adding the second NVMe drive, it's a Windows partition.
Ubuntu started overwriting my Windows data (but I don't care, no worries).
===
Ubuntu uses UUIDs for most FS/partitions:
root@bzieba-
UUID=2CCE-15F1 /boot/efi vfat umask=0022,
root@bzieba-
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 00:00:46 with 0 errors on Sun Jun 12 00:24:49 2022
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
4633606d-
So why it doesn't use UUID for /etc/crypttab and cryptswap device?
===
I found that it comes from Ubiquity, scripts/zsys-setup:
printf "${swap_
Where:
orig_swap_
swap_device=
===
I believe we should fix that and start using PARTUUID for crypttab and cryptswap device because it already exists:
root@bzieba-
5373106c-
root@bzieba-
cryptoswap PARTUUID=
And now SWAP is working on the correct partition:
root@bzieba-
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 2G 0B -2
===
If someone confirm that it needs a fix, I would love to prepare the fix and push it to the repo :)