I am currently trying to change over a data dump server running 19.04 from LUKS+btrfs to ZFS. The system drive is LUKS-encrypted and can be decrypted via SSH. It contains a key file that is supposed to decrypt the ZFS filesystems. I am halfway there but automount does not work.

  • I have managed to compile ZFS 0.8.1 and build a DKMS package following the wiki. By reading the makefile, I have in addition found out that I also need to make deb-utils to get zpool and such.
  • I created a pool that supports encryption

    zpool create -o ashift=12 dataint /dev/disk/by-id/mydrive zpool set feature@encryption=enabled dataint

  • I created filesystems in it that are encrypted with the keyfile

    zfs create \ -o encryption=on \ -o keylocation=file:///root/keys/hdd256.key -o keyformat=raw\ dataint/test

  • I can mount this with zfs mount dataint -l

The issues I have now are:

  1. zfs is not loaded at startup. Not even the kernel module and accordingly certainly not the pool.

  2. Encrypted volumes are only loaded when the pool is imported or the filesystem is mounted with the -l option. I guess that has to be addressed somehow for autoload when 1. is solved?

I do have some zfs systemd services, but they are masked. Not sure if they are leftovers from a prior 0.7 package manager installation, which I removed.

  • ZPOOL_IMPORT_OPTS in /etc/defaults/zfs might be the right place to put a -l, but right now, automount isn't working. I think it is an issue with the systemd services .. – mcandril Jun 20 '19 at 17:44
  • Ok, it seems that unmasking and enabling the services does the trick ... – mcandril Jun 20 '19 at 18:18

Try to manually enable all the installed parts.

To see what zfs-related services your system has installed:

sudo systemctl list-unit-files | grep zfs

Next, enable all the services. I'm being verbose:

sudo modprobe zfs
sudo systemctl enable zfs-import-cache
sudo systemctl enable zfs-import-scan
sudo systemctl enable zfs-import.target
sudo systemctl enable zfs-mount
sudo systemctl enable zfs-share
sudo systemctl enable zfs-zed
sudo systemctl enable zfs.target

If complaints about things being masked show up on your terminal, force remove all masks:

sudo systemctl unmask zfs-*

You probably don't need this, but for completeness, some older systems have fewer services and prefer update-rc.d:

update-rc.d zfs-import enable
update-rc.d zfs-mount enable
update-rc.d zfs-zed enable
update-rc.d zfs-share enable
  • Yes, that is is essentially what we got out of the comments 2 month ago. Unmasking the old services was the issue. But thanks for writing that out for other people. Now, I would rather recommend to cleanly remove all traces of an old ZFS before installing the new one. – mcandril Aug 26 '19 at 11:09
  • I also encountered the problem that deb-utils does not necessarily includes the systemd files. It MIGHT have to do with if the system is rather freshly installed or updated from older version of Ubuntu. I just solved that by copying the deb from a system that works and haven't yet bothered to investigate enough for an answer or a bug report. – mcandril Aug 26 '19 at 11:12

I have fully solved the issue now, which essentially has too parts.

  1. The systemd services have to be built into the deb package at all. Unfortunately, the wiki packe linked above is very sloppy, as discussed here in the issue tracker.

In short, the build commands for DKMS deb should be

$ ./configure
$ make -j1 deb-utils deb-dkms
  1. Old installation needs to be cleaned up


sudo systemctl unmask zfs*

and the new services need to be enabled and started.

I have also described how to deal with encrypted datasets here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.