soft failure via findmnt not working #631
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#631
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 have multiple borgmatic configurations (yaml files). Some of them are run weekly, while some are for removable hard drives. To not throw errors when my running borgmatic, there is the
before_backup
hook with thefindmnt
command as explained in https://torsion.org/borgmatic/docs/how-to/backup-to-a-removable-drive-or-an-intermittent-server/.Steps to reproduce (if a bug)
I would expect to not receive an email, as the soft failure should not trigger them. The relevant section of my configurations looks like this:
Actual behavior (if a bug)
I get an email alert every week for every removable hard drive which borgmatic can not backup to. Running the relevant configuration with verbosity level 2:
Expected behavior (if a bug)
I should not get any email alert, the soft failure hook should prevent that.
Environment
borgmatic version: 1.7.5
borgmatic installation method: python pip
Borg version: 1.2
Python version: 3.10.6
operating system and version: Ubuntu 22.04
Based on the content of the error message, it looks like Borg itself is raising an error, specifically about:
However, your
before_backup
findmnt
command is running on an apparently different mount point:/media/daniel/wd_book
. So is it possible that Borg is just being given the wrong path? Or that thefindmnt
command path needs tweaking?Ah sorry, that was my mistake. I copied the wrong configuration file. The respective one is actually using
- findmnt /media/daniel/externe > /dev/null || exit 75
So the
findmnt
command and the log have the same mount point.From the log is seems to not run the
before_backup
hook, as it starts pruning. I tried using thebefore_everything
hook, but that also does not seem to work, it complains that it exited with error code 75. All in red font.Ah, good find, that's it! The
before_backup
hook only runs for thecreate
action. So you could use thebefore_prune
hook to run for the prune action. Or if you want this to run for all actions (which probably makes sense for this case), trybefore_actions
. (Documentation here. I'll also add this to the removable drive docs so it's easier to find.)before_everything
didn't work for you because it doesn't support soft failures. (This is documented in the caveats and details.)Ah perfect, with the
before_actions
hook it works as expected now. Thanks a lot!Glad to hear that did it!