UrBackup with ZFS on Ubuntu Focal 20.04 Problem and Solution

I was able to get UrBackup (from the Xenial PPA) and ZFS working on Ubuntu Focal 20.04 with a little difficulty.

The problem: UrBackup doesn’t detect ZFS volumes.
Example:

urbackup_snapshot_helper test


Testing for zfs…
TEST FAILED: Creating test zfs volume “xxx/images/testA54hj5luZtlorr494” failed

The reason for the problem:

find_zfs_cmd() in the urbackup_snapshot_helper binary calls zfs --version and expects a return code of 2 (the --version switch is not supported in Xenial ZFS 0.6.5). zfs --version IS supported in Focal 0.8.3 and has a return code of 0. find_zfs_cmd() fails on return code of 0.

Hacked-together solution until this is addressed in UrBackup:

Step 1: mv /sbin/zfs /sbin/zfs-original
Step 2: Create a new bash script named /sbin/zfs with identical ownership/permissions and the following contents

#!/bin/bash

zfs-original "$@"
original_return_code="$?"

if [[ "$@" == "--version" ]]
then
  exit 2
fi

exit $original_return_code
1 Like

Nice work-around. Need to fix this pull-request https://github.com/uroni/urbackup_backend/pull/19/commits/ecc76cc5f7a870c5b68bdfc1eca036a2fdc6adf9?diff=unified&w=1 such that it works with the old+new version…

Focal package should be available via OpenSUSE Build service soon https://www.urbackup.org/download.html#server_redhat

@dimoochka : Thanks for your fix !

@uroni : We have the same problem since we upgrade from Debian 9 to Debian 10 with zfs backports (0.8.4-1~bpo10+1) . Are there plans to release a fixed version soon (2.4 branch) ?

Regards,

@TomTomGo Be careful with copy/paste of the script - I noticed that the quotes don’t translate correctly (get changed to right/left double quotes). It should also be --version (two dashes originally that got converted to a single long dash).

Also when you upgrade the zfs package, the zfs script gets overwritten by a new binary. My backups suddenly started failing when this happened and I had to redo the process to get it working again.

@TomTomGo this issue is fixed in 2.4.13 which was just pushed to the repo. Thanks @uroni !

@dimoochka Thanks for this info and all the previous !
And as usual, thanks @uroni for this New release and this nice software :sunglasses:

Have a nice day

Hi all.

Sorry for getting this old thread up but I have a similar issue.

I wanted to configured UrBackup Docker to use ZFS, but I only get:

2025-11-18 14:19:42: Removing temporary files…
2025-11-18 14:19:42: Recreating temporary folder…
TEST FAILED: guestmount is missing (libguestfs-tools)
2025-11-18 14:19:42: Image mounting disabled: TEST FAILED: guestmount is missing (libguestfs-tools)
2025-11-18 14:19:42: Testing if backup destination can handle subvolumes and snapshots…
Testing for btrfs…
TEST FAILED: Creating test btrfs subvolume failed
Testing for zfs…
cannot create ‘tank/backup/images/testA54hj5luZtlorr494’: permission denied
TEST FAILED: Creating test zfs volume “tank/backup/images/testA54hj5luZtlorr494” failed

And I have no idea why.

My docker container for this (I removed some parts):

[
    {
        "Id": "db2816788e07e20782e148f1d8516b8fc643350bd05b03cea0a56cfe66777131",
        "Created": "2025-11-18T13:19:29.850440421Z",
        "Path": "/usr/bin/entrypoint.sh",
        "Args": [
            "run",
            "-v",
            "debug"
        ],
        "Image": "sha256:e852bae3e5e08cf777dc5b37ff4270425e2516c7755e33275b100317af449177",
        "Name": "/urbackup",
        "RestartCount": 0,
        "Driver": "zfs",
        "Platform": "linux",
        "HostConfig": {
            "Binds": [
                "urbackup_data:/var/urbackup",
                "/tank/backup:/backups",
                "urbackup_log:/var/log"
            ],
            "NetworkMode": "host",
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": [
                "AUDIT_WRITE",
                "CHOWN",
                "DAC_OVERRIDE",
                "FOWNER",
                "FSETID",
                "KILL",
                "MKNOD",
                "NET_BIND_SERVICE",
                "NET_RAW",
                "SETFCAP",
                "SETGID",
                "SETPCAP",
                "SETUID",
                "SYS_CHROOT"
            ],
            "CapDrop": [
                "AUDIT_CONTROL",
                "BLOCK_SUSPEND",
                "DAC_READ_SEARCH",
                "IPC_LOCK",
                "IPC_OWNER",
                "LEASE",
                "LINUX_IMMUTABLE",
                "MAC_ADMIN",
                "MAC_OVERRIDE",
                "NET_ADMIN",
                "NET_BROADCAST",
                "SYSLOG",
                "SYS_ADMIN",
                "SYS_BOOT",
                "SYS_MODULE",
                "SYS_NICE",
                "SYS_PACCT",
                "SYS_PTRACE",
                "SYS_RAWIO",
                "SYS_RESOURCE",
                "SYS_TIME",
                "SYS_TTY_CONFIG",
                "WAKE_ALARM"
            ],
            "Devices": [
                {
                    "PathOnHost": "/dev/zfs",
                    "PathInContainer": "/dev/zfs",
                    "CgroupPermissions": "rwm"
                }
            ],
            "DeviceCgroupRules": null,
        },
        "GraphDriver": {
            "Data": {
                "Dataset": "tank/docker/c298d252fe2ef648906ea6cb2f7781cdc8cb75fe4b57daee8be32ada4701fc56",
                "ID": "db2816788e07e20782e148f1d8516b8fc643350bd05b03cea0a56cfe66777131",
                "Mountpoint": "/var/lib/docker/zfs/graph/c298d252fe2ef648906ea6cb2f7781cdc8cb75fe4b57daee8be32ada4701fc56"
            },
            "Name": "zfs"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "urbackup_data",
                "Source": "/var/lib/docker/volumes/urbackup_data/_data",
                "Destination": "/var/urbackup",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "bind",
                "Source": "/tank/backup",
                "Destination": "/backups",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "volume",
                "Name": "urbackup_log",
                "Source": "/var/lib/docker/volumes/urbackup_log/_data",
                "Destination": "/var/log",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Env": [
                "TZ=Europe/Berlin",
                "ZFS_FILES=tank/backup/files",
                "ZFS_IMAGE=tank/backup/images",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "run",
                "-v",
                "debug"
            ],
            "Image": "uroni/urbackup-server:latest-zfs",
            "Volumes": {
                "/backups": {},
                "/var/log": {},
                "/var/urbackup": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "/usr/bin/entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        }
    }
]

The device is there and the ENV-Vars are there as well.

Host system:

zfs-2.2.2-0ubuntu9.4
zfs-kmod-2.2.2-0ubuntu9.4

NAME                                                                                USED  AVAIL  REFER  MOUNTPOINT
tank                                                                               1007G  2.53T    96K  /tank
tank/backup                                                                         930G  2.53T   930G  /tank/backup
tank/backup/files                                                                    96K  2.53T    96K  /tank/backup/files
tank/backup/images                                                                   96K  2.53T    96K  /tank/backup/images

Any idea whats wrong? What permission does it need?

Just a wild guess here but you can try configuring urbackup to run as root. It can’t create/delete zfs volumes with regular user permissions which is maybe why you’re getting this error?

Yeah, but I followed the Docker image instructions. Which are maybe outdated, as they do not say anything about the -zfs tag which is needed.

I’m referencing the urbackup server admin manual:

“In order to create and remove ZFS snapshots UrBackup installs a setuid executable urbackup_ snapshot_helper. However, currently ZFSOnLinux calls mount in turn which will fail when urbackup_ snapshot_helper is run as non-priviledged user. So you must run UrBackup server as root user (urbackupsrv run -u root).”

1 Like