openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.69k stars 1.75k forks source link

dracut requiring the zfs module to be built breaks some kernel build system integration downstream #13595

Open prometheanfire opened 2 years ago

prometheanfire commented 2 years ago

I'm not totally certain this is a bug for upstream or not, but it could be...

The process used for installing a kernel in gentoo can include running dracut to install the kernel (specifically to handle signing for secure boot) itself. This would be before zfs modules are rebuilt for the new kernel.

Without the following patch dracut fails, the kernel isn't signed, etc.

Later on, after the zfs module is built, dracut is run AGAIN to generate the initramfs and the like (at which time we could call it with -c, not before).

--- b/contrib/dracut/90zfs/module-setup.sh.in
+++ a/contrib/dracut/90zfs/module-setup.sh.in
@@ -19,7 +19,7 @@
 }

 installkernel() {
+       instmods zfs
-       instmods -c zfs
 }

 install() {
stale[bot] commented 1 year ago

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.

prometheanfire commented 1 year ago

this is still a bug :(

rkitover commented 1 year ago

@nabijaczleweli hey, can you help us Gentoo people out with this. We still have a patch for this for the sys-fs/zfs-9999 live ebuild (against master.)

nabijaczleweli commented 1 year ago

Don't include the zfs module if you don't have zfs. If this means fixing your package manager or its hook order to run dkms before dracut then do that. This will also fix the double-generation the OP notes but doesn't see as an issue.

The diff in the OP (and referenced commits) being "actually zfs.ko is optional for zfs" is obviously wrong, and it gets very quickly into "haha dracut ran correctly but you're fucked actually" territory when you next boot.

Because, again, you need zfs.ko in the initrd to boot with root=zfs. If this is as easy as skipping the dracut hook if there's a dkms hook pending, then that sounds relatively easy, at least ideologically; the mechanics of gentoo package management are entirely foreign to me.

rkitover commented 1 year ago

Thank you for the explanation, I think you are completely right. I will try to get this fixed in the Gentoo stuff.