#2846 PR merged: implement BORGBACKUP_IGNORE_WARNING

Labels: enhancement, fixed / solved / done

l4r-s opened issue at 2022-08-04 16:07:

Relax-and-Recover (ReaR) Pull Request Template

Pull Request Details:
  • Type: New Feature

  • Impact: Normal

  • Reference to related issue (URL):

  • How was this pull request tested?
    Tested with rear release 2.6 on Debian Bullseye (patched usr/share/rear/lib/borg-functions.sh file with this changes)

  • Brief description of the changes in this pull request:
    This PR implements a new variable BORGBACKUP_IGNORE_WARNING which ignores borg warnings.
    Borg warnings can happen if a file changed while backing it up described here: https://borgbackup.readthedocs.io/en/stable/usage/general.html#return-codes. Because borg return code is 1 in such case rear mkbackup fails.

l4r-s commented at 2022-08-10 15:51:

@jsmeix thank you for your inputs!

I changed the borg_create function to just return the borg rc and usr/share/rear/backup/BORG/default/500_make_backup.sh does now check if warnings should be ignored or not.

BORGBACKUP_IGNORE_WARNING=no gives the following output:

root@testhost:~# rear mkbackup
Cannot include default keyboard mapping (no KEYMAPS_DEFAULT_DIRECTORY specified)
Cannot include keyboard mappings (neither KEYMAPS_DEFAULT_DIRECTORY nor KEYMAPS_DIRECTORIES specified)
To log into the recovery system via ssh set up /root/.ssh/authorized_keys or specify SSH_ROOT_PASSWORD
Symlink '/usr/share/misc/magic' -> '/usr/share/file/magic' refers to a non-existing directory on the recovery system.
It will not be copied by default. You can include '/usr/share/file/magic' via the 'COPY_AS_IS' configuration variable.
[BORG] borg create backup operation completed with 'borg create' exit code 1
[BORG rc=1] borg create backup operation completed with at least one warning message
ERROR: Borg failed to create backup archive, borg rc 1!
Some latest log messages since the last called script 500_make_backup.sh:
  2022-08-10 17:29:17.407206672 Including backup/BORG/default/500_make_backup.sh
  2022-08-10 17:29:17.409064320 Creating backup archive 'rear_23' in Borg repository /mnt/borg/testhost on borghost
  /var/log/journal/40fa4d3667ee4324b25696976466ed9e/system.journal: file changed while we backed it up
  /var/log/journal/40fa4d3667ee4324b25696976466ed9e/user-2001.journal: file changed while we backed it up
  2022-08-10 17:29:33.325498096 [BORG] borg create backup operation completed with 'borg create' exit code 1
  2022-08-10 17:29:33.327291103 [BORG rc=1] borg create backup operation completed with at least one warning message
Aborting due to an error, check /var/log/rear/rear-testhost.log for details
Terminated
root@testhost:~# echo $?
143

BORGBACKUP_IGNORE_WARNING=yes gives the following output:

root@testhost:~# rear mkbackup
Cannot include default keyboard mapping (no KEYMAPS_DEFAULT_DIRECTORY specified)
Cannot include keyboard mappings (neither KEYMAPS_DEFAULT_DIRECTORY nor KEYMAPS_DIRECTORIES specified)
To log into the recovery system via ssh set up /root/.ssh/authorized_keys or specify SSH_ROOT_PASSWORD
Symlink '/usr/share/misc/magic' -> '/usr/share/file/magic' refers to a non-existing directory on the recovery system.
It will not be copied by default. You can include '/usr/share/file/magic' via the 'COPY_AS_IS' configuration variable.
[BORG rc=1] borg create backup operation completed with at least one warning message that was ignored (see rear log file)
root@testhost:~# echo $?
0

The borg warnings get logged in the rear log file:

root@testhost:~# tail -n 20 /var/log/rear/rear-testhost.log
2022-08-10 17:33:11.505371427 Creating backup archive 'rear_24' in Borg repository /mnt/borg/testhost on borghost
/var/log/journal/40fa4d3667ee4324b25696976466ed9e/system.journal: file changed while we backed it up
/var/log/journal/40fa4d3667ee4324b25696976466ed9e/user-2001.journal: file changed while we backed it up
2022-08-10 17:33:28.674441182 [BORG rc=1] borg create backup operation completed with at least one warning message that was ignored (see rear log file)
...

jsmeix commented at 2022-08-11 09:41:

@rear/contributors
could you also have a look here as time permits?

jsmeix commented at 2022-09-05 12:13:

@l4r-s
thank you for your other commits.
I was not in the office - therefore my late reply.

jsmeix commented at 2022-09-06 14:51:

@rear/contributors
if there are no objections
I would like to merge it tomorrow afternoon

jsmeix commented at 2022-09-07 12:01:

@l4r-s
thank you for your contribution that improves ReaR!

Contributions for third-party backup tool support in ReaR
are much appreciated because we at ReaR upstream
usually do not have or use those third-party backup tools
(in particular not if a third-party backup tool is proprietary software)
so in case of issues with third-party backup tools and ReaR
we can usually do nothing but totally depend on contributions
from those who use and know about the third-party backup tools.


[Export of Github issue for rear/rear.]