Borgmatic reports success but logs show stacktrace and no archive is created. #776
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#776
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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
I'm trying to run another backup for which I expect an archive to be added.
Upon running the following command:
borgmatic create --verbosity 1
The following output is produced:
When inspecting the archives using
borgmatic list
, no additional archives seem to have been produced.When using
--verbosity 2
the stacktrace appears after this log line:Steps to reproduce
Not entirely sure, here's part of my config from
/etc/borgmatic/config.yaml
:When I run borgmatic with strace I see these being written to the tmp file:
Actual behavior
Expected behavior
Other notes / implementation ideas
No response
borgmatic version
1.8.2
borgmatic installation method
OpenSUSE package (zypper)
Borg version
1.2.6
Python version
3.11.5
Database version (if applicable)
-
Operating system and version
NAME="openSUSE Tumbleweed" # VERSION="20231022"
Thanks for filing this! It looks like the traceback you're seeing is coming from Borg rather than borgmatic itself.
Yes, this sounds like a potential bug. borgmatic should be handling the Borg error more gracefully.
borgmatic relies on Borg to create the archive. So if Borg errors, it won't be created.
Ideally, yes. However there are cases where the best borgmatic can do is provide the exact error that Borg produces, as there may not be any additional information about the issue.
In any case, to determine the cause of your patterns issue and help reproduce the potential "success" bug, can I get a look at your entire configuration file? Feel free to redact anything you don't want to share.
Thank you!
@witten Thank you for the help, appreciated!
Turns out that if you spend time on writing a full bug report, you might as well not skip that tiny bit of effort to gather the full config. After copying the config and removing the comments through some regex, I discovered that I had a strange config for pattern exclusions. After correcting this, the issue was gone.
Culprit:
Fixed config:
At least this report can still be used to handle borg errors more gracefully.
I guess I didn't properly formulate my expectation for this case, it cannot be seen in isolation from the others (as in; either I expect a failure and nothing is created or I expect success and a created archive). I do understand the dependency.
Even pointing out that borg threw an exception and therefore borgmatic couldn't produce a new artifact would be productive guidance towards detecting and solving the issue. As
borgmatic create
without any arguments doesn't produce any output and still exited with code 0, it took adding the--verbose 2
flag to discover that something was failing underneath. After discovering the stacktrace and exception though, I'm the one to blame for misinterpreting the 'pattern' error, thought it was referring to the paths declared undersource_directories
somehow.Strangely, running
borgmatic config validate
didn't report any issues with that broken config.Yup, I'll see if I can reproduce the problem here and hopefully fix it.
I think that's because if you've got any patterns, borgmatic adds your source directories to them as root directories before passing the patterns to Borg. (Due to #574 and #590.) That's a work-around for a now-fixed Borg bug: https://github.com/borgbackup/borg/issues/6994
borgmatic's config validation just ensures that the configuration adheres to the schema. It doesn't actually parse the Borg patterns to make sure they're well-formed. Maybe that could be an enhancement though.
An update: I managed to get a repro on this issue. Just had to add an invalid pattern line like you described.
Edit: Borg is returning an exit code of 1, which indicates a warning rather than an error! That's why borgmatic is treating it as a success.
Edit 2: I filed a Borg ticket on this.
The underlying issue resulting in "success" has been fixed in Borg (not borgmatic), and will be part of the next Borg release (1.2.7). So I'm not going to try to work around the issue in borgmatic. Thanks again for filing this issue—it's the reason it got fixed in Borg!