how to manage kernel versions and dkms zfs/spl modules

asked 2018-09-12 09:10:45 -0500

fermulator gravatar image

updated 2018-09-17 12:33:00 -0500

Good day experts!

I have had issues in this area for years, and finally getting around to asking. Two scenarios:

  • A) Desktop Fedora 27 (w/ ZFS storage, non-root boot)
  • B) Server Fedora 27 (w/ ZFS storage + root boot)

For the desktop, every time the kernel updates I have to re-install zfs and spl modules post-reboot. While annoying, not disastrous since its just a secondary storage platter. Not the focus of this post.

For the server, I have two issues:

  1. Since upgrade from f22 to f27, the actual kernel booting was stuck on f22
  2. After forcing grub mkconfig to take in the latest kernel, zfs/spl modules were not automatically built into initramfs

Context/History:

  • Fedorda22 server was initially installed and built for ZFS root boot (roughlysteps were like this https://github.com/zfsonlinux/pkg-zfs..., but back then years ago, the instructions were different)
  • Did not upgrade the OS for many years due to FUD as to whether or not I'd break the ZFS boot.
  • Finally earlier this year I bit the bullet and just did it (prepared w/ backups etc in case something went wrong) - but to my surprise, it booted and everything was fine! (or so I thought)
  • I neglected to check if I was actually booting the intended f27 kernel ... as it turns out (we will see shortly), it was forever stuck booting an older 4.3 kernel from f22.

--

I first noticed all of this as per: https://github.com/zfsonlinux/zfs/iss... (was hitting an old ZFS issue/bug, but I thought I was running latest kernels + zfs versions, but it turns out not!)

--

To repeat the important bits here, this is the state I found myself in:

$ sudo modprobe zfs
modprobe: FATAL: Module zfs not found in directory /lib/modules/4.3.4-200.fc22.x86_64

$ find /lib/modules | grep zfs
/lib/modules/4.17.2-100.fc27.x86_64/extra/zfs.ko.xz
/lib/modules/4.16.12-200.fc27.x86_64/extra/zfs.ko.xz
/lib/modules/4.16.13-200.fc27.x86_64/extra/zfs.ko.xz

$ uname -a
Linux (HOSTNAME) 4.3.4-200.fc22.x86_64 #1 SMP Mon Jan 25 13:37:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/fedora-release 
Fedora release 27 (Twenty Seven)

$ rpm -qa | grep zfs
zfs-0.7.9-1.fc27.x86_64
zfs-dracut-0.7.9-1.fc27.x86_64
zfs-release-1-5.fc22.noarch
zfs-dkms-0.7.9-1.fc27.noarch
libvirt-daemon-driver-storage-zfs-3.7.0-4.fc27.x86_64
libzfs2-0.7.9-1.fc27.x86_64

$ sudo scripts/filesystem/zfs_initramfs_inspect.sh
[sudo] password for fermulator:
/boot/initramfs-0-rescue-72b97c7344964f3d9c98cacf0caca2f8.img: zfs.ko MISSING
/boot/initramfs-4.17.19-100.fc27.x86_64.img: MISSING
/boot/initramfs-4.17.2-100.fc27.x86_64.img: zfs.ko MISSING
/boot/initramfs-4.3.4-200.fc22.x86_64.img: OK

The BEFORE situation:

# grep ROOT grub.cfg_F22_backup 
    linuxefi /ROOT/fedora@/boot/vmlinuz-4.3.4-200.fc22.x86_64 root=ZFS=zmain/ROOT/fedora ro rhgb quiet efi_no_storage_paranoia boot=zfs rpool=zmain 
    initrdefi /ROOT/fedora@/boot/initramfs-4.3.4-200.fc22.x86_64.img
    linuxefi /ROOT/fedora@/boot/vmlinuz-4.0.4-301.fc22.x86_64 root=ZFS=zmain/ROOT/fedora ro rhgb ...
(more)
edit retag flag offensive close merge delete