Behavior change in 1.5.7 with missing locations #387

Closed
opened 2021-01-27 16:23:24 +00:00 by sysedit · 4 comments

Not sure if this is a bug or if the change was intented (I assume it's linked to issue #333 fixed in 1.5.7): if you have optional files to backup, missing files was not an issue until borgmatic 1.5.7.

Now it fails with:

xxx/backups/repository: Error running actions for repository
[Errno 2] No such file or directory: '/xxx/supervisor/extras'
/xxx/borgmatic.conf: Error running configuration file

I can likely workaround by using patterns in the configuration file, but I was curious if this was intented or if this is a bug / side effect of another fix.

Not sure if this is a bug or if the change was intented (I assume it's linked to issue #333 fixed in 1.5.7): if you have optional files to backup, missing files was not an issue until borgmatic 1.5.7. Now it fails with: xxx/backups/repository: Error running actions for repository [Errno 2] No such file or directory: '/xxx/supervisor/extras' /xxx/borgmatic.conf: Error running configuration file I can likely workaround by using patterns in the configuration file, but I was curious if this was intented or if this is a bug / side effect of another fix.
Owner

Thanks for filing this!

Could a get a look at your configuration file, specifically your source_directories and one_file_system value? And could you also let me know whether your various source_directories are on different filesystems? The partial output of running mount might help with that.

What I'm trying to figure out with all this: Would your "missing" file have been de-deduplicated prior to #333 and now is no longer deduplicated? That in theory could result in the error you're seeing, since the missing directory would now be passed to Borg... And Borg would of course get angry about it being missing.

Thanks for filing this! Could a get a look at your configuration file, specifically your `source_directories` and `one_file_system` value? And could you also let me know whether your various `source_directories` are on different filesystems? The partial output of running `mount` might help with that. What I'm trying to figure out with all this: Would your "missing" file have been de-deduplicated prior to #333 and now is no longer deduplicated? That *in theory* could result in the error you're seeing, since the missing directory would now be passed to Borg... And Borg would of course get angry about it being missing.
witten added the
question / support
label 2021-01-28 23:51:18 +00:00
Author

Here's our configuration file:

location:
    source_directories:
        - /usr/local/filewave/certs
        - /usr/local/filewave/apache/conf/httpd.conf
        - /usr/local/filewave/apache/conf/httpd_custom.conf
        - /usr/local/filewave/apache/conf/httpd_webadmin.conf
        - /usr/local/filewave/apache/conf/mdm_auth.conf
        - /usr/local/filewave/django/filewave/settings_custom.py
        - /usr/local/filewave/apache/passwd
        - /usr/local/filewave/conf/user_postgresql.conf
        - /usr/local/etc/filewave/supervisor/extras
        - /usr/local/etc/filewave/mtail/progs
        - /usr/local/etc/filewave/prometheus/conf.d/jobs/http
        - /usr/local/etc/filewave/prometheus/conf.d/jobs/https
        - /usr/local/filewave/instrumentation_data
    exclude_patterns:
        - /usr/local/filewave/instrumentation_data/grafana/plugins
        - /usr/local/filewave/instrumentation_data/prometheus
    repositories:
        - /usr/local/filewave/fwxserver/Data Folder/backups/repository
    local_path: /usr/local/filewave/python/bin/borg
storage:
    compression: zlib
    archive_name_format: 'pre-upgrade-backup-{now}'
    borg_cache_directory: /usr/local/filewave/fwxserver/Data Folder/backups/cache
    borg_security_directory: /usr/local/filewave/fwxserver/Data Folder/backups/security
retention:
    keep_within: 1y
    prefix: 'pre-upgrade-backup'
consistency:
    checks:
         - repository
         - data
    check_last: 3
    prefix: 'pre-upgrade-backup'
hooks:
    postgresql_databases:
        - name: mdm
          port: 9432
          username: django
          options: --encoding=UTF8 -N committed_* -c

And it should always be the same FS:

/dev/mapper/centos_centos7-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

with:

# /usr/local/filewave/python/bin/borgmatic --version
1.5.5
# /usr/local/filewave/python/bin/borgmatic -c /usr/local/etc/filewave/backups/on-premise-pre-upgrade.conf --log-file /usr/local/filewave/log/pre-upgrade-backup.log --log-file-verbosity=1

this works without any issue.

Now I upgrade to 1.5.7:

 /usr/local/filewave/python/bin/borgmatic --version
1.5.7
 /usr/local/filewave/python/bin/borgmatic -c /usr/local/etc/filewave/backups/on-premise-pre-upgrade.conf --log-file /usr/local/filewave/log/pre-upgrade-backup-1.5.7.log --log-file-verbosity=1
/usr/local/filewave/fwxserver/Data Folder/backups/repository: Error running actions for repository
[Errno 2] No such file or directory: '/usr/local/filewave/apache/conf/httpd_webadmin.conf'
/usr/local/etc/filewave/backups/on-premise-pre-upgrade.conf: Error running configuration file

summary:
/usr/local/etc/filewave/backups/on-premise-pre-upgrade.conf: Error running configuration file
/usr/local/filewave/fwxserver/Data Folder/backups/repository: Error running actions for repository
[Errno 2] No such file or directory: '/usr/local/filewave/apache/conf/httpd_webadmin.conf'

Need some help? https://torsion.org/borgmatic/#issues

Indeed, the file httpd_webadmin.conf is not there ; we provide a .conf.example file which can be renamed .conf if needed, and we want to backup this file if it exists.

ls -al /usr/local/filewave/apache/conf/
total 228
drwxr-xr-x.  4 apache apache  4096 Feb  3 07:36 .
drwxr-xr-x. 16 root   root     194 Feb  3 07:36 ..
-rwxr-xr-x.  1 root   root   21420 Feb  3 05:17 default_httpd.conf
-rwxr-xr-x.  1 root   root   21423 Feb  3 05:17 default_httpd.conf.orig
-rwxr-xr-x.  1 root   root    1159 Feb  3 05:17 default_mdm_auth.conf
drwxr-xr-x.  2 root   root    4096 Feb  3 07:35 extra
-rwxr-xr-x.  1 root   root   21420 Feb  3 07:35 httpd.conf
-rwxr-xr-x.  1 root   root   19118 Jan 29 05:21 httpd.conf.bak
-rwxr-xr-x.  1 root   root   21423 Feb  3 04:46 httpd.conf.orig
-rw-r--r--.  1 root   root       0 Feb  3 07:36 httpd_custom.conf
-rwxr-xr-x.  1 root   root    2058 Feb  3 05:17 httpd_webadmin.conf.example
-rwxr-xr-x.  1 root   root   13064 Jan 29 05:21 magic
-rwxr-xr-x.  1 apache apache  1159 Feb  3 07:35 mdm_auth.conf
-rwxr-xr-x.  1 apache apache  1159 Feb  3 07:35 mdm_auth.conf.bak
-rwxr-xr-x.  1 root   root    1172 Feb  3 04:46 mdm_auth.conf.example_basic_auth
-rwxr-xr-x.  1 root   root    2587 Feb  3 04:46 mdm_auth.conf.example_ldap_auth
-rwxr-xr-x.  1 root   root     282 Feb  3 04:46 mdm_auth.conf.example_no_auth
-rwxr-xr-x.  1 root   root   60847 Jan 29 05:21 mime.types
drwxr-xr-x.  3 root   root      19 Feb  3 07:35 original
[root@centos7 ~]#

I could not find any explicit reason for this change in change log. The new behavior seems legit (even if it would be nice to have optional file list), but I wanted to make sure this has been done on purpose (or to check if we're using borgmatic properly).

Thanks !

Here's our configuration file: ``` location: source_directories: - /usr/local/filewave/certs - /usr/local/filewave/apache/conf/httpd.conf - /usr/local/filewave/apache/conf/httpd_custom.conf - /usr/local/filewave/apache/conf/httpd_webadmin.conf - /usr/local/filewave/apache/conf/mdm_auth.conf - /usr/local/filewave/django/filewave/settings_custom.py - /usr/local/filewave/apache/passwd - /usr/local/filewave/conf/user_postgresql.conf - /usr/local/etc/filewave/supervisor/extras - /usr/local/etc/filewave/mtail/progs - /usr/local/etc/filewave/prometheus/conf.d/jobs/http - /usr/local/etc/filewave/prometheus/conf.d/jobs/https - /usr/local/filewave/instrumentation_data exclude_patterns: - /usr/local/filewave/instrumentation_data/grafana/plugins - /usr/local/filewave/instrumentation_data/prometheus repositories: - /usr/local/filewave/fwxserver/Data Folder/backups/repository local_path: /usr/local/filewave/python/bin/borg storage: compression: zlib archive_name_format: 'pre-upgrade-backup-{now}' borg_cache_directory: /usr/local/filewave/fwxserver/Data Folder/backups/cache borg_security_directory: /usr/local/filewave/fwxserver/Data Folder/backups/security retention: keep_within: 1y prefix: 'pre-upgrade-backup' consistency: checks: - repository - data check_last: 3 prefix: 'pre-upgrade-backup' hooks: postgresql_databases: - name: mdm port: 9432 username: django options: --encoding=UTF8 -N committed_* -c ``` And it should always be the same FS: ``` /dev/mapper/centos_centos7-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota) ``` with: ``` # /usr/local/filewave/python/bin/borgmatic --version 1.5.5 # /usr/local/filewave/python/bin/borgmatic -c /usr/local/etc/filewave/backups/on-premise-pre-upgrade.conf --log-file /usr/local/filewave/log/pre-upgrade-backup.log --log-file-verbosity=1 ``` this works without any issue. Now I upgrade to 1.5.7: ``` /usr/local/filewave/python/bin/borgmatic --version 1.5.7 /usr/local/filewave/python/bin/borgmatic -c /usr/local/etc/filewave/backups/on-premise-pre-upgrade.conf --log-file /usr/local/filewave/log/pre-upgrade-backup-1.5.7.log --log-file-verbosity=1 /usr/local/filewave/fwxserver/Data Folder/backups/repository: Error running actions for repository [Errno 2] No such file or directory: '/usr/local/filewave/apache/conf/httpd_webadmin.conf' /usr/local/etc/filewave/backups/on-premise-pre-upgrade.conf: Error running configuration file summary: /usr/local/etc/filewave/backups/on-premise-pre-upgrade.conf: Error running configuration file /usr/local/filewave/fwxserver/Data Folder/backups/repository: Error running actions for repository [Errno 2] No such file or directory: '/usr/local/filewave/apache/conf/httpd_webadmin.conf' Need some help? https://torsion.org/borgmatic/#issues ``` Indeed, the file httpd_webadmin.conf is not there ; we provide a .conf.example file which can be renamed .conf if needed, and we want to backup this file if it exists. ``` ls -al /usr/local/filewave/apache/conf/ total 228 drwxr-xr-x. 4 apache apache 4096 Feb 3 07:36 . drwxr-xr-x. 16 root root 194 Feb 3 07:36 .. -rwxr-xr-x. 1 root root 21420 Feb 3 05:17 default_httpd.conf -rwxr-xr-x. 1 root root 21423 Feb 3 05:17 default_httpd.conf.orig -rwxr-xr-x. 1 root root 1159 Feb 3 05:17 default_mdm_auth.conf drwxr-xr-x. 2 root root 4096 Feb 3 07:35 extra -rwxr-xr-x. 1 root root 21420 Feb 3 07:35 httpd.conf -rwxr-xr-x. 1 root root 19118 Jan 29 05:21 httpd.conf.bak -rwxr-xr-x. 1 root root 21423 Feb 3 04:46 httpd.conf.orig -rw-r--r--. 1 root root 0 Feb 3 07:36 httpd_custom.conf -rwxr-xr-x. 1 root root 2058 Feb 3 05:17 httpd_webadmin.conf.example -rwxr-xr-x. 1 root root 13064 Jan 29 05:21 magic -rwxr-xr-x. 1 apache apache 1159 Feb 3 07:35 mdm_auth.conf -rwxr-xr-x. 1 apache apache 1159 Feb 3 07:35 mdm_auth.conf.bak -rwxr-xr-x. 1 root root 1172 Feb 3 04:46 mdm_auth.conf.example_basic_auth -rwxr-xr-x. 1 root root 2587 Feb 3 04:46 mdm_auth.conf.example_ldap_auth -rwxr-xr-x. 1 root root 282 Feb 3 04:46 mdm_auth.conf.example_no_auth -rwxr-xr-x. 1 root root 60847 Jan 29 05:21 mime.types drwxr-xr-x. 3 root root 19 Feb 3 07:35 original [root@centos7 ~]# ``` I could not find any explicit reason for this change in change log. The new behavior seems legit (even if it would be nice to have optional file list), but I wanted to make sure this has been done on purpose (or to check if we're using borgmatic properly). Thanks !
Owner

First of all, I sincerely apologize for letting this ticket languish for so long. I've dug into the issue, and I believe you are right—this is a regression! What happened is that in #333, introduced in borgmatic 1.5.7, the code to deduplicate source directories started calling Python's os.stat() on each path. Which meant that if a source directory wasn't present on the filesystem, borgmatic errored.

So the fix I made is to only call os.stat() if the source directory is actually present. Now, all source directories get passed to Borg. And like with the pre-1.5.7 borgmatic behavior, Borg complains about missing directories but continues making the backup anyway without erroring.

Hope this ends up working for you! Should be part of the next release.

First of all, I sincerely apologize for letting this ticket languish for so long. I've dug into the issue, and I believe you are right—this is a regression! What happened is that in #333, introduced in borgmatic 1.5.7, the code to deduplicate source directories started calling Python's `os.stat()` on each path. Which meant that if a source directory wasn't present on the filesystem, borgmatic errored. So the fix I made is to only call `os.stat()` if the source directory is actually present. Now, all source directories get passed to Borg. And like with the pre-1.5.7 borgmatic behavior, Borg complains about missing directories but continues making the backup anyway without erroring. Hope this ends up working for you! Should be part of the next release.
witten added
bug
and removed
question / support
labels 2021-10-11 17:39:45 +00:00
Owner

The fix has been released with borgmatic 1.5.19! Thanks for your patience here.

The fix has been released with borgmatic 1.5.19! Thanks for your patience here.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

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