Closed Xitee1 closed 3 months ago
I'm not sure exactly why you're getting this error, but here are a few comments/tips:
BORG_HEALTHCHECK_URL
indicates that that environment variable isn't getting passed to borgmatic, and it looks like you're not sending it as part of your Docker Compose configuration.borgmatic init -encryption=none
isn't a valid borgmatic command. Try borgmatic init --encryption none
or borgmatic init -e none
instead.borg info
command that borgmatic is trying to run is erroring, although it looks like the specific error message isn't getting logged correctly. You could try running borgmatic info --json
manually or even borg info --json /mnt/borg-repository
to see if you can get a more useful error message.--verbosity 2
to the borgmatic command-line to produce more diagnostic output.RUN_ON_STARTUP
.Thank you very much for the tips.
BORG_HEALTHCHECK_URL
you're correct, I haven't configured it because it isn't documented at all in the readme. I don't really know what I have to set it to (I'm completely new to borg backup).borgmatic init -encryption=none
is invalid. Doing borgmatic init --encryption none
is giving me this error: Unrecognized argument: none
. The standard borg command (not the borgmatic one) also uses the =
in between (https://borgbackup.readthedocs.io/en/stable/usage/init.html#examples). Nevertheless, doing -e none
results in the same error as posted before.docker exec borgmatic bash -c "borgmatic init -e none --verbosity 2"
BORG_EXIT_CODES=*** borg --version --debug --show-rc
/etc/borgmatic.d/config.yaml: Borg 1.4.0
/mnt/borg-repository: Running actions for repository
/etc/borgmatic.d/config.yaml: No commands to run for pre-actions hook
/mnt/borg-repository: Creating repository
BORG_EXIT_CODES=*** borg info --json /mnt/borg-repository
/mnt/borg-repository is not a valid repository. Check repo config.
/mnt/borg-repository: Error running actions for repository
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 621, in log_error_records
raise error
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 145, in run_configuration
yield from run_actions(
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 310, in run_actions
borgmatic.actions.rcreate.run_rcreate(
File "/usr/local/lib/python3.12/site-packages/borgmatic/actions/rcreate.py", line 27, in run_rcreate
borgmatic.borg.rcreate.create_repository(
File "/usr/local/lib/python3.12/site-packages/borgmatic/borg/rcreate.py", line 42, in create_repository
rinfo.display_repository_info(
File "/usr/local/lib/python3.12/site-packages/borgmatic/borg/rinfo.py", line 55, in display_repository_info
return execute_command_and_capture_output(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/borgmatic/execute.py", line 348, in execute_command_and_capture_output
output = subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('borg', 'info', '--json', '/mnt/borg-repository')' returned non-zero exit status 15.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.12/logging/init.py", line 1163, in emit stream.write(msg + self.terminator)
TypeError: unsupported operand type(s) for +: 'CalledProcessError' and 'str'
Call stack:
File "/usr/local/bin/borgmatic", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 922, in main
or list(collect_configuration_run_summary_logs(configs, config_paths, arguments))
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 804, in collect_configuration_run_summary_logs
results = list(run_configuration(config_filename, config, config_paths, arguments))
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 176, in run_configuration
yield from log_error_records(
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 642, in log_error_records
yield log_record(levelno=levelno, levelname=level_name, msg=error)
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 599, in log_record
logger.handle(record)
File "/usr/local/lib/python3.12/logging/__init__.py", line 1700, in handle
self.callHandlers(record)
File "/usr/local/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
hdlr.handle(record)
File "/usr/local/lib/python3.12/logging/__init__.py", line 1028, in handle
self.emit(record)
File "/usr/local/lib/python3.12/site-packages/borgmatic/logger.py", line 76, in emit
self.log_level_to_handler[record.levelno].emit(record)
Message: CalledProcessError(15, ('borg', 'info', '--json', '/mnt/borg-repository'))
Arguments: ()
/etc/borgmatic.d/config.yaml: An error occurred
summary:
/etc/borgmatic.d/config.yaml: Configuration sections (like location:, storage:, retention:, consistency:, and hooks:) are deprecated and support will be removed from a future release. To prepare for this, move your options out of sections to the global scope.
/etc/borgmatic.d/config.yaml: An error occurred
/mnt/borg-repository: Error running actions for repository
--- Logging error ---
/etc/borgmatic.d/config.yaml: Loading configuration file
Traceback (most recent call last):
File "/usr/local/lib/python3.12/logging/__init__.py", line 1163, in emit
stream.write(msg + self.terminator)
~~~~^~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'CalledProcessError' and 'str'
Call stack:
File "/usr/local/bin/borgmatic", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.12/site-packages/borgmatic/commands/borgmatic.py", line 935, in main
logger.handle(log)
File "/usr/local/lib/python3.12/logging/__init__.py", line 1700, in handle
self.callHandlers(record)
File "/usr/local/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
hdlr.handle(record)
File "/usr/local/lib/python3.12/logging/__init__.py", line 1028, in handle
self.emit(record)
File "/usr/local/lib/python3.12/site-packages/borgmatic/logger.py", line 76, in emit
self.log_level_to_handler[record.levelno].emit(record)
Message: CalledProcessError(15, ('borg', 'info', '--json', '/mnt/borg-repository'))
Arguments: ()
Need some help? https://torsion.org/borgmatic/#issues
```
BORG_HEALTHCHECK_URL you're correct, I haven't configured it because it isn't documented at all in the readme. I don't really know what I have to set it to (I'm completely new to borg backup).
This would be the URL of a Healthchecks server that you want borgmatic to ping with backup success/failure. This is of course an optional feature you don't have to use.
I don't think that borgmatic init -encryption=none is invalid. Doing borgmatic init --encryption none is giving me this error: Unrecognized argument: none. The standard borg command (not the borgmatic one) also uses the = in between (https://borgbackup.readthedocs.io/en/stable/usage/init.html#examples). Nevertheless, doing -e none results in the same error as posted before.
The only thing I can think of is there must be a typo there somewhere. borgmatic and Borg do not use 100% of the same arguments, and in this case borgmatic expects either -e none
or --encryption none
.
Using the info command or verbosity flag sadly doesn't give me a more useful error message. docker exec borgmatic bash -c "borgmatic init -e none --verbosity 2"
FWIW, I've been able to reproduce the problem you're seeing when running borgmatic in the container image. Strangely, it doesn't repro outside of the container for me. Maybe this is a difference in Python versions (3.12.3 in the container and 3.12.4 outside)?
Interesting.. I think there are at least two problems here:
Also, you can likely work around the first issue until it's fixed with the following change to your borgmatic configuration..
Change this:
repositories:
- path: /mnt/borg-repository
... to this:
repositories:
- path: /mnt/borg-repository/repo
That will cause the repository to be created in a (not yet existent) subdirectory of your mounted repository path. That way, borgmatic doesn't get confused and think that because /mnt/borg-repository
already exists, something must be wrong.
Also, you can likely work around the first issue until it's fixed with the following change to your borgmatic configuration..
Change this:
repositories: - path: /mnt/borg-repository
... to this:
repositories: - path: /mnt/borg-repository/repo
That will cause the repository to be created in a (not yet existent) subdirectory of your mounted repository path. That way, borgmatic doesn't get confused and think that because
/mnt/borg-repository
already exists, something must be wrong.
Thank your very much, that works 👍
Glad to hear that did it for now!
After setting up the docker-compose.yaml and borgmatic.d/config.yaml I'm always getting errors when trying to init a repository.
When running
docker exec borgmatic bash -c "borgmatic init -encryption=none"
I'm getting this with the default config:I've outcommented the healthcheck from the config.yaml but when trying again I'm getting a different error:
docker-compose.yaml
:data/borgmatic.d/config.yaml
:I have tried it on two servers and it just doesn't work. Did I miss something? By the way,
RUN_ON_STARTUP
isn't working either. After starting the container nothing happens until the cronjob kicks in.