Troubleshooting ZFS modprobe errors on a Raspberry Pi

Fixing modprobe "zfs not found" error on a Raspberry Pi

A woman holding two silver hard drives with orange rubber bumpers in front of her face in place of her eyes.
Photo by JC Gellidon / Unsplash. I searched Unsplash for "hard drives" and I just thought this one was funny.

Don't want the backstory? Jump to Solution


Troubleshooting Process

I'm in the process of setting up a Raspberry Pi as a budget NAS for a trip I'm taking soon. I'm planning on using OpenMediaVault with ZFS mirroring a pool across two large external hard drives.

Before anyone comments that ZFS isn't great for this, I know. I read Jeff Geerling's article about ZFS on Pis, which warns against it. I'm testing these things out well in advance of my trip and if it doesn't work, I'll try it another way.

I was running into a problem, however. I installed the ZFS plugin through the OpenMediaVault UI and saw a few modprobe errors in the logs:

modprobe: FATAL: Module zfs not found in directory /lib/modules/6.1.21-v8+

Note: If you are getting this message, you may have a different version number at the end. That's expected; that's your kernel version. I'm running an up-to-date stable version of Raspbian Lite at the time of writing.

I stumbled around trying to fix this for a couple of days. I tried a simple sudo modprobe zfs but just got the same error.

I then found an issue from last year on a GitHub repo porting ProxMox to Raspberry Pi describing a similar issue:

ZFS does not work · Issue #87 · pimox/pimox7
Hey there! For any reason ZFS does not work in my Pimox7 Instance. When I choose ZFS in the node menu I get the following error: command ’/sbin/zpool list -HpPLo name,size,alloc,free,frag,dedup,hea…

A few comments down is a suggestion to install the kernel headers. This is corroborated by my experience trying to follow another ZFS troubleshooting guide, which had me stumble into an error complaining about missing kernel headers.

That was a lot more backstory than I meant. Whoops.


The Solution

If you already installed ZFS and got a modprobe error, run the following commands:

sudo apt update
sudo apt install raspberrypi-kernel-headers
sudo modprobe zfs

Then test with zfs list. If you get a message stating no datasets available, it worked and you're good to go!

Mastodon