Borg/Borgmatic error
I’m trying to use Borgmatic
(because it also backs up Databases).
It’s a sort of wrapper around Borg
.
It uses systemd to do the scheduling.
When I run it manually using :
$ sudo borgmatic --verbosity 1 --files
It WORKS. It does the backup and the pruning perfectly.
However…
In the systemd
borgmatic.service file the command to kick off the backup is:
ExecStart=systemd-inhibit
--who="borgmatic"
--why="Prevent interrupting scheduled backup"
/usr/bin/borgmatic --syslog-verbosity 1
This FAILS, giving me the following:
INFO /data/backup/borg_a: Pruning archives
INFO Failed to create/acquire the lock /data/backup/borg_a/lock.exclusive
([Errno 13] Permission denied: '/data/backup/borg_a/lock.exclusive')
Ahh, thinks me, it’s because it’s needs to be run as sudo.
So in the borgmatic.service
file I use:
/usr/bin/sudo borgmatic --syslog-verbosity 1
instead of
/usr/bin/borgmatic --syslog-verbosity 1
And then I get :
sudo: PERM_SUDOERS: setresuid(-1, 1, -1): Operation not permitted
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit
/usr/bin/sudo failed with exit status 1.
borgmatic.service: Main process exited, code=exited, status=1/FAILURE
borgmatic.service: Failed with result 'exit-code'.
Failed to start borgmatic backup.
It seems obvious that it NEEDS
the sudo password.
But how do I supply it automatically ???