Summary: | sys-kernel/genkernel-4.2.5: Decrypting crypt_root before crypt_swap will corrupt zfs/zpools | ||
---|---|---|---|
Product: | Gentoo Hosted Projects | Reporter: | Daniel Morlock <info> |
Component: | genkernel | Assignee: | Gentoo Genkernel Maintainers <genkernel> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | CC: | gyakovlev, neb.semqen.ramesses, sam |
Priority: | Normal | Keywords: | PATCH |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://github.com/openzfs/zfs/issues/260 | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=918688 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Patches initrd to decrypt swap before decrypting root |
Description
Daniel Morlock
2021-11-25 12:16:37 UTC
Created attachment 756280 [details, diff]
Patches initrd to decrypt swap before decrypting root
I've attached a patch for genkernel i.e. initrd.scripts and linuxrc that tries to decrypt und resume from swap before proceeding with the default order. I don't know what impact this has on other filesystems than zfs and/or other boot operations. So this is just a proposal. I don't speak for genkernel, leaving that for maintainer. But I will just note that hibernating with zfs is unsupported, discouraged and will eventually lead to data loss. Following a zfs maintainer, hibernation with zfs should be fine as long as the zfs kthreads can be frozen during the hibernation process i.e. the hibernate image should be stored to a swap partition/file that is outside the zfs filesystem. This is not 100% bullet-proofed but there is no reason why zfs should not work with hibernation. On nasty trap is the double-importing of a zpool which can immediately corrupt a zpool without a chance for recovery. And the genkernel initrd.scripts (start_volumes()) will double-import a zpool if using crypt root and crypt swap. I think that the zfs handling in start_volumes() is wrong: start_volumes() should prepare the volumes i.e. for lvm this is done by scanning for lvm volumes. In case of zfs, a "zfs import" is invoked which might already mount some volumes. Since this import happens before a hibernation from a swap can happen, the root zpool will be mounted twice each time. |