Shift=true with a ZFS-pool doesn't work, says not supported?

I used to use Btrfs as my filesystem, but I recently moved my servers over to ZFS and now many of my containers will not work. lxc info does say I have idmapping enabled and the documentation for LXD does seem to say that that should be enough, but alas, I only get the following:

Error: Failed to setup device mount "test": idmapping abilities are required but aren't supported on system
Try `lxc info --show-log instance` for more info

lxc info|grep idmap
    idmapped_mounts: "true"
    idmapped_mounts_v2: "true"

This is on Ubuntu 23.04 with kernel 6.2.0-32-generic and ZFS 2.1.9-2ubuntu1.1

I have tried googling for a while now, but all the results I get seem to be talking about something different or about using raw.idmap and I don’t understand what am I doing wrong. Could someone more knowledgeable please explain why shift=true doesn’t work with ZFS, when it worked just fine with Btrfs and how do I fix this? I am new to ZFS, so I wouldn’t be surprised if it was something I am missing, but that error message isn’t very useful in solving it.

ZFS does not yet support idmapped mounts in the Ubuntu kernel. It has been very recently added to the, as yet unreleased, 2.2 release of ZFS (https://www.phoronix.com/news/OpenZFS-2.2-rc1).

So in the meantime you can use shiftfs which is in the Ubuntu kernel (for now) by enabling it in the LXD snap:

sudo snap set lxd shiftfs.enable=true
sudo systemctl reload snap.lxd.daemon

I feel like openZFS < 2.2.0 not supporting idmapping should be mentioned in the documentation for the LXD ZFS-driver’s limitations. I fully thought it’d support idmapping just the same as Btrfs does.

Such a nuisance, but I guess I’ll use shiftfs, then. Thanks.

1 Like