Snapshot output shows excludes sometimes

I have 3 hosts I am backing up. One of them holds all the repositories and the other two access via sftp protocol. I originally made the first snapshot using Deja-dup from flatpak for the two Linux hosts. I couldn’t find Deja-dup for my Apple Studio. I installed restic via homebrew and ran it from command line.

Rather than have each host run restic at set times I decided to make a script on the host that had the disk that is holding the repositories. It ssh’s into each host and runs restic telling that host that the repository is of type sftp back to the host that executed the ssh command. All of that is working fine. I noticed something curious when I ran snapshot with the --json flag and passed it through jq to get a pretty version. For the snapshots that were created with deja-dup the output has an “excludes” section. But the snapshots that have been made since then from the command line does not show an “excludes” section.

$ restic -r /backups/minibox --insecure-no-password snapshots --json | jq .
<stuff>
 "excludes": [
      "/dev",
      "/dev/*",
      "!/home/chrisk",
      "/home/chrisk/.cache",
      "/home/chrisk/.cache/*",
      "/home/chrisk/.local/share/Trash",
      "/home/chrisk/.local/share/Trash/*",
      "/home/chrisk/.var/app/org.gnome.DejaDup/cache",
      "/home/chrisk/.var/app/org.gnome.DejaDup/cache/*",
      "/home/chrisk/.var/app/org.gnome.DejaDup/cache/deja-dup",
      "/home/chrisk/.var/app/org.gnome.DejaDup/cache/deja-dup/*",
      "/home/chrisk/Downloads",
      "/home/chrisk/Downloads/*",
      <more stuff>
],
    "tags": [
      "deja-dup"
    ],
    "program_version": "restic 0.17.3",

You can see that deja-dup from flatpak uses 0.17.3 to create this snapshot. Deja-dup has a GUI and suggested Trash and Downloads be excluded, which I checked. I am not sure where the others came from. They do seem like reasonable things to exclude. I assume Deja-dup imposes this.

For the snapshots that were created from the command line version I have there is no exclude section. From the same output as the command above the version for those snapshots show:

"program_version": "restic 0.18.1-dev (v0.18.1-188-g3e6b5c34c)",

So, those snapshots were created using 0.18.1. For the command line snapshots I use the following command:

$ ssh usr@minibox.local restic -r sftp:cretodev.local:/backups/minibox --insecure-no-password backup --exclude-file /home/usr/Management/config/restic_excludes.txt --files-from /home/user/Management/config/restic_backup_list.txt

The restic_excludes.txt file has this contents

/home/user/Downloads/
/home/chrisk/.local/share/Trash/

The restic_backup_list.txt file has:

/home/user/
/var/spool/cron/crontabs/user

When I listed the files in the latest snapshot I could not find the files to be excluded. So, I think the correct thing is happening. Like I said everything seems to be working.

My question is why does the Deja-dup snapshot have an exclude section but my command line versions do not?

I don’t know if I am missing some option to add the exclude list or not. I couldn’t find an option that seemed to indicate that.

This is just a curiosity. I can’t say I need the exclude section but it seems nice to know that at the time of that snapshot what the exclude list was.

Thanks

Chris

I don’t know the answer but if I had to guess it would be because the excludes are listed in a file vs your original app that was probably listing them on the cli directly. Try adding the excludes via the cli, does that show them in the metadata?

I actually came across this behaviour a few days ago when testing something else. I saw the same behaviour as you have. Specifically, if you pass the paths to exclude via --exclude, they show up in the snapshot metadata. However, if you pass the paths to exclude via --exclude-file, they don’t.

I thought that may be the issue. I wonder what the logic is there. At any rate my curiosity is satisfied.

Thanks

Chris

Feel free to open a bug on Github.

Sure, will do. I assumed the existing behaviour was as-intended, hence the lack of action.

Edit: Actually, it looks someone beat me to it, back in 2019 :grin: