manifest.json missing with certain exclude patterns #1122
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Trying to use
config bootstrapand discovered a backup is missing the manifest stuff.Steps to reproduce
Use a fairly stock config, with this exclude config:
Actual behavior
borg(matic) chose a runtime dir under
/tmp, and upon listing the archive,manifest.jsonis missing.Expected behavior
Even though
/tmpis excluded, I thoughtborgmaticwould still include it's manifest.Other notes / implementation ideas
No response
borgmatic version
2.0.7
borgmatic installation method
pipx
Borg version
borg 1.4.1
Python version
Python 3.9.5
Database version (if applicable)
No response
Operating system and version
NAME="Ubuntu" VERSION="20.04.6 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.6 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal
Thanks for filing this! I'll see if I can reproduce it and let you know. (I'm not sure at this point though if the solution is just documenting this interaction better.)
This does repro for me locally when I exclude
/tmpand the runtime directory is in there. Unfortunately there's not a good way for borgmatic to override the exclude, because!in a pattern indicates to Borg not to recurse into that directory (even when there's an explicit+include for another path inside of it).There is actually some existing borgmatic logic that errors if you inadvertently exclude the runtime directory as is the case here, but it's only triggered for a different use case (when databases are enabled). That may need to change.
Hi @witten and thanks for looking into it.
So what is the solution (or I guess more accurately, the workaround)? Referring to here, we have what I see the following issues:
user_runtime_directoryXDG_RUNTIME_DIR/tmpI guess, overall, this feature assumes backing up "temporary" directories.
(Oh, also, the doco around runtime is currently in a section/page about database backups as you'd of course know... though originally for them, I guess it's scope grew and it belongs elsewhere?)
The workaround is for the user to avoid excluding any path containing the runtime directory! 😄 As for a "solution," my plan is to look into whether borgmatic can be made smart enough to warn the user (or outright error) when it detects that the runtime directory has been excluded. No promises though.
I'm not sure what you mean here. The items numbered 2 through 6 in the linked documentation are the default if
user_runtime_directoryisn't set. Or are you saying those defaults aren't sane?The piece that you may be missing here is that borgmatic rewrites the borgmatic runtime directory on its way into the Borg archive (assuming you're using Borg version 1.4+, which it looks like you are). So for instance if
XDG_RUNTIME_DIRis/run/user/1000and borgmatic therefore uses/run/user/1000/borgmaticfor its runtime directory, that path won't show up in the Borg archive as/run/user/1000/borgmatic. Instead, it'll show up as a fixed/borgmaticwithin the archive due to the magic of path rewriting.Same thing here. Any borgmatic runtime directory in
/tmpwill get rewritten on its way into the archive—assuming it doesn't get inadvertently excluded as per the original issue.Totally. In general, the documentation could benefit from some refactoring. See #942.
Okay, this is implemented in main and will be part of the next release. To be clear, this will error when borgmatic's runtime directory is excluded; you're still on the hook to un-exclude it after getting that error.
Thanks again for the ticket!
Nice one, thanks!
Released in borgmatic 2.0.8!