Can't install zfs on Rocky Linux 9

Hello,

I am following the procedure in RHEL-based distro — OpenZFS documentation.
All the dnf commands succeed but then modprobe fails:

#dnf config-manager --set-enabled crb
#dnf install epel-release
#dnf install -y kernel-devel
#dnf install -y zfs
#modprobe zfs
modprobe: ERROR: could not insert 'zfs': Key was rejected by service

# uname -a
Linux rocky1 5.14.0-70.22.1.el9_0.x86_64 #1 SMP PREEMPT Tue Aug 9 19:45:51 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Any idea?
On each new Rocky linux release installing zfs is a pain

Fixed, it was the secure boot that has to be disabled

Good to know. Was about to reply, as I’d done it fine in Rocky 9 VM, but then I don’t have secure boot enabled. I’m guessing secure boot requires signed kernel modules for them to load and therefore without it, it won’t allow it.

It works, if you rebuild the module. This is actually easily done, because zfs is delivered as dkms anyway:

Here’s how I do it on a secure-boot enabled Rocky9:

rpm -Uvh https://zfsonlinux.org/epel/zfs-release-2-2$(rpm --eval "%{dist}").noarch.rpm
dnf install zfs
for kv in `rpm -q --queryformat '%{evr}.%{arch}\n' kernel` ; do
    dnf install -y kernel-devel-$kv
    dkms autoinstall --kernelver $kv
done

Later: Forgot to mention, that you have to enroll your own signing keys first. See

The debate about switching off secure boot, and calling it a “fix”, reminds me of the debate about switching off selinux in the past.