Howto build ZOL (ZFS On Linux) from source in Devuan

Installing the package zfs-dkms 0.7.3 from backports contrib fails because it needs dkms version >, but Debian has

Thus I tried to compile from source, and succeeded with the following commands.
This goes the detour of creating deb packages, because installing directly somehow did not work. Maybe I made a mistake, maybe deb packets are really required, whatever, I document the method that worked.

This was tested

  • in Devuan 1.0 "Jessie" with ZOL versions 0.7.3, 0.7.5, and 0.7.6
  • in Devuan 2.0 "ASCII" beta with ZOL 0.7.6

Be careful with ZOL version 0.7.7. It does compile as well, but appears to have a bug.


# install prerequisites
# (from for Debian)
aptitude install build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r)
aptitude install zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev
aptitude install parted lsscsi ksh

Download and Compile

# download source
# (URLs from
cd /usr/local/src
zcat spl-$version.tar.gz | tar xf -
zcat zfs-$version.tar.gz | tar xf -

# build spl
cd /usr/local/src/spl-$version
make deb

# build zfs
cd /usr/local/src/zfs-$version
./configure --with-spl=/usr/local/src/spl-$version
make deb


# install
cd /usr/local/src
dpkg -i spl-$version/spl_$version-1_amd64.deb
dpkg -i spl-$version/kmod-spl-$(uname -r)_$version-1_amd64.deb
dpkg -i zfs-$version/zfs_$version-1_amd64.deb
dpkg -i zfs-$version/kmod-zfs-$(uname -r)_$version-1_amd64.deb
dpkg -i zfs-$version/libnvpair1_$version-1_amd64.deb
dpkg -i zfs-$version/libuutil1_$version-1_amd64.deb
dpkg -i zfs-$version/libzpool2_$version-1_amd64.deb
dpkg -i zfs-$version/libzfs2_$version-1_amd64.deb

# load modules once
# cd /usr/local/src/zfs-$version/scripts
# bash  # does not work any more
modprobe zfs   # better alternative

# automate loading of modules on each reboot
# (from
update-rc.d zfs-import defaults
update-rc.d zfs-mount defaults
update-rc.d zfs-zed defaults   # optional
update-rc.d zfs-share defaults # optional


mkdir /scratch
for i in {1..3}; do truncate -s 2G /scratch/$i.img; done
zpool create zpool raidz1 /scratch/{1..3}.img
zpool list
zpool status
zfs list

Looks good so far. Even /etc/zfs/vdev_id.conf works (after udevadm trigger).

Update to later version

First unmount the zfs-filesystems

zfs umount zpool

Then uninstall the old version:

dpkg -r spl kmod-spl-$(uname -r)
dpkg -r zfs libzfs2 kmod-zfs-$(uname -r)
dpkg -r libnvpair1 libuutil1 libzpool2

If you installed a new kernel: reinstall the headers package

aptitude install linux-headers-$(uname -r)

Finally recompile and reinstall both spl and zfs like above, but run "make clean" before "./configure".

tested in Devuan 2.0 beta
tested with zfs version 0.7.6.
version 0.7.3 hardcoded → $version 0.7.5 variable
added dpkg -i kmod-spl & kmod-zfs
added update-rc.d commands