Installing Sanoid on TrueNAS Scale 23.10.1

I’m having an issue with installing sanoid on the latest version of TrueNAS scale. If I build from source or install from apt, it wants to uninstall middlewared and a few other important items. I installed it without looking at what it was doing and it broke my install and I had to rollback a snapshot to get it booting again.

The following packages will be REMOVED:
  cifs-utils linux-truenas-production-libc-dev middlewared openzfs-libnvpair3 openzfs-libuutil3 openzfs-libzfs4 openzfs-libzpool5 openzfs-zfs-initramfs openzfs-zfs-zed openzfs-zfsutils python3-libzfs python3-midcli truenas truenas-samba zectl
The following NEW packages will be installed:
  dkms libnvpair3linux libuutil3linux libzfs4linux libzpool5linux linux-libc-dev sanoid zfs-dkms zfs-zed zfsutils-linux

So what do I need to do to install sanoid on TN without breaking TN?

Wow! That’s quite a list of things to uninstall. truenas really jumped out at me.

Is this a vanilla TN install? I’m wondering if something customized in your setup conflicted with sanoid and triggered removal of these packages.

Other than that, I have no idea, but this is certainly the right place to ask!

Don’t try to install sanoid (via apt). It’s just a script that you can place anywhere in your path (along with the relevant config files which also can be put in a custom location if you so desire). So just download the latest sanoid version from GitHub - jimsalterjrs/sanoid: Policy-driven snapshot management and replication tools. Using ZFS for underlying next-gen storage. (Btrfs support plans are shelved unless and until btrfs becomes reliable.) Primarily intended for Linux, but BSD use is supported and reasonably frequently tested. and directly use it (and of course customize the config files).

What you do need for sanoid to work nicely are the following packages:

libcapture-tiny-perl libconfig-inifiles-perl pv lzop mbuffer

So you can:

apt install libcapture-tiny-perl libconfig-inifiles-perl pv lzop mbuffer

Remember that you’re going to loose all these customizations when you upgrade TrueNAS - so keep notes/script-snippets of whatever changes you make so that you can quickly get back to your desired special setup on top of TrueNAS after any upgrade in the future.

2 Likes

This should be vanilla, other than activating apt and dpkg (which is disabled by default in TN). I’ve installed Sanoid on TN before, but something changed in this latest version of TN that is making things break.

The weird thing to me is that I’ve installed Sanoid on TN before using apt and building it by following the debian/ubuntu instructions on github and haven’t had problems until 23.10.1, not sure what changed in TN to cause these issues.

I will try what you suggested and report back if it doesn’t work, thanks!

This is the correct answer. Drop the scripts in your path (personally, I use /usr/local/bin, but it’s up to you), chmod them 755, then create /etc/sanoid and dump in sanoid.defaults.conf and sanoid.conf. install the dependencies via apt as already described, and Bob’s your uncle.

For the service and timers, I can get sanoid-prune.service sanoid.service sanoid.timer from sanoid/packages/debian and put them in /etc/systemd/system/ , right?

This seems to have worked, the only thing I had to change from the manual/CentOS instructions on github was ln -s /usr/local/sbin/sanoid /usr/sbin/sanoid so the timer could find sanoid.

1 Like