I decided to update my kernel on Centos 7 the other day on my NFS server. When I rebooted and tried to access my ZFS media I discovered the error:
The ZFS modules are not loaded.
Trying to run modprobe just showed that the module were not installed in the system. This was strange, as the ZFS package was still installed. I turns out that there has long been an issue of kernel compatibility with the Centos ZFS package. What follows are the steps I used to fix the issue since it isn’t well documented elsewhere.
Step 1: Remove ZFS
The first issue is that the ZFS package will simply update itself and thus the kernel module to reflect changes to the running linux kernel. For whatever reason, the package maintainers recommend fully removing the package when issues with compatibility arise. This may be done by the command
yum remove zfs zfs-kmod spl spl-kmod libzfs2 libnvpair1 libuutil1 libzpool2 zfs-release
It may take a little while to run.
Step 2: Reinstall the ZFS RPM
Run the command
yum install http://download.zfsonlinux.org/epel/zfs-release.el7_4.noarch.rpm
to reinstall the RPM and optionally run the command
to remove any orphaned packages in the tree. At this point, I intended to install the kmod version of the ZFS package instead of the DKMS package that will be installed by default. I found that the DKMS version caused problems when I installed it the first time around.
The change may be made by modifying /etc/yum.repos.d/zfs.repo and disabling the zfs package and enabling the zfs-kmod package. Detailed instructions can be found here.
Step 3: (Re)install ZFS
Run the command
yum install zfs
to reinstall the zfs package. After this finishes, you should be able to run
and use the ZFS package as normal. If this still does not work, I would recommend checking to see if your kernel, kernel-devel, and kernel-headers packages all have the same version as they may not correctly synchronize during a full system upgrade.
When I followed these instructions a second time I had to clear yum’s cache due to 404 errors when accessing keys from ZFS on Linux. This was done by running the command
yum clean all
rm -rf /var/cache/yum/*