Borgmatic commands are not working except for borgmatic config validate #1148
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Hello there, it's been a while since I used Borgmatic last time, things have changed since I left 😀
I have installed borgmatic on both computers (production and backup), I have initialized and created a repository on the backup PC, and I configured
config.yamlon the production computer, checked the configuration validity withborgmatic config validate,and it is good.Eventually, I want to check if things are working fine with the
borgmatic checkcommand and other similar commands, but I am receiving an error.Steps to reproduce
Install borgmatic on two computers, one running applications, the other set up for storing backups
Generate a configuration file on the application running computer and add SSH and PATH for the repo.
Run
borgmatic config validateand executeborgmatic infoorborgmatic checkActual behavior
Showing an error
Expected behavior
Showing a summary of the repo, if any backups are there, or must show a message with no backups...
Other notes / implementation ideas
borgmatic version
2.0.6
borgmatic installation method
Official Fedora Repository
Borg version
1.4.1
Python version
3.13.7
Database version (if applicable)
No response
Operating system and version
Fedora Linux 42 (WSL) x86_64
borgmatic definitely needs a configuration file in order to function on a given machine, so I think that explains why it's stubbornly refusing to work on the computer with your repository. However, let me ask you this: Is there a reason why you're installing borgmatic on your repository machine? You definitely need Borg there—so the "production" client machine can run Borg on the server side when it initiates a backup with borgmatic—but you don't actually need borgmatic on the repository machine unless you'd like to be able to run it there.
If you do want to be able to run borgmatic on the repository machine, then you'll need at least a minimal configuration file there. For instance, if you only want to be able to run
lists andchecks on that machine, you'll need a configuration file that specifies your repository and the checks you want to run on it. But you won't need, for instance, anysource_directoriessince you presumably won't be initiating any backups from that machine.Hope that helps!
Hey @witten it's been a while,
Actually, I executed
borgmatic liston the production computer, where I created config.yaml and specified the path to the repository and SSH. It is showing that error on the production computer, althoughborgmatic validate configshows success.I had no idea about that. I thought it was mandatory, so can I leave it as is for now, or should I remove Borgmatic from the repo machine?
As I mentioned earlier, the issue is actually occurring on the production server, where I intend to run borgmatic to push backups to the repository computer.
Oh, my misunderstanding then. When you created
config.yaml, where did you put it? For instance, is it at/etc/borgmatic/config.yamlor one of the other locations borgmatic is probing? Does it work if you specify--config config.yamlor whatever the path is to the file?Also, do you get any more details if you specify
--verbosity 2?Yes, I have created/generated it in
/etc/borgmatic/config.yaml, checking withborgmatic validate configit shows no error, but the error indicates that something is wrong in the config file...This is what a sample of the config, maybe in case I have done it wrong
Here is the contents of config.yaml
Thanks for including your entire configuration. I'm honestly at a loss as to what might be going on here. Normally, if a configuration file is invalid, not only would
validatecatch that and complain, but even aborgmatic listwould give errors or warnings if it can't read a configuration file.I will note that you have inconsistent indentation in this portion of your config:
But that shouldn't be a problem, and in fact when I try it on my system, borgmatic deals with it just fine.
Some ideas on other things to try:
borgmatic config validate --config /etc/borgmatic/config.yaml --verbosity 2, just to make sure that yourvalidateandlistcommands are working on the same config file. (They should be already.)repositories), does that change the behavior at all?Hello there
I tried removing Borgmatic and Borg from both, and installed Borgmatic with
pipxas root. But before that, I have tried running with root as you suggested, and indeed, the error is different this time. I just installed borg and borgmatic on Repo Machine nothing else, with the same config.yaml I triedborgmatic listand it is giving me the following error:The funny part is that SSH is working fine since I configured passwordless and key-based authentication, it works fine, but in the Borgmatic case, it doesn't, couldn't understand why.
If that error is from borgmatic running on the repo machine, then does that mean you're expecting the repo machine to connect to itself via SSH? Would it make more sense to change the
repositories:entry on that machine so that it can access the repository via a local path instead?Nope still trying on production server and getting that error. ssh myrepomachine@drp.local (e.g.) just works fine without asking password it connects to the repo machine since I am using key based authentication.
Ah gotcha. What about running the Borg command directly without borgmatic on the production server?
And what about this one?
Well, I tried both,
borg info --json ssh://repo_admin@remote.drp/home/repo_admin/DRPshows an error related to repo not found, since I started as a new user, I have not created a repo yet, since the ssh part is not working when I tried withsudo borgmatic repo-create --encryption repokey-aes-ocbJust installed borgmatic with dnf and created a repo on backup machine using borg
borg init --encryption=repokey /path/to/repoand then I executed this as you suggestedborg info --json ssh://repo_admin@remote.drp/home/repo_admin/DRPand it is working fine, the problem is I guess with borgmaticOkay, here's one discrepancy that's likely causing this issue: When you run borgmatic as the root user or with
sudo, you're using the root user's SSH keys. And when you run a command likeborgorsshas a non-root user withoutsudo, you're using that non-root user's SSH keys. And each one has potentially different access to the target server. In your case, it looks like your root user doesn't have SSH access to that target user@server.So there are at least two solutions:
sudo. Note however that while this might fix the SSH issue, there are permissions implications in that borgmatic will no longer have permissions to read as many files. For example, I don't know if root access is needed to read/var/cells.Hello @witten
Thanks for taking the time and try finding out the issue. Your suggestion was actually very important and accurate, as you said, I couldn't log in to the backup server with the root user. Borgmatic needs to be executed with the root user when you install it with the package manager. As you said before, the issue was actually a permission issue to execute with borgmatic, therefore, after fixing ssh SSH-related issue with the root user, now it's working, I can see the result of borgmatic list...
Great, I'm glad to hear it's working now!