Urbackup_snapshot_helper is broken on TrueNAS (FreeBSD) with ZFS

Anyone here using UrBackup on TrueNAS CORE?

  1. Datasets from old full file backups are not physically deleted by UrBackup even though they no longer show up in the WebUI nor are referred to by the datasets of any incremental file backups that do appear in the WebUI. remove-unknown does not find them. Had to remove them manually with zfs commands.

  2. Deleting raw CoW incremental image backups always fails.
    urbackupsrv -u root remove-unknown prints many errors like this:

2022-09-19 22:23:58: Deleting incremental image backup ( id=24, backuptime=2022-03-25 06:23:24, path=/mnt/mypool/ub01/b/x-PC/220324-2323_Image_C/Image_C_220324-2323.raw, letter=C: ) from client "x-PC" ( id=2 ) ...
2022-09-19 22:23:58: Deleting image backup ( id=24, path=/mnt/mypool/ub01/b/x-PC/220324-2323_Image_C/Image_C_220324-2323.raw ) ...
Checking mypool/ub01/i/x-PC/220324-2323_Image_C for dependencies...
cannot open '-H': dataset does not exist
cannot open '-o': dataset does not exist
cannot open 'value': dataset does not exist
cannot open 'mypool/ub01/i/x-PC/220324-2323_Image_C@ro': dataset does not exist
2022-09-19 22:23:58: Deleting image backup failed.

Running urbackup_snapshot_helper directly prints exactly the same messages.
Command: urbackup_snapshot_helper 1 remove x-PC 220324-2323_Image_C

Tested on TrueNAS 12.0 and 13.0, jail with FreeBSD 12.2 and 12.3

I think that ZFS support is not sufficient tested or implemented.
I have found that remove-unknown command don´t work in ZFS environment, in my case, it deletes all backups from DB (not from disks).
Also I found that when you delete a computer, it doesn´t delete the ZFS dataset that belongs to that computer.
And also the problem with Virtual Subclients that don´t work with ZFS.

I hope that all of those issues are under development or at least are known by Urbackup developers.

Does it, though? The timestamped messages seem to come from ServerCleanupThread:: cleanup_one_imagebackup_client and ::removeImage rather than from urbackup_snapshot_helper.

I can’t seem to find “Checking {dataset} for dependencies…” anywhere between invocation from ServerCleanupThread::deleteImage into remove_subvolume. Neither with nor without PR#53. Not even inside OpenZFS, so far.

I do agree that there should be more testing. And a serious refactor of the snapshot helper, if not an actual reimplementation of image backup using zvols. But if I were to put forth an exploratory refactor just to help pursue the symptom and its cause, that wouldn’t really help anyone. It would only move things around and get in uroni’s business, setting him that much further back from a fix.

Here you go:
1
2

I think there is a reference in snapshothelper/main.cpp
The line that gives the error is:

rc=exec_wait(find_zfs_cmd(), clone_data, “get”, “clones”, “-H”, “-o”, “value”, (subvolume_folder+“@ro”).c_str(), NULL);

There is a syntax error for the zfs command, at least on FreeBSD 13.1:
Calling zfs get clones -H -o value gives:

cannot open ‘-H’: dataset does not exist
cannot open ‘-o’: dataset does not exist
cannot open ‘value’: dataset does not exist

Maybe it should be:
zfs get -H -o value clones

Later edit:
Forgot to mention I am on the latest version, 2.5.30
I can confirm snapshot cleaning works by changing the line to:

rc=exec_wait(find_zfs_cmd(), clone_data, “get”, “-H”, “-o”, “value”, “clones”, (subvolume_folder+“@ro”).c_str(), NULL);

I just ran “make” in the source folder and copied the updated urbackup_snapshot_helper to /usr/local/bin

1 Like

I can confirm this fix appears to work.