Error when installing ubuntu-zfs

I'm switching from FreeNAS to Ubuntu 12.04 LTS. After a vanilla install of Ubuntu has been completed I run the following commands in the order shown to install ZFS:

  1. apt-get install python-software-properties
  2. add-apt-repository ppa:zfs-native/stable
  3. apt-get -y -q update && apt-get -y -q upgrade
  4. apt-get install ubuntu-zfs

When the last command is run ZFS is installed and seems to be working correctly... mostly (more on that later). However, when the last command is run I get this error (full log here):

configure: error:
        *** Please make sure the kmod spl devel <kernel> package for your
        *** distribution is installed then try again.  If that fails you
        *** can specify the location of the spl objects with the
        *** '--with-spl-obj=PATH' option.

What is this error and how do I fix it?

Now I said mostly earlier because my pool's don't auto mount when the server restarts the way they should. All my reading (mostly from this page) indicates that mountall should just take care of the mounting. I have followed the instructions on that page and I cannot get mountall to work correctly. My pools will only auto mount on restart if I edit /etc/fstab or change the ZFS_MOUNT and ZFS_UNMOUNT options in /etc/default/zfs.


Solution 1:

The following helped me on 14.04:

sudo apt-get remove spl-dkms zfs-dkms ubuntu-zfs
sudo apt-get install spl-dkms
sudo apt-get install zfs-dkms
sudo apt-get install ubuntu-zfs

I didn't realize that spl needs to be installed before zfs can be compiled successfully and I think I kept getting compile errors based on that fact. The gist, as I understand it, is that the zfs source depends on the spl source.

I found this information on a mailing list.

Solution 2:

You need to re-initialise your kernel stuff.. Just found the same issue on a fresh install here..

The following assumes you have the repo ppa:zfs-native/stable installed:

Firstly before attempting to install the stuff needed to compile::

apt-get install linux-headers-generic build-essential -y

Install zfs

apt-get install ubuntu-zfs -y

Rebuild the dkms drivers (SPL first)

dpkg-reconfigure spl-dkms
dpkg-reconfigure zfs-dkms

If all went well you should be able to load the module and see them loaded:

# modprobe zfs
# lsmod | grep zfs
zfs                  1144227  0 
zunicode              331251  1 zfs
zavl                   15010  1 zfs
zcommon                47181  1 zfs
znvpair                88812  2 zfs,zcommon
spl                   168728  5 zfs,zavl,zunicode,zcommon,znvpair

This is all the "simple" version of what I found here: https://groups.google.com/a/zfsonlinux.org/d/msg/zfs-discuss/sSTbgwerXi4/txQ9EK2yqMMJ

I used this on my workstation for what its worth, about the same as the two dpkg rebuilds above:

KERNEL_VER=`uname -r`
ZFS_VER=0.6.2

dkms remove -m spl -v $ZFS_VER --all 
dkms remove -m zfs -v $ZFS_VER --all

ls -l /var/lib/dkms/spl /var/lib/dkms/zfs   # (should be nothing there)

dkms add -m sqpl -v $ZFS_VER -k KERNEL_VER
dkms install -m spl -v $ZFS_VER -k $KERNEL_VER

dkms add -m zfs -v $ZFS_VER -k KERNEL_VER
dkms install -m zfs -v $ZFS_VER -k $KERNEL_VER