Zfs: During kernel upgrade (fedora) zfs module is built after the initramfs is being created so it's ot included

Created on 28 Sep 2019  路  5Comments  路  Source: openzfs/zfs

System information


Type | Version/Name
--- | ---
Distribution Name | Fedora
Distribution Version | 28, 29 and 30
Linux Kernel | 4 and 5
Architecture | x86_64
ZFS Version | 0.7 and 0.8.0, 0.8.1 and 0.8.2
SPL Version |

Describe the problem you're observing

During kernel upgrade on Fedora 28-30 the zfs-dkms builds normally without error.
Kernel also installs with no error.

However the kernel-core package is installed first, initramfs is being created with no zfs module included and after that zfs-dkms build is executed and kernel module is produced.

Describe how to reproduce the problem

On Fedora system that boots from zfs do a 'dnf update', if kernel upgrade is involved a initramfs will be generated, examine it with 'lsinitrd /boot/initramfs-(new-kernel-version).img' and search for the zfs kernel module - it will not be there. After reboot it will result ito non-bootable system.

Include any warning/errors/backtraces from the system logs

Didn't notice any errors during upgrade, from the non-bootable system it's simply cannot import zpool.

Workaround

So the workaround if you are booting from zfs is after the dnf update is completed and the zfs-dkms has done it's job and the zfs module is built to do another mkinitrd manually before reboot.

mkinitrd /boot/initramfs-(new-kernel-version).img (new-kernel-version)

Packaging

Most helpful comment

from what I have found it looks like the updates leave the old version files around in /var/lib/dkms/zfs/

So I had a hanging /var/lib/dkms/zfs/0.8.1/ folder that caused many things to error out.

after that I am running dkms autoinstall to make sure it builds everything.

fedora-server 30
kernel 5.2.17
zfs 0.8.2

All 5 comments

from what I have found it looks like the updates leave the old version files around in /var/lib/dkms/zfs/

So I had a hanging /var/lib/dkms/zfs/0.8.1/ folder that caused many things to error out.

after that I am running dkms autoinstall to make sure it builds everything.

fedora-server 30
kernel 5.2.17
zfs 0.8.2

Still,
Even updating kernels only when I was running on zfs 0.8.1 I had this issue - kernel module doesn't get included into the initramfs. The dkms is build after the initramfs.
Now I'm running 0.8.2 and yes - I did not delete 0.8.1 from dkms but the issue is the same.
The dkms itself gets build with no issues, it's just done after the initramfs already is created and so the module is not included in the initrd, resulting into non-bootable system.

from what I have found it looks like the updates leave the old version files around in /var/lib/dkms/zfs/

So I had a hanging /var/lib/dkms/zfs/0.8.1/ folder that caused many things to error out.

after that I am running dkms autoinstall to make sure it builds everything.

fedora-server 30
kernel 5.2.17
zfs 0.8.2

Thanks parkercvp. I was using the boot options at startup to run 5.2.16 every time. I moved the 0.8.1 folder to a new location, booted into 5.2.17, ran dkms autoinstall, reboot to 5.2.17 again and my pool was there as expected. Thanks!

Upgraded yesterday to Fedora 31 and the issue seems to be resolved there.
Not quite sure which commit solved it.

However the issue may persist in the older versions.
Again to make this clear the DKMS gets build normally with no issues however the initramfs for the new kernel doesn't contain the newly built module (usr/lib/modules/(kernel-version)/extra/zfs.ko.xz).
So after the kernel upgrade is finished you need to go and manually re-build the initramfs and check if zfs.ko.xz is now included.

See the linked duplicate for a fedora bugzilla article that explains some of the history of grubby and dkms. I'm going to try to do some research into this and propose some text for the wiki.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tualua picture Tualua  路  54Comments

ltz3317 picture ltz3317  路  82Comments

crollorc picture crollorc  路  143Comments

mabod picture mabod  路  53Comments

Lalufu picture Lalufu  路  70Comments