Skip to content

About

Backup your data and the entire system through rsync Snapshots (deduplication)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

backupsystemNG

backupsystemNG

ci release licence

Français | English

System backups via rsync snapshots. A single tool, no daemon, no database: backups are readable file trees, restorable with rsync even if backupsystemNG no longer exists — a single file or directory can be restored by simple copy, or with backupsystemNG.

Rewritten from backupsystem: same functions (system, data, archive, cloud, restore), but with real history, safeguards and tests, and with the notion of snapshot backups (hardlinks).

Screenshots

TUI Snapshots
TUI list
doctor — dependencies, transport, free space A backup in progress
doctor backup

The last one is a backup in progress: the line under the two-column log is redrawn every second — files done, bytes written, instantaneous rate, elapsed time — so a transfer that takes an hour never looks like it froze. The run also appends the same figures to the progress file it names, for tail -f in another window or a phone.

Features

  • Timestamped snapshots with --link-dest: each snapshot is complete and navigable; unchanged files are stored only once (hardlinks).
  • Two families per run: system (/ minus the data trees) and data (one or more directories), each with its own metadata. The system snapshot carries crontabs, packages, systemd services, processes, disks and the run fingerprint; the data snapshot carries a counted summary.
  • Snapshot retention/pruning policy: --keep-system-last, --keep-system-daily, --keep-system-weekly, --keep-system-monthly for the system tree; the same four with --keep-data-* for the data tree.
  • Restore of a snapshot, a family (system or data), a configured source (--source) or a specific file/directory (--only, path relative to the snapshot root; the parent hierarchy is recreated under the target).
  • Verification: structure, sample read, or full SHA-256 checksums.
  • Archive tar.zst + SHA-256 checksum, optional cloud upload (via rclone).
  • Safeguards: repository identity, lock, free space check, refusal of dangerous targets, --dry-run, usable exit codes.
  • Logging into the repository, --json, doctor, optional email.
  • Activity indicator during each rsync transfer: bytes written, instantaneous rate, files processed (cumulative and rate/s).
  • Gum TUI with Nerd Font glyphs (backupsystem tui), ASCII fallback.

Installation

sudo make install installs on the machine being backed up:

  • the backupsystem binary and bsng-mail (optional email) in /usr/local/bin;
  • the modules in /usr/local/lib/backupsystemNG;
  • the configuration template and exclusion lists in /usr/local/share/backupsystemNG/templates;
  • the man page in /usr/local/share/man/man1, its French version in /usr/local/share/man/fr/man1 (man picks it up when the locale is French), and the documentation in /usr/local/share/doc/backupsystemNG;
  • the optional zsh completion in /usr/local/share/zsh/site-functions.

It also places four scripts in /usr/local/share/backupsystemNG/nas/. They concern the SSH transport only and do not run on the workstation:

  • prepare-nas.sh: the installer. backupsystem server-setup --apply sends it to the server and runs it there as root, with --root (the repository root on that server, i.e. SSH_PATH) and --user (the ssh account). It installs rsync if needed, the three small programs described below and the passwordless sudoers rules, and records the authorised root in /etc/bsng-rmtree.root;
  • bsng-rmtree.sh, bsng-verify.sh: sources of the deletion and checksum programs, installed as /usr/local/sbin/bsng-{rmtree,verify};
  • bsng-lock.sh: source of the program that holds the lock, installed as /usr/local/sbin/bsng-lock; it only ever creates the lock directory, in one mkdir — so the directory exists afterwards or the attempt failed, never half — and only under the authorised root.

All three read their confinement from /etc/bsng-rmtree.root and refuse to run without it (exit 4, message naming the file): with no declared root they would otherwise confine to a path belonging to another installation.

The mountpoint and local transports need none of these. man backupsystem documents the commands, options, exit codes and transport details.

backupsystem help lists everything; backupsystem <command> help (or backupsystem <command> --help) prints only that command's options — backup help shows --only, --sample and the data-family rules, restore help shows --layout, --only and --in-place, and so on. Asking for help never runs the command.

git clone https://github.com/jotenakis2/backupsystemNG.git backupsystemNG
cd backupsystemNG
sudo make install          # /usr/local/{bin,lib,share}

On Arch (or any pacman system), the packaged recipe installs the same thing into /usr, and depends are pulled by pacman itself:

git clone https://github.com/jotenakis2/backupsystemNG.git
cd backupsystemNG/packaging/aur
makepkg -si                # builds, then installs; -s pulls the missing deps

That is the AUR recipe, run from the checkout: the package is not in the AUR yet (registration there is closed at the moment), so there is no yay -S line to give. A package built this way is attached to each release, for machines that would rather not build:

sudo pacman -U backupsystemng-<version>-1-any.pkg.tar.xz

Dependencies: bash ≥ 5, rsync, tar, zstd, flock, findmnt, coreutils. Optional: rclone (push), an MTA (email), systemctl (metadata), curl (release watch).

Keeping it up to date

schedule installs a daily timer that runs backupsystem update --check: it compares the installed version with the latest release and records the answer in /var/lib/backupsystemNG/. From then on, every command prints one line right after its title when a newer version exists — no command goes to the network during a run, and nothing is installed behind your back:

sudo backupsystem update            # says what it would install, then asks
sudo backupsystem update --check    # only compares (what the timer runs)

The installation downloads the official release, refuses an archive that does not carry the version it claims, builds it in a staging tree, and only then copies it over /usr/local. It never touches /etc: your configuration is not rewritten, and new template keys appear in share/templates/ where config check points at them. UPDATE_CHECK="off" removes both the line and the timer.

Quick start

sudo backupsystem init --destination /mnt/backup
sudo backupsystem config edit          # creates the file if missing, opens it in $EDITOR
                                       # data paths, exclusions, retention
sudo backupsystem doctor
sudo backupsystem backup --dry-run
sudo backupsystem backup
sudo backupsystem list
sudo backupsystem restore --snapshot latest --part system --to /mnt/restore

# a single file (path relative to the snapshot root)
sudo backupsystem restore --snapshot latest --part system \
  --only etc/ssh/sshd_config --to /mnt/restore

Looking inside a snapshot

sudo backupsystem backup --go-snapshot

The shell opens in the snapshot that was just written — after the closing title, and only when the run succeeded (an unfinished snapshot is removed, not explored). With the ssh transport the session is opened on the server, with the same key and options as the run; with a local or mountpoint destination it is a plain cd on this machine. It is not a chroot: to repair a restored system, use chroot --to DIR, which mounts /proc, /sys and /dev.

Local backup assumed (same disk, no mount):

sudo backupsystem init --destination /var/backups --transport local

Initialization with the SSH transport

Nothing is mounted, and DESTINATION is not consulted: with DEST_TRANSPORT="ssh" the repository lives on the server, at SSH_PATH as the server sees it. init opens the ssh channel itself — it reads the filesystem fingerprint there, writes the identity there and creates the repository directories there — so a local path (a NAS mount, for instance) is neither required nor read.

sudo backupsystem init --transport ssh \
    --ssh-host backup@nas.lan \
    --ssh-path /media/diskusb/data/backup/machine
sudo backupsystem doctor

--ssh-host is the account and server (SSH_HOST); --ssh-path is the root on that server (SSH_PATH), not a local path. The options are written in the order the validation needs — destination, account, root, then transport — so the command above works on a machine that has no configuration yet. Where a configuration already exists, config set does the same, in the same order:

sudo backupsystem config set SSH_HOST backup@nas.lan
sudo backupsystem config set SSH_PATH /media/diskusb/data/backup/machine
sudo backupsystem config set DEST_TRANSPORT ssh   # last: the two keys must exist first

The server needs rsync, and the ssh account must be able to write SSH_PATH. Owners and modes travel only through the helpers that prepare-nas.sh installs (SSH_RSYNC_PATH, sudo rsync by default) — see "Transport".

Running without root: --user

A personal account can back up its own home into a repository that belongs to it, with no sudo anywhere:

backupsystem --user init --destination /run/media/backup/alice --transport local
backupsystem --user doctor
backupsystem --user backup
backupsystem --user list

Every snapshot taken this way carries the tag USERDATA in its identifier (2026-12-05T15-25-34+0100-USERDATA), appended after any --tag you give: in list, in an archive or on the server, "this one came from an account's repository" reads straight from the name — no manifest to open, no host name to second-guess.

The ssh transport belongs to the mode: the remote rsync runs as the ssh account, without sudo, and the three helpers (bsng-verify, bsng-rmtree, bsng-lock) are pushed into the account's ~/.local/bin at every run, compared by hash — no sudoers rule, no server-setup, no NFS.

The mode is explicit and closed. It runs only as the account (never as root), reads its configuration from ${XDG_CONFIG_HOME:-~/.config}/backupsystemNG (never from /etc, and --config must point inside it), writes only the data family (--only data is implied; --only system is a usage error), requires DATA_ROOT to be the account's home with every DATA_PATHS entry resolving inside it, and requires the repository to carry the mark mode=user.

Keep the repository outside the trees it saves. A destination sitting inside them is excluded from the transfer by a forced pattern — it works, and the run says so — but a repository on the disk it backs up is a copy, not a backup: point it at another disk.

restore follows the same rule: the data family only (--part system and --part all are refused), into a directory the account can write and outside the repository, and the files come back owned by the account — a --user run cannot give a file to root, and it says so instead of pretending otherwise.

schedule writes the account's own units, under ${XDG_CONFIG_HOME:-~/.config}/systemd/user, and drives them with systemctl --user — data timers only, each ExecStart carrying --user so the timer runs in the mode. Their names end with -user (backupsystem-backup-data-user.timer, never …-data.timer): two managers carry units of the same name, and neither list-timers, nor a journal, nor a ps says which one it belongs to. schedule install and schedule remove also clear the pre-rename names, so an account planned by an earlier version never ends up with two timers for the same family. To have them fire while the account is logged out, an administrator must allow lingering once: loginctl enable-linger <user>.

That mark is final. A repository created this way is never written by root, and a machine repository is never opened with --user: a home backup that becomes a machine backup is a new repository, not a conversion. The commands the mode opens are init, config, backup, list, verify, archive, delete, prune, restore, schedule, doctor, update and tui; chroot, server-setup and push need root. In --user, the TUI is only a launcher: its screens offer the data family alone, and push is not listed.

Commands

Command Purpose
init creates the configuration, exclusion lists and destination identity
backup creates a snapshot (`--only system
restore restores a snapshot, a part or a path
list snapshots, parts, files (--json)
prune applies the retention policy — both enabled trees unless --only names one; --dry-run --json gives the plan as one line per tree
verify checks snapshot integrity (structure, checksums, sample) — both trees unless --part is given
archive tar.zst + .sha256 of a snapshot — both trees unless --part is given
push uploads a snapshot's archives to an rclone remote — one per tree unless --part
delete deletes one snapshot or one tree of it, a whole store, logs, restores or the configuration (store keeps the configuration file)
schedule installs the schedule — systemd timers, or a cron block where systemd is absent (system, root)
doctor full diagnostic (--json, --strict)
config path, show, check, get, set, edit
tui interactive Gum interface (menus, actions, scheduling)
version, help version, help

Global options: --config, --config-dir, --dry-run, --yes, --quiet, --verbose, --json, --no-color, --progress.

Repository layout

/mnt/backup/
├── .backupsystem/
│   ├── identity.json       # repository identity + filesystem fingerprint
│   └── lock                # flock lock
└── <host>/
    └── snapshots/
        ├── system/                   # the machine: / minus the data trees
        │   ├── latest -> 2026-11-10T03-00-00+0100
        │   └── 2026-11-10T03-00-00+0100/
        │       ├── system/           # complete root
        │       ├── meta/             # crontabs, packages, services…
        │       ├── logs/             # backup.log, rsync.log.gz, progress.txt, changes.txt.gz, exclusions.txt
        │       └── manifest.env|json
        └── data/                     # the data trees only
            ├── latest -> 2026-11-10T03-00-00+0100
            └── 2026-11-10T03-00-00+0100/
                ├── data/home/        # one directory per data path
                ├── meta/             # summary.env, crontabs, account timers, packages
                ├── logs/             # same four, for THIS part only
                └── manifest.env|json

A run without --only writes both trees, one snapshot each, with the same identifier. --part system reads the system tree, --part data the data tree; with no --part, restore handles both trees. meta/ is not a part: it is always written, with the family it describes — the machine's inventory in the system tree, and the one a restored home needs in the data tree (counters, root.conf, crontabs, packages, and the account's systemd timers in meta/systemd/timers-user-<account>.list|.units, recorded when that account's bus answers).

logs/rsync.log.gz is compressed at the source and stripped of its progress frames: --info=progress2 writes one frame per update, and on a 1 h 25 run they were 99.9 % of the journal (79,7 MiB of frames around 37 lines of output, 9,99 MiB once gzipped). Only the last frame of each line is kept, so the journal stays a record of the run; the live display still receives every frame.

A backup is therefore readable and restorable with plain ls and rsync -a snapshot/system/ /target/; a single file or directory can be restored by simple copy (cp -a) — or with backupsystemNG restore.

Configuration

/etc/backupsystemNG/backupsystemNG.conf, KEY="value" format, never evaluated as shell. See share/templates/backupsystemNG.conf for details.

The parser accepts a trailing comment (DESTINATION="/mnt/nas" # NAS), keeps # inside quotes, and never does eval: a value stays data, even if it contains $(…) or semicolons.

Important points:

  • DESTINATION: may be a mount (NAS) or a local directory. Spaces are accepted in the path.
  • MIN_FREE: minimum free space before starting, otherwise immediate abort.
  • DATA_ROOT: absolute root of the data trees (default /home). It must exist and can never be /: the whole root is not a data family.
  • DATA_PATHS: the trees of the data family, named relative to DATA_ROOT, space-separated (default ., the root itself — the whole of /home). The ./ prefix and a trailing / are optional: alice, ./alice and alice/ are the same tree. Each entry must exist, stay inside DATA_ROOT (symlinks resolved), must not use .., and no entry may contain another. A directory name containing a space is not expressible: the refusal says so.
  • Duplicates are ignored; two entries where one contains the other are refused (the same tree would be stored twice).
  • There is no source key for the system family: it is always /. To back up a system that is not running, mount it, chroot into it and run the tool there.
  • EXCLUDE_SYSTEM / EXCLUDE_DATA: rsync pattern lists, created by init.
  • BACKUP_SYSTEM / BACKUP_DATA: which families a run writes when --only is absent (--only always wins).
  • Renamed keys are refused, not ignored: SOURCES (DATA_PATHS), EXCLUDE_FULL (EXCLUDE_SYSTEM), EXCLUDE_SPECIFIC / EXCLUDE_HOME (EXCLUDE_DATA), RSYNC_ARGS_FULL / RSYNC_ARGS_SPECIFIC, BACKUP_FULL (BACKUP_SYSTEM), RESTORE_DIR_ROOT / RESTORE_DIR_SPECIFIC. FULL_SOURCE and BACKUP_METADATA are gone: the system root is / by construction and metadata is mandatory. Templates exclude reconstructible caches by default: any directory whose name ends in cache/Cache (*[Cc]ache/ covers .cache, GPUCache, Code Cache, ShaderCache, shadercache, startupCache, _cacache, sccache…), plus *CACHE/, Cache_Data/, CacheStorage/, CachedData/, [Cc]ache2/, thumbnails and trash (.local/share/Trash/, .Trash-*/), as well as recreatable dependency stores (.cargo/registry/, go/pkg/mod/) — but not ~/.cargo/bin, which contains installed binaries. /.snapshots/* is excluded: these system snapshots (snapper, btrfs) are full copies of the root; backing them up would multiply the cost by their count. doctor reports it if the exclusion is missing. Build artifacts are not excluded by name ("target" is a common word; a target directory containing real data would be skipped) but by their marker: on each data backup, backup excludes target/ directories bearing a CACHEDIR.TAG, i.e. those cargo created itself. A target/ without the marker is backed up normally. Each skipped directory is named in the log (for example, artefacts de compilation exclus (CACHEDIR.TAG) : 2 répertoires — code/app/target, code/lib/target), not just counted. Installed runtimes (~/.rustup/toolchains/, ~/.local/share/mise/installs/) are shipped commented out: uncomment to exclude them, at the cost of a rustup toolchain install / mise install after restore. .git directories are never excluded: they carry history (local branches, stash, unpushed commits) and their immutable objects are deduplicated by hardlink from one snapshot to the next. init never overwrites an existing file: to align an existing installation, start again from share/templates/exclude-*.txt.
  • EXCLUDE_BUILD_DIRS: true by default, excludes target/ marked with a CACHEDIR.TAG. When false, no automatic exclusion at all: only the lists above decide, and target/ is backed up. A non-boolean value is rejected (code 3) rather than silently disabling the setting.
  • LOG_EXCLUSIONS: true by default. The run writes logs/exclusions.txt into the snapshot with the list of what was skipped, with the pattern that decided the exclusion, plus a summary in the log (137 entrées écartées). Real cost: one line per pruned directory — an excluded directory is not traversed, so there is no line per file.
  • EXCLUDE_SIZES: false by default. When true only, the size of each skipped directory is measured (du on the affected directories only) and added to the report; this is what enables the byte total. When false, no measurement is made: the report says what is excluded and why, not how much it weighs.

Destination: the filesystem fingerprint

init records in .backupsystem/identity.json the filesystem UUID, its mount point and its device. On each run these values are compared with reality:

  • mount absent → the UUID (or device) no longer matches → refusal;
  • disk replaced, or init done while the volume was not mounted → refusal;
  • destination deliberately moved to another disk → init --reinit.

Intent is therefore declared once, at init time:

# NAS / external disk: the volume must be mounted
sudo backupsystem init --destination /mnt/backup

# local directory on /, assumed (same disk as the system)
sudo backupsystem init --destination /var/backups --transport local

Changing the destination of an already configured repository is not an initialization: init --destination then asks for confirmation (--yes for a scripted run), because the old repository becomes orphaned and latest, list and restore point elsewhere. A refused destination changes nothing: the file is validated on a copy before replacement.

There is no REQUIRE_MOUNTPOINT boolean to set anymore: mount checking comes from DEST_TRANSPORT. With mountpoint, the destination may live inside a volume (/media/NAS/backup when the volume is /media/NAS); what is required is a volume mounted at or above it and a filesystem other than the system's — /home on a btrfs subvolume is a mount point and still the same disk, so it is refused. A missing mount then stops the run instead of writing to a directory left empty on /. doctor applies the same rule and names the volume it found. On a filesystem without a UUID (tmpfs, NFS/CIFS, exFAT), the identity check uses the device and the mount point.

Security and robustness

  • No backup deletion is a side effect: if a source disappears, the run fails and nothing is deleted.
  • Filesystem fingerprint recorded at init: a missing mount or a different disk is refused before any write.
  • rsync --delete only applies to the current snapshot during backup: history is intact. Restore does not support --delete.
  • flock lock: two simultaneous runs are impossible.
  • Uninitialized destination, missing mount, insufficient space, source inside the destination: explicit refusal with a dedicated exit code.
  • In non-interactive mode, any confirmation without --yes cancels the action rather than waiting for an answer that will not come.
  • An interrupted snapshot (crash, power loss) has no manifest: it is ignored by list/restore and cleaned up at the start of the next backup, with the lock held.
  • Any tree deletion (interrupted snapshot, prune, delete) runs in parallel, eight files at a time: on a network repository each entry costs two round trips and NFS does not delete in batches, so 100,000 files take minutes one by one. Eight streams in flight fight the latency instead of adding it up; / and an empty path are refused, and if the machine has no parallel deleter the tool falls back to a plain rm -rf.
  • --quiet prints one line: the conclusion of the run (backupsystemNG: backup (data) 2026-11-26T18-08-37+0100 success: 6 files · 130.5 KiB · 5s). It names the families the run wrote — (system, data) when both trees ran — so a journal line says which tree it belongs to without showing the unit's command line. That is the line journalctl keeps for a timer; without it, a finished run and a run that did nothing looked the same. An interactive run prints the summary block instead and does not repeat it.
  • Errors go to stderr; machine output (--json) stays pure on stdout.
  • Everything the tool creates is created with umask 0077 — manifests, metadata, logs, archives — unconditionally. It is not a setting: a permissive value could only weaken it, and a timer starts from systemd's 0022. The one deliberate exception is LOG_GROUP: it opens the run logs and the manifests to a group (640 files, 2750 directories), never the snapshot contents. meta/ is left out of it on purpose: 700 root:root, so the group does not even learn the names of the crontabs, the package lists and the shell environments it holds. The copied files keep their own modes, so a world-readable secret stays world-readable in the snapshot.

Restoring in two steps: the system, then the data

A complete restore is two commands on purpose: restore the system it excludes /home by construction — check that it boots, then put the data back.

backupsystem restore --snapshot latest --part system --to /mnt/restore-system --mkdir
backupsystem restore --snapshot latest --part data   --to /mnt/restore-system

The second command recognises a restored system root by its etc/ and usr/: the data then takes its absolute path back inside that root (…/restore-system/home/alice/…), and the directory is created when needed. On a target that does not hold a system, --to stays literal: the tree lands where you asked.

Source overlap: code excludes it, not you

The system part always excludes /home entirely and every DATA_PATHS entry, with patterns anchored to the transfer root (--exclude=/home, --exclude=/srv/profiles): without that, every file in the home would be stored twice — and an unanchored pattern would also skip /opt/srv/profiles for /srv/profiles.

The exclusion is computed from the configuration, not maintained by hand in exclude-system.txt, and it always applies: a system snapshot never contains the trees of the data part, whatever families are requested. Snapshot contents are therefore predictable.

Assumed corollary: backup --only system backs up nothing from /home. The run says so, naming /home and every entry — warning in the output and WARNINGS= in the manifest — rather than producing a system backup without user files without a word.

What nothing covers is named too, one line per account, never fatal: a fully covered account stays silent, a partially covered one says what is covered (/home/user1/Documents only, for instance), an uncovered account is named. WARN_UNCOVERED_HOME=false silences these lines.

The manifest records it (SYSTEM_EXCLUDES=data), and restore --part system warns that the part is then complementary: restoring system alone yields a system without /home.

Transport: the mount, or rsync on the server

DEST_TRANSPORT decides who writes the data.

mountpoint (default), local ssh
who writes rsync on this machine, through DESTINATION rsync launched on the server (SSH_HOST)
owner / group one NFS request per entry, refusable (chown/chgrp in EINVAL) the server's local system calls
-A depends on the mount's FS type the server FS's POSIX ACLs
-X user.* only, and only on NFS 4.2 user.* and security.* (the remote rsync is root)
cost per file several network round trips the server writes locally, the network only carries the stream

The gain is not theoretical: on a repository of tens of thousands of small files, the local transport pays one round trip per attribute and per file, whereas ssh pays none.

DEST_TRANSPORT="ssh"
SSH_HOST="backup@nas.lan"
SSH_RSYNC_PATH="sudo rsync"    # root on the server: without it, no chown
SSH_OPTS=""                     # e.g. "-i /root/.ssh/backup"

There is no local view with ssh: DESTINATION is ignored, SSH_PATH is the root, and manifests, logs, lock, latest and the checks all travel over the ssh channel. Nothing compares two paths any more — there are not two. What the preflight does check is that the server reaches that root and that SSH_RSYNC_PATH runs there (the sudoers rule); otherwise the run stops (code 3) instead of writing elsewhere silently.

The lock follows the same split. With local / mountpoint it is a flock: the kernel releases it when the process dies, so it cannot linger. With ssh it is a directory created on the server in one step — it survives a killed run, so its recovery is decided, not deduced: automatic only when the holder is this machine and its pid is gone, refused otherwise with the host, pid and time. --break-lock lifts it, and the error message says when to use it.

On the server side, four sudoers rules are required — prepare-nas.sh installs and validates them:

backup ALL=(root) NOPASSWD: /usr/bin/rsync
backup ALL=(root) NOPASSWD: /usr/local/sbin/bsng-verify
backup ALL=(root) NOPASSWD: /usr/local/sbin/bsng-rmtree
backup ALL=(root) NOPASSWD: /usr/local/sbin/bsng-lock

The second serves prune, delete and interrupted-snapshot cleanup: a deletion over NFS costs two round trips per entry.

init also asks the remote rsync for its --version, without ever prompting for a password (ssh BatchMode), so a key or an account that would not work fails right there instead of at the first backup.

Choosing the destination

In order, best first:

transport why
1 ssh rsync runs on the server: owners, modes, ACLs and hard links are its own system calls, and the network carries only the stream. Clearly the fastest on many small files.
2 mountpoint on NFS complete and correct, but every attribute costs a round trip, and the export needs no_root_squash or rsync -a fails on chown.
3 local a second disk on this machine, or an external one that stays attached.
— CIFS/SMB refused: SMB2 carries no POSIX metadata and the server rewrites the modes (see below).
— FAT, exFAT, NTFS refused: no owners at all, modes invented from the mount options.

The filesystem holding the repository must be a POSIX one — ext4, xfs, btrfs, zfs (or any filesystem that stores owners, modes and extended attributes). NTFS and exFAT look like disks and behave like a shared folder: use them for archive --output, not for a repository.

Why a CIFS/SMB share cannot host a repository

SMB2/3 carries no POSIX metadata: an open or a create says nothing about uid, gid or mode. The server can only attribute an object to the session user, and the modes it stores come from the share's force create mode / force directory mode. Measured on a Samba 4.x share mounted with credentials=, one file created by the client at 0640:

mount options mode the client reads mode the server stores
noperm,file_mode=0666 640 0666
+ modefromsid 640 0766
+ modefromsid + vfs objects = acl_xattr + acl_xattr:ignore system acls 640 0666, and no security.NTACL written

Two consequences, and neither can be worked around from the client:

  • the stored mode is never the one rsync set, so a restored ~/.ssh/id_ed25519 comes back world-readable. That is why a data tree is refused too, not just system;
  • the client cannot see it: with modefromsid it reads back exactly what it asked for while the server stores something else. No probe run on this machine can tell a good share from a bad one, so the refusal is unconditional: init refuses the configuration, the preflight refuses again before the first byte (a mount can change after init), and doctor reports a failure.

Hard links do work over SMB (measured: same inode, link count 2 on the server), so the objection is not about space. It is about what a restore gives back.

What a share is good for: archive --output on the mount — a .tar.zst plus its .sha256, whose metadata lives inside the archive rather than in the share.

Use --transport ssh (rsync then runs on the server, owners and modes are the server's own system calls) or a NFS mount when the NAS must hold the repository.

Encrypted archives (age)

An archive is what leaves the machine — a share, a USB disk, a cloud remote — so it is the one artefact worth encrypting. AGE_KEY names a file of public keys, one per line: an age recipient (age1…) or an SSH public key. Empty means no encryption.

age-keygen -o ~/.config/bsng/backup.key                  # once, then keep it safe
age-keygen -y ~/.config/bsng/backup.key > ~/.config/bsng/backup.pub
backupsystem config set AGE_KEY "/home/you/.config/bsng/backup.pub"

With AGE_KEY set, archive writes <tree>-<id>.tar.zst.age and its .sha256, and the plaintext never touches the disk: tar streams its zstd output into age in a single pass, so a tar that fails halfway cannot be hidden by the last stage. The checksum covers the encrypted file, which is what travels.

tar -C /srv --acls --xattrs -I 'zstd -T0 -10' -cf - <snapshot> |
    age -R <AGE_KEY> > <snapshot>.tar.zst.age

archive --no-encrypt leaves one archive in clear even when AGE_KEY is set (it says so on the console); it is not a configuration change — the next run is encrypted again.

push sends the encrypted form when it exists, and otherwise warns — one line, naming the archive and the remote — because the provider can read a .tar.zst. UNENCRYPTED_PUSH decides: warn (default), refuse (exit 7), allow.

Restoring an encrypted archive is manual, on purpose: it needs the private key, which is by definition not on the machine that made the backup.

age -d -i ~/.config/bsng/backup.key -o /tmp/a.tar.zst a.tar.zst.age
tar -xf /tmp/a.tar.zst -C /mnt/restore-system

age refuses ecdsa SSH keys (ed25519 and RSA work); a private key named in AGE_KEY is refused by the configuration check, which says where it belongs.

Exercising a transport in seconds

backup --sample N writes a test snapshot instead of a backup: at most N regular files per tree, drawn at random, each under 10 MiB. Everything downstream works on it at full speed — verify, list, restore, prune, archive, push — because it is a real snapshot: manifest, metadata, and full checksums (the flag adds them, otherwise verify would have nothing to read).

The identifier carries the sample tag and the run says so on the console, so such a snapshot can never be mistaken for a backup:

sudo backupsystem backup --only data --sample 10
sudo backupsystem verify --part data --snapshot latest
sudo backupsystem restore --part data --to /var/tmp/essai --yes

Extended attributes and ACLs: what survives depending on the destination

-X copies xattrs, -A POSIX ACLs. Both cost at least one round trip per file on a network repository, and not everything can be stored everywhere — hence two distinct rules.

-A: depends on filesystem type, never on version

Destination POSIX ACLs
ext2/3/4, xfs, btrfs, tmpfs, jfs, ocfs2, gfs2 yes
zfs (depending on ACL enablement) often
NFS v2 / v3 no — protocol without ACLs
NFSv4 (4.0, 4.1, 4.2) no — NFSv4 transports its own ACL model (the Windows one), which the Linux client does not translate from POSIX
CIFS / SMB no — Windows ACLs, not POSIX
vfat, exfat, ntfs-3g, sshfs, rclone, most FUSE no

On NFS, the refusal is structural: no version upgrade unlocks it. rsync -aA then exits with code 23 (set_acl_file_at: Operation not supported) after paying one round trip per file for a refusal.

-A is therefore not requested by default (RSYNC_ARGS_FULL="-HXS"): on a desktop machine there is nothing to copy — 0 entries with ACLs measured on /home, /etc, /srv, /opt, /var of an ordinary Arch installation. Anyone who really has POSIX ACLs and a local destination can add it; the code then automatically removes it if the destination is network (nfs, nfs4, cifs, smb3, smbfs, fuse.sshfs, fuse.rclone), and the decision is written to the log.

-X: depends on the type and, for NFS, on the negotiated version

Destination user.* xattrs
ext2/3/4, xfs, btrfs, tmpfs yes
NFS v2 / v3 no — no named-attribute protocol
NFSv4.0 / 4.1 no — named attributes only exist in 4.2
NFSv4.2 yes, if the server implements RFC 8276, Linux client ≥ 5.9, regular file owned by you
CIFS / SMB variable (server-side EAs), often no
vfat, exfat, sshfs, rclone no

The difference in nature from -A: here the version matters, and server capability is only discovered at runtime. A 4.2 mount negotiated against a server without named attributes still fails; rsync exits with code 23, which backupsystemNG treats as a non-blocking warning (success_warnings) — the backup remains restorable.

-X is therefore requested only where it can succeed: it is automatically removed when the destination is an NFS mount earlier than 4.2 (vers= read from the mount options), or a filesystem that does not store attributes (vfat, exfat, sshfs, rclone). On v3 and v4.0/4.1, it is one round trip per file for a guaranteed EOPNOTSUPP. The decision is written to the log.

SELinux: recompute rather than archive

On a labelled distribution (Fedora, RHEL, CentOS), losing a file's security.selinux label does not degrade permissions: it breaks the service that uses it. The NFS client does not transport security.*, even in 4.2 — a backup to a NAS therefore loses labels, whatever the negotiated version.

Labels are not archived file by file: that would be hundreds of thousands of lines, and the policy knows how to recompute them. What is archived is what it cannot rebuild:

meta/selinux/status.txt     mode (getenforce), policy version, date
meta/selinux/semanage.txt   local rules — custom fcontexts, booleans,
                            labelled ports (semanage export, a few lines)

At restore time, if the target machine is labelled, backupsystemNG recalls the relabeling command; with SELINUX_RELABEL="true" it runs restorecon -R itself on the restored tree. Local rules are never imported automatically: semanage import modifies system-wide policy; that is an administrator decision.

For restoring the system part into a system root, there is something better than restorecon: placing the .autorelabel file at the target root. On next boot, selinux-autorelabel.service relabels the entire system with the target's policy and its own file_contexts — whereas a restorecon -R run from the live machine applies its policy. backupsystemNG therefore places it, but only when the conditions are met:

the source was labelled          meta/selinux/status.txt present in the snapshot
the target is a system root      it carries etc/ and usr/
it is not the current system     a restore into / requires a manual gesture
the target can read it           usr/lib/systemd/system/selinux-autorelabel.service

Otherwise it says so: a marker placed on a target that does not carry policycoreutils would serve no purpose. In --dry-run, the marker is announced but not written.

What is recorded even when the copy cannot carry it

File capabilities (setcap) do not transit an NFS repository. They are therefore recorded separately in meta/capabilities.txt. The scan is bounded to places where an executable can live — system, ~/.local/bin, ~/bin and visible directories of each account, plus CAP_ROOTS — and never the whole tree: getcap -r / does not finish in two minutes where this list takes a tenth of a second. Container image layers and caches are excluded. Original bounds: /usr/bin, /usr/sbin, /usr/lib, /usr/libexec, /usr/local/bin, /usr/local/sbin, /bin, /sbin, /opt. Recorded capabilities are replayed automatically at the end of a system restore. --no-capabilities skips it.

Exit codes

Code Meaning
0 success
1 unexpected failure (internal error, log, volatile repository)
2 usage error
3 invalid configuration
4 preflight refused (destination, mount, space, source)
5 backup failed
6 restore failed
7 archive / cloud failed
8 lock busy
9 action cancelled
10 integrity verification failed

Interactive interface (TUI)

sudo backupsystem tui            # or simply `backupsystem tui`: relaunches via pkexec
sudo backupsystem tui --ascii    # without a Nerd Font
backupsystem --user tui          # the account's own repository: no elevation

Gum menus with Nerd Font glyphs, same actions as the CLI (no duplicated logic: each choice calls the corresponding command):

󰒓  backupsystemNG 2.4.0 — machine
╭──────────────────────────────────────╮
│   Backup                             │  part selection, tag, checksums, dry-run
│   Restore                            │  snapshot, part, source, target
│   Snapshots                          │  table: id, status, size, files, latest · delete one
│   Verify                             │  structure, full checksums or sample
│   Prune                              │  policy from the config, preview before deletion
│   Archive                            │  tar.zst + SHA-256
│   Upload to the cloud                │  rclone
│   Scheduling                         │  status, preview, install, remove timers
│   Configuration                      │  show, check, edit
│   Diagnostic                         │  doctor
│   Quit                               │
╰──────────────────────────────────────╯

Details:

  • Mode in the header: the title names it and the frame follows — blue for --user (the account's repository), pink for the machine (root). The menu's cursor takes the same colour, from one source: frame and selection never disagree.
  • Timers one by one: the scheduling screen lists the timers actually installed for this configuration and lets you pick which ones to disable and delete (x toggles, enter confirms) — the whole-schedule removal is still there, one entry below.
  • A snapshot can be deleted from the snapshot screen: after the table it offers the repository's snapshots, newest first, one entry per snapshot even when both trees hold it, and deletes the chosen one after a single confirmation. Bulk deletion (delete backups all, store) stays in the CLI, where the repository name has to be typed back.
  • Elevation: launched without root, the TUI re-executes itself once via pkexec (Omarchy polkit agent, fingerprint) preserving --config/--config-dir. Under --user nothing is elevated: the process stays the account's, every command it runs carries --user with the account configuration, the screens offer the data family alone, and Upload to the cloud is not listed (push needs root).
  • Nerd Font: glyphs are Font Awesome icons from the PUA range, stable in Nerd Fonts v3. --ascii or BSNG_TUI_PLAIN=1 replaces them with text markers.
  • Scheduling: the menu shows the calendars of the configuration before asking anything, then offers to use them or to enter them by hand (empty = no timer for that job). A file with no calendar at all goes straight to the manual entry, and a plan with nothing to install and nothing to remove is not followed by an "install?" question. Prune works the same way: the policy comes from the configuration; when it keeps everything, the TUI says so and points at the configuration instead of re-asking for numbers.
  • Language: the menus, questions and messages of the TUI follow TUI_LANGUAGE (auto = the locale, fr, en). Only the TUI is translated: the CLI, the run log and the manuals stay English, so a run started from the menu reads exactly like one started from a terminal. A catalogue entry missing from a translation falls back to English, never to a key name.
  • Cancellation: Esc at each step returns to the menu, without executing anything.
  • Long outputs (list, doctor, schedule show, prune preview) in Gum's pager.

Verification

verify reads the snapshot, never the live system: a snapshot is a point in time, so a machine that keeps changing never makes a verification "fail".

Two checks, and they do not say the same thing:

  • verify — integrity. It compares the snapshot against checksums.sha256, written at backup time. This is the only mode that detects silent corruption. Without checksums it refuses (exit 4) and names the two remedies: backup --checksums to produce them, verify --health for the light check. Falling back silently to readability would return "verified" for something else entirely.
  • verify --health — structure and readability: consistent manifest, STATUS=success, announced parts present, and real reads of a sample. Over ssh the sample is drawn on the server (only the selected regular files cross the network) and pulled bounded: at most 8 MiB per file and 32 MiB in total. The report relates read to asked when the tree holds fewer files than the sample size (files read: 254 of 300 asked). Catches a failing disk, an NFS returning errors, a part directory that vanished. Does not catch silent corruption — and the report says so.
sudo backupsystem verify                          # integrity (needs checksums)
sudo backupsystem verify --health                 # structure + sample read
sudo backupsystem verify --sample 200             # 200 fingerprints
sudo backupsystem verify --snapshot all           # every snapshot of the repository
sudo backupsystem verify --snapshot 2026-11-09T03-00-00+0100 --json

--snapshot all walks the whole repository — both trees, or the single tree named by --part — newest first, and closes on a summary line: verify all 12 snapshots · 11 verified, 1 failed · 3m12s. A snapshot without checksums is named and skipped there instead of stopping the walk: one old snapshot must not make the command useless on a repository that has history. The exit code stays 10 for snapshots that really failed or could not be read. With --json the walk returns a single document: one entry per snapshot, plus count, verified, failed, skipped and errors.

Fingerprints are controlled by CHECKSUMS: false (default), random (a byte-budgeted sample), full (every file). backup --checksums forces full for one run.

CHECKSUM_SAMPLE sets that budget: 512M by default, 5G for a wider check, 0 to read everything. Files are drawn at random until the budget runs out, with a 32 MiB per-file cap — so the cost depends neither on the snapshot size nor on what the draw finds, and verify reports the covered volume and its share: "100 fingerprints — 512 MiB of 41 GiB (1.2%)".

Cost is one full read of the snapshot per backup:

  • local: around 2 GiB/s (measured on an Apple Silicon laptop); a spinning disk is slower, the nature of the check does not change;
  • network mount (NFS, CIFS): the link speed, since the whole snapshot crosses the network — at 70 MiB/s, about 14 s per GiB;
  • ssh transport: the computation runs on the server, through bsng-verify, which prepare-nas.sh installs there — no data comes back, and it reads at the server's disk speed. That is what makes CHECKSUMS usable without mounting anything.

doctor prints that cost for the configured destination.

Exit code 10 if a check fails, which makes verification usable from a timer or monitoring.

Restoring: original layout or a flattened tree

A backup is a file-level image: rsync crosses every mount point and merges everything into one tree (no -x). Restoring into a directory therefore writes /boot/efi on the root filesystem and folds /home or /var into /.

restore reads the snapshot's fstab, reports the layout before restoring, and lets you choose:

sudo backupsystem restore --to /mnt/restore --mkdir --part system          # asks
sudo backupsystem restore --to /mnt/restore --mkdir --part system --layout=smart
sudo backupsystem restore --to /mnt/restore --mkdir --part system --layout=flat
  • --layout=auto (default): shows the layout, asks, and mounts the existing partitions under the target when you agree — the restore then lands in the original layout. Without a terminal it flattens, and says so.
  • --layout=smart: requires the original layout. A device named by fstab that does not exist makes it refuse (exit code 4) and say which — a half-faithful system is worse than a frankly flat tree.
  • --layout=flat: accepts the flattened tree, explicitly.

Partitions mounted for the restore are unmounted on exit, Ctrl-C included. A device already mounted elsewhere (the running system's ESP, for instance) makes smart refuse: writing to the wrong place would be worse.

swap, tmpfs, network and bind entries are not partitions to remount: they are skipped.

Restore scenarios, and what the tool does

situation behaviour
empty directory, original partitions present auto offers to mount them; smart requires it
btrfs root with subvolumes the root is mounted too (subvol=@); options come from the real mount (meta/mounts.txt), not from fstab
recreated partition (new UUID) matched by filesystem type and capacity: the snapshot's data must fit, not the original partition size; the destination's fstab is rewritten, the original kept as fstab.avant-restauration
size floors /boot: 2 GiB whatever it currently holds (future kernels); ESP on /boot/efi: 250 MiB; an ESP mounted on /boot therefore falls back to 2 GiB. Distributions differ — /boot+/boot/efi, ESP alone, or /boot alone: fstab decides, nothing is assumed
explicit /dev/… path missing no substitution: refused (LUKS/LVM container to open, or --layout-map)
original system on LVM / LUKS / RAID detected at backup time (meta/storage.txt, lsblk TYPE=lvm|crypt|raid) and announced before the restore: recreate the volumes (vgcreate/lvcreate) and open the containers (cryptsetup luksFormat then open) first — the LUKS header is not in the backup, which holds files only
several partitions big enough refused, with the list: the tool does not guess. --layout-map '/boot=/dev/sdb1' decides
closed LUKS/LVM container (/dev/mapper/… missing) refused, naming the remedy (cryptsetup open, vgchange -ay)
in-place restore (--to / --in-place) nothing to mount: the layout is already the running system's
--part data no layout: data trees are not systems
not enough space in the target refused before writing, with both figures (--force to override)
brand-new disk, no partitions out of scope: that is disk restore (repartitioning), not implemented yet
interrupted restore files already written are kept, explicit message, mounts undone

Shell completion

  • zsh: share/completions/_backupsystem (commands, options, closed value sets)
  • bash: share/completions/backupsystem.bash (same values; --snapshot offers real identifiers, falling back to latest when the repository is unreachable)

make install-completion installs both, where each shell expects them (share/zsh/site-functions, share/bash-completion/completions).

Repairing a restored system: chroot

A restore only puts files back. Acting on them (reinstalling a bootloader, resetting a password, fixing packages) needs a shell inside that tree, with /proc, /sys, /dev and /dev/pts in place.

sudo backupsystem restore --snapshot latest --part system --to /mnt/restore --mkdir --chroot
sudo backupsystem chroot --to /mnt/restore          # come back later
sudo backupsystem chroot --to /mnt/restore --shell /bin/sh
  • the tool mounts the pseudo-filesystems and unmounts them on exit (Ctrl-C included): you chain commands inside the shell, not outside;
  • /etc/resolv.conf is not copied: the tree stays as restored;
  • refuses a target that is not a system (no /bin/sh), root, or a tree with filesystems already mounted under it (--force to override);
  • warns when the restored architecture differs from the machine's.

Automation: systemd, not cron

Units are generated by the CLI (a single source of truth) and installed system-level in /etc/systemd/system:

sudo backupsystem schedule install                     # weekly system 03:00, daily data 02:00, prune after each
sudo backupsystem schedule install --daily 03:30       # both backup calendars at 03:30
sudo backupsystem schedule install --calendar "Mon,Thu *-*-* 05:15"
sudo backupsystem schedule install --no-prune          # snapshots only
sudo backupsystem schedule install --archive-calendar "*-*-1,15 04:30"   # + archive and push, twice a month
sudo backupsystem schedule install --dry-run           # the plan only: no unit, no timer enabled
sudo backupsystem schedule install --prune-calendar-system ""   # that one timer off, the rest untouched
sudo backupsystem schedule show                        # preview units, write nothing
sudo backupsystem schedule status                      # timer status
sudo backupsystem schedule remove                      # disable and delete
sudo backupsystem schedule remove --timer backup-data  # disable and delete only that timer

What is generated: four units, one pair per family — backupsystem-backup-system.{service,timer}, backupsystem-prune-system.{...}, backupsystem-backup-data.{service,timer}, backupsystem-prune-data.{...}. Each service carries --only system or --only data: a unit never touches the other tree. Calendars come from SCHEDULE_SYSTEM_CALENDAR, SCHEDULE_DATA_CALENDAR, PRUNE_SYSTEM_CALENDAR and PRUNE_DATA_CALENDAR. With several configuration files, unit names carry the file stem of the one they were installed for (local.conf → backupsystem-backup-system-local); the default backupsystemNG.conf keeps the bare names, so one installation never overwrites another. Under --user every name ends with -user (see Running without root above) — the two managers never share a name.

One job can be re-decided for one run without touching the file: --backup-calendar-system, --backup-calendar-data, --prune-calendar-system and --prune-calendar-data each name one calendar, and an empty value removes that timer alone. --dry-run prints the plan and touches nothing — no unit written, no timer enabled.

schedule remove alone is all-or-nothing: every timer of this configuration is disabled and deleted. --timer NAME narrows it to the ones you name — --timer backup-data --timer archive, in the short form or as a unit name, with or without .timer — and --dry-run then lists what would go without touching anything. A name this configuration does not own is refused (exit code 2) rather than guessed at: a typo must not remove a timer that belongs to something else.

A unit exists only if its calendar is set: leave SCHEDULE_DATA_CALENDAR empty and no data snapshot timer is installed (an installed one is removed) — so a configuration that declares only some calendars installs only those. A family disabled by BACKUP_SYSTEM=false / BACKUP_DATA=false gets neither unit — only its backup and its prune calendar matter for a tree this configuration actually writes. Persistent=true catches up a missed run after shutdown, RandomizedDelaySec prevents the whole fleet from starting at the same second, Nice/IOSchedulingClass=idle limit the impact.

A fifth pair, backupsystem-archive.{service,timer}, runs archive then push for both trees' latest snapshots (one archive per tree, each sent with its .sha256). It is installed only when ARCHIVE_CALENDAR is set — a calendar such as *-*-1,15 04:30 for twice a month — or with --archive-calendar, and it needs ARCHIVE_DIR and RCLONE_REMOTE; schedule install refuses to write it otherwise. In the unit, push runs only if archive succeeded (two ExecStart lines in a Type=oneshot service stop at the first failure), and the rclone configuration of the user who ran sudo is recorded in the unit as RCLONE_CONFIG when the root one does not know the remote.

The service explicitly references the binary and configuration file used at install time. For a test without touching systemd: --unit-dir /tmp/units --no-systemctl.

The TUI (backupsystem tui) exposes these same actions in a "Scheduling" menu.

Email: two sends, not one

EMAIL and MAIL_COMMAND (default mail; bsng-mail is provided, which can go through an authenticated SMTP) trigger two messages:

  • successful run end — the full log, subject [host] backupsystemNG <id>;
  • failure — subject [host] backupsystemNG <id> — FAILURE, short body: exit code, error message, log path and its last 40 lines.

The second is the only one that matters when the run is launched by a timer: without it, a failed backup showed only through an exit code no one reads. An email not sent does not invalidate a successful run; an alert not sent does not invalidate the failure — both are reported by a WARN and the exit code does not change.

Sending needs a working mailer, and EMAIL alone does not provide one. MAIL_COMMAND names it:

  • mail (the built-in default) is only a front-end. Without an MTA — no /usr/sbin/sendmail — it fails with Cannot start /usr/sbin/sendmail, which is the normal state of a laptop;

  • msmtp does not fit as-is: the tool calls $MAIL_COMMAND -s <subject> <recipient>, which is mail(1)'s interface, and msmtp has no -s option — it wants a complete message on stdin. Pointing MAIL_COMMAND at msmtp gives msmtp: option invalide -- 's' on the first send. Use bsng-mail instead (same account file, same TLS handling), or wrap msmtp in a three-line script that writes the To:/Subject: headers:

      #!/bin/sh
      subj=; rcpt=
      while [ $# -gt 0 ]; do case $1 in -s) subj=$2; shift 2;; *) rcpt=$1; shift;; esac; done
      { printf 'To: %s\nSubject: %s\n\n' "$rcpt" "$subj"; cat; } | msmtp -a mailjet "$rcpt"
    
  • bsng-mail (installed by make install) does the same job without the msmtp binary and without an MTA, but it needs two things: python3, and an SMTP account file in msmtprc format (~/.config/msmtp/config by default, or BSNG_MAIL_CONFIG, /etc/backupsystemNG/mail.conf, /etc/msmtprc) — account, host, from, user, and password or passwordeval. The shipped configuration uses it by default.

Whatever the command, a failure is a WARN, never a failed backup — and the run tries the configured command once, then bsng-mail if it exists, so a machine whose mail cannot send still delivers its alerts.

Desktop notification at the end of a run

NOTIFY puts the same verdict on the screen instead of in a mailbox:

NOTIFY="failure"     # default: speaks up only when a run fails
NOTIFY="always"      # announces successful runs too
NOTIFY="off"         # says nothing

failure is the useful default for a timer: a run that works teaches nothing, a run that fails in silence is what you find three weeks later. The notification is not a second report to maintain — its body is the run's conclusion line, the same text --quiet leaves in the journal.

It is not distribution-specific, because it does not talk to a desktop: it uses the freedesktop notification service of the session (org.freedesktop.Notifications), the same contract on Arch, Fedora, Debian, Ubuntu or openSUSE, under GNOME, KDE, Sway or dunst. The first client found does the call — notify-send, else busctl (shipped with systemd, which the timers already require), else gdbus.

The one thing that is not automatic: a timer runs as root, in the system scope, with no session bus to talk to. The graphical session is found with loginctl and addressed as its owner. With no graphical session open — a server, a logged-out machine — there is nobody to tell, so nothing is sent, and that is not a failure. doctor says which of the two situations you are in.

When MAIL_COMMAND goes through sendmail (mail, msmtp, sendmail, s-nail), doctor also notices that msmtp looks for /etc/msmtprc when it runs as root — where a user's ~/.config/msmtp/config is invisible. If such a file exists and /etc/msmtprc does not, it offers to publish it as /etc/msmtprc: it asks first. A link does not change the target's permissions, so the file stays 0600 — root reads it (that is what the timer needs), its owner reads it, other users get a permission error. An existing /etc/msmtprc is never touched (a dangling link is reported instead).

doctor offers to send a real test message when EMAIL is set: it asks first ([yes/NO]), never asks under --json/--quiet, and sends one without a question only with --yes. The result is a row of its own, with the fallback reported separately.

bsng-mail reads the SMTP account declared in ~/.config/msmtp/config, without needing the msmtp binary. It follows msmtp conventions on the points that matter: certificate verified (tls_trust_file if declared, system CA otherwise), implicit TLS when tls_starttls off (port 465), refusal to authenticate without TLS, and passwordeval preferred over password — if the secret is in cleartext in a file readable by others, a warning says so.

Known limitations

  • Source paths containing spaces are not expressible in DATA_PATHS (separator = space). The destination, however, can contain them.
  • No rsync daemon and no CIFS repository: mount the NAS over NFS, or use --transport ssh (rsync then runs on the NAS itself). A SMB share rewrites the modes and cannot store owners, so it is refused as a destination — see Why a CIFS/SMB share cannot host a repository above. archive --output on the share remains fine.
  • Restore journals are not part of the retention: prune follows its snapshots (their journals go with them, and orphan journals are removed), but restore-*.log accumulates until delete logs.
  • --checksums rereads the whole snapshot on each backup: reserve it for systems whose size allows it, or run it occasionally.
  • File capabilities (setcap) do not survive on an NFS repository: NFS refuses the security.capability attribute, rsync then exits with code 23 (warning, snapshot marked success_warnings). The backup records them in meta/capabilities.txt and the restore reapplies them itself (setcap on the restored tree, paths prefixed by --to); --no-capabilities skips this step. The tar.zst archive preserves them on its side (--acls --xattrs), so the archive → restore path remains faithful.
  • -a, --delete, --numeric-ids and --stats are set by the code: RSYNC_ARGS_* keys only carry extra options (-H by default, -HXS for the system part). Do not put -a back — no effect, but misleading. The data part does not copy xattrs (-H vs -HXS): add X (and A for ACLs) if you depend on them. Note that config set currently refuses a value starting with "-": use config edit.
  • Unix sockets are copied, but cannot be archived. rsync -a includes --specials, so a socket node is recreated inside the snapshot — an inert file nothing listens on. Restoring one onto a live machine can make a service fail to bind if it does not unlink the path first. tar cannot store a socket: it skips it and the run says so in one line (sockets skipped · N sockets · tar cannot archive them). No exclusion pattern can drop them, because rsync filters names, never file types — to keep them out, name their paths (EXCLUDE_DATA) or accept them. FIFOs, by contrast, are copied and archived.
  • The TUI requires gum and a Nerd Font; --ascii does without.

Interface rule: every long action announces itself

An operation that can last more than a second must display an activity indicator — the step's name, and a clock that keeps moving. A frozen terminal without explanation is a defect, not a detail: the user cannot distinguish "it's working" from "it's broken", and ends up killing the process — which, on a backup, costs the entire run.

Wrapped, among others: rsync transfers, the exclusion survey, checksum computation, the capability survey, snapshot deletion, archiving and restoration.

And the indicator must never lie: a deduplicated transfer circulates almost no bytes, so it displays the number of entries processed; when bytes remain at zero, the rate column says so explicitly ("links").

For contributors

./check.sh lints the shell (shellcheck, zero findings) and runs the whole test suite; make test runs the suite alone. The cases build a complete sandbox — fake source, destination and configuration — and exercise backup, hardlink deduplication, restore, safeguards, retention, archive and deletions. None of them needs root, a real disk or a network.

License

GPL-3.0-or-later. See LICENSE.

About

Backup your data and the entire system through rsync Snapshots (deduplication)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages