Permissions error with pre-backup hook using Borgmatic #948

Closed
opened 2024-11-30 20:31:21 +00:00 by bcaradima · 5 comments

What I'm trying to do and why

I've set up my Synology NAS to upload nightly Borg backups to Borgmatic based on the official tutorial. Just recently, I started receiving "inactive repository" emails and I've been investigating with email support from Borgmatic.

I tried running the backups manually after SSH'ing into my NAS using the verbose commands below, and the error suggests it's a DB-related permissions issue that I'm struggling to troubleshoots. Borgmatic support thinks it's due to NAS systems being quite locked down out-of-the-box and that makes sense; they suggested I disable pre-backup hooks one at a time to see which one is causing the issue, but my YML has no DB-related commands to disable and I'm not sure where to turn.

I was directed to this page, which I find doesn't really have relevant info for troubleshooting permissions issues. I'm a bit stuck and could use some help, as I'm just trying to get my nightly backups working again.

Regards
Bogdan

Steps to reproduce

My borgmatic.yml file is:

source_directories:
     - /volume1/homes/mbc/Archive
     - /volume1/homes/mbc/Doctorate
     - /volume1/homes/mbc/Documents
     - /volume1/homes/mbc/Pictures

repositories:
    - path: ssh://xxxxxxxxxxxxxxxx.repo.borgbase.com/./repo
      label: "ds220 on BorgBase"

# Stay in same file system (optional)
# one_file_system: true

compression: auto,zstd
encryption_passphrase: xxxxxxxx
archive_name_format: '{hostname}-{now:%Y-%m-%d-%H%M%S}'

# Number of times to retry a failing backup before giving up.
retries: 5
retry_wait: 5

keep_daily: 7
keep_weekly: 4
keep_monthly: 6

checks:
    - name: disabled
    # Uncomment to regularly read all repo data
    # - name: repository
    #   frequency: 4 weeks
    # - name: archives
    #   frequency: 8 weeks

check_last: 3

# Shell commands to execute before or after a backup
before_backup:
    - echo "`date` - Starting backup"

after_backup:
    - echo "`date` - Finished backup"

Actual behavior

When I try to run my scheduled back up manually via the terminal, I get the following error:

mbc@ds220:~$ /usr/local/bin/borgmatic -v 2 -c /volume1/homes/mbc/borgmatic.yml create prune
/volume1/homes/mbc/borgmatic.yml: No commands to run for pre-everything hook
BORG_PASSPHRASE=*** BORG_RELOCATED_REPO_ACCESS_IS_OK=*** BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=*** BORG_EXIT_CODES=*** borg --version --debug --show-rc
/volume1/homes/mbc/borgmatic.yml: Borg 1.4.0
ds220 on BorgBase: Running actions for repository
/volume1/homes/mbc/borgmatic.yml: No commands to run for pre-actions hook
/volume1/homes/mbc/borgmatic.yml: Running command for pre-backup hook
echo "`date` - Starting backup"
Sat Nov 30 11:25:41 AM MST 2024 - Starting backup
ds220 on BorgBase: Creating archive
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling mariadb_databases hook function remove_data_source_dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing MariaDB data source dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling mysql_databases hook function remove_data_source_dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing MySQL data source dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling mongodb_databases hook function remove_data_source_dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing MongoDB data source dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling postgresql_databases hook function remove_data_source_dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing PostgreSQL data source dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling sqlite_databases hook function remove_data_source_dumps
ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing SQLite data source dumps
ds220 on BorgBase: Error running actions for repository
[Errno 13] Permission denied: '/run/user/1026'
ds220 on BorgBase: Retrying... attempt 1/5

Expected behavior

No response

Other notes / implementation ideas

No response

borgmatic version

1.9.0

borgmatic installation method

Synology package center

Borg version

1.4.0

Python version

Python 3.8.15

Database version (if applicable)

No response

Operating system and version

Synology DSM 7.2.2-72806 Update 2

### What I'm trying to do and why I've set up my Synology NAS to upload nightly Borg backups to Borgmatic based on the [official tutorial]([url](https://docs.borgbase.com/setup/borg/synology)). Just recently, I started receiving "inactive repository" emails and I've been investigating with email support from Borgmatic. I tried running the backups manually after SSH'ing into my NAS using the verbose commands below, and the error suggests it's a DB-related permissions issue that I'm struggling to troubleshoots. Borgmatic support thinks it's due to NAS systems being quite locked down out-of-the-box and that makes sense; they suggested I disable pre-backup hooks one at a time to see which one is causing the issue, but my YML has no DB-related commands to disable and I'm not sure where to turn. I was directed to this [page]([url](https://torsion.org/borgmatic/docs/how-to/backup-your-databases/)), which I find doesn't really have relevant info for troubleshooting permissions issues. I'm a bit stuck and could use some help, as I'm just trying to get my nightly backups working again. Regards Bogdan ### Steps to reproduce My borgmatic.yml file is: ``` source_directories: - /volume1/homes/mbc/Archive - /volume1/homes/mbc/Doctorate - /volume1/homes/mbc/Documents - /volume1/homes/mbc/Pictures repositories: - path: ssh://xxxxxxxxxxxxxxxx.repo.borgbase.com/./repo label: "ds220 on BorgBase" # Stay in same file system (optional) # one_file_system: true compression: auto,zstd encryption_passphrase: xxxxxxxx archive_name_format: '{hostname}-{now:%Y-%m-%d-%H%M%S}' # Number of times to retry a failing backup before giving up. retries: 5 retry_wait: 5 keep_daily: 7 keep_weekly: 4 keep_monthly: 6 checks: - name: disabled # Uncomment to regularly read all repo data # - name: repository # frequency: 4 weeks # - name: archives # frequency: 8 weeks check_last: 3 # Shell commands to execute before or after a backup before_backup: - echo "`date` - Starting backup" after_backup: - echo "`date` - Finished backup" ``` ### Actual behavior When I try to run my scheduled back up manually via the terminal, I get the following error: ``` mbc@ds220:~$ /usr/local/bin/borgmatic -v 2 -c /volume1/homes/mbc/borgmatic.yml create prune /volume1/homes/mbc/borgmatic.yml: No commands to run for pre-everything hook BORG_PASSPHRASE=*** BORG_RELOCATED_REPO_ACCESS_IS_OK=*** BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=*** BORG_EXIT_CODES=*** borg --version --debug --show-rc /volume1/homes/mbc/borgmatic.yml: Borg 1.4.0 ds220 on BorgBase: Running actions for repository /volume1/homes/mbc/borgmatic.yml: No commands to run for pre-actions hook /volume1/homes/mbc/borgmatic.yml: Running command for pre-backup hook echo "`date` - Starting backup" Sat Nov 30 11:25:41 AM MST 2024 - Starting backup ds220 on BorgBase: Creating archive ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling mariadb_databases hook function remove_data_source_dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing MariaDB data source dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling mysql_databases hook function remove_data_source_dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing MySQL data source dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling mongodb_databases hook function remove_data_source_dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing MongoDB data source dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling postgresql_databases hook function remove_data_source_dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing PostgreSQL data source dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Calling sqlite_databases hook function remove_data_source_dumps ssh://ooz6c649@ooz6c649.repo.borgbase.com/./repo: Removing SQLite data source dumps ds220 on BorgBase: Error running actions for repository [Errno 13] Permission denied: '/run/user/1026' ds220 on BorgBase: Retrying... attempt 1/5 ``` ### Expected behavior _No response_ ### Other notes / implementation ideas _No response_ ### borgmatic version 1.9.0 ### borgmatic installation method Synology package center ### Borg version 1.4.0 ### Python version Python 3.8.15 ### Database version (if applicable) _No response_ ### Operating system and version Synology DSM 7.2.2-72806 Update 2
Owner

Try upgrading borgmatic. The problem is that 1.9.0 introduced use of a new temporary directory, but that directory is not present on all systems—and I'm guessing that was the case on your NAS. 1.9.2 fixes this to support more systems via smarter temporary directory usage.

Try upgrading borgmatic. The problem is that 1.9.0 introduced use of a new temporary directory, but that directory is not present on all systems—and I'm guessing that was the case on your NAS. 1.9.2 fixes this to support more systems via smarter temporary directory usage.
witten added the
question / support
label 2024-11-30 22:03:17 +00:00
Author

Thanks for the suggestion, that sounds like a likely root cause. It seems that Borgmatic comes with the Borg package on the SynoCommunity package repo, so I'll have to wait for an update to the package before I can update either one. I'll report back if it works or not!

Thanks for the suggestion, that sounds like a likely root cause. It seems that Borgmatic comes with the Borg package on the SynoCommunity package repo, so I'll have to wait for an update to the package before I can update either one. I'll report back if it works or not!
Owner

Awesome, I'd appreciate that!

Awesome, I'd appreciate that!
witten added the
waiting for response
label 2024-12-01 06:34:55 +00:00
Author

SynoCommunity takes a long time to upgrade their packages, but I can finally confirm that upgrading to Borgmatic 1.9.5 resolved the problem. I should probably containerize Borgmatic instead of using Synology's package.

Thanks witten for your help!

SynoCommunity takes a long time to upgrade their packages, but I can finally confirm that upgrading to Borgmatic 1.9.5 resolved the problem. I should probably containerize Borgmatic instead of using Synology's package. Thanks witten for your help!
Owner

Awesome, glad to hear it!

Awesome, glad to hear it!
Sign in to join this conversation.
No Milestone
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#948
No description provided.