Failing to initialize repository using Borg Backup in Synology #605

Closed
opened 2022-10-27 04:23:51 +00:00 by Rufus7977 · 7 comments

What I'm trying to do and why

Setup Borg Backup for the first time using Synology guide in BorgBase Docs: https://docs.borgbase.com/setup/synology/

Steps to reproduce

Followed instructions in the guide above with the exception of creating SSH keys using ssh-keygen -o -a 100 -t ed25519. If using ssh-keygen -f ./id_synology, I get a permission error when trying to initialize the repository.

SSH into Synology and ran command to initialize repository under Step 6 of the guide above:

/usr/local/bin/borgmatic init -e repokey-blake2 -c /volume1/BorgBackup/borgmatic.yml

Actual behavior

Remote: Could not create directory '/var/services/homes/user/.ssh'.
The authenticity of host 'b36ly8kl.repo.borgbase.com (2001:4830:c210:84::2)' can't be established.
ECDSA key fingerprint is SHA256:BmYzPJ4GEOilkv1z1nwhHMkkFv/FRyYOAcVRZKf0NVQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Remote: Failed to add the host to the list of known hosts (/var/services/homes/user/.ssh/known_hosts).
/srv/repos/b36ly8kl/repo is not a valid repository. Check repo config.
Remote: Could not create directory '/var/services/homes/user/.ssh'.
The authenticity of host 'b36ly8kl.repo.borgbase.com (2001:4830:c210:84::2)' can't be established.
ECDSA key fingerprint is SHA256:BmYzPJ4GEOilkv1z1nwhHMkkFv/FRyYOAcVRZKf0NVQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Remote: Failed to add the host to the list of known hosts (/var/services/homes/user/.ssh/known_hosts).
Enter new passphrase:
Enter same passphrase again:
Do you want your passphrase to be displayed for verification? [yN]: n
Error: [Errno 2] No such file or directory: '/var/services/homes/user'
ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo: Error running actions for repository
Command 'borg init --encryption repokey-blake2 ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo' returned non-zero exit status 2.
/volume1/BorgBackup/borgmatic.yml: Error running configuration file

summary:
/volume1/BorgBackup/borgmatic.yml: Error running configuration file
ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo: Error running actions for repository
Command 'borg init --encryption repokey-blake2 ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo' returned non-zero exit status 2.

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

The repository on Borgbase.com shows activity under the event log but still no encryption.

2022-10-26 21:04:21	logout	2601:648:8701:5010:*			Change: 0MB
2022-10-26 21:04:12	login	2601:648:8701:5010:*	user@NAS	Host: box-us6-borgbase-com

Environment

borgmatic version: [1.6.3]

borgmatic installation method: [Synology Package Center]

Borg version: [1.2.1]

Python version: [3.8.12]

Database version (if applicable): n/a

operating system and version: Synology DSM 7.1.1-42962 Update 2

#### What I'm trying to do and why Setup Borg Backup for the first time using Synology guide in BorgBase Docs: https://docs.borgbase.com/setup/synology/ #### Steps to reproduce Followed instructions in the guide above with the exception of creating SSH keys using `ssh-keygen -o -a 100 -t ed25519`. If using `ssh-keygen -f ./id_synology`, I get a permission error when trying to initialize the repository. SSH into Synology and ran command to initialize repository under [Step 6 of the guide](https://docs.borgbase.com/setup/synology/#step-6---add-backup-task) above: ``` /usr/local/bin/borgmatic init -e repokey-blake2 -c /volume1/BorgBackup/borgmatic.yml ``` #### Actual behavior ``` Remote: Could not create directory '/var/services/homes/user/.ssh'. The authenticity of host 'b36ly8kl.repo.borgbase.com (2001:4830:c210:84::2)' can't be established. ECDSA key fingerprint is SHA256:BmYzPJ4GEOilkv1z1nwhHMkkFv/FRyYOAcVRZKf0NVQ. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Remote: Failed to add the host to the list of known hosts (/var/services/homes/user/.ssh/known_hosts). /srv/repos/b36ly8kl/repo is not a valid repository. Check repo config. Remote: Could not create directory '/var/services/homes/user/.ssh'. The authenticity of host 'b36ly8kl.repo.borgbase.com (2001:4830:c210:84::2)' can't be established. ECDSA key fingerprint is SHA256:BmYzPJ4GEOilkv1z1nwhHMkkFv/FRyYOAcVRZKf0NVQ. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Remote: Failed to add the host to the list of known hosts (/var/services/homes/user/.ssh/known_hosts). Enter new passphrase: Enter same passphrase again: Do you want your passphrase to be displayed for verification? [yN]: n Error: [Errno 2] No such file or directory: '/var/services/homes/user' ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo: Error running actions for repository Command 'borg init --encryption repokey-blake2 ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo' returned non-zero exit status 2. /volume1/BorgBackup/borgmatic.yml: Error running configuration file summary: /volume1/BorgBackup/borgmatic.yml: Error running configuration file ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo: Error running actions for repository Command 'borg init --encryption repokey-blake2 ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo' returned non-zero exit status 2. Need some help? https://torsion.org/borgmatic/#issues ``` The repository on Borgbase.com shows activity under the event log but still no encryption. ``` 2022-10-26 21:04:21 logout 2601:648:8701:5010:* Change: 0MB 2022-10-26 21:04:12 login 2601:648:8701:5010:* user@NAS Host: box-us6-borgbase-com ``` #### Environment **borgmatic version:** [1.6.3] **borgmatic installation method:** [Synology Package Center] **Borg version:** [1.2.1] **Python version:** [3.8.12] **Database version (if applicable):** n/a **operating system and version:** Synology DSM 7.1.1-42962 Update 2
Owner

Thanks for your detailed ticket! Looking at what you've included here, it looks like your user may not have permission to create /var/services/homes/user/.ssh, and in fact /var/services/homes/user may not even exist. Is that possible? Is that the current user's home directory, or some other path? I don't see it listed in your borgmatic configuration file, so that makes me think it's not a configured source directory.

Side note: In step 6, the documentation uses out-of-date options. Instead of --create, use create. Instead of --prune, use prune. And instead of --check, use check.

Thanks for your detailed ticket! Looking at what you've included here, it looks like your user may not have permission to create `/var/services/homes/user/.ssh`, and in fact `/var/services/homes/user` may not even exist. Is that possible? Is that the current user's home directory, or some other path? I don't see it listed in your borgmatic configuration file, so that makes me think it's not a configured source directory. Side note: In step 6, the documentation uses out-of-date options. Instead of `--create`, use `create`. Instead of `--prune`, use `prune`. And instead of `--check`, use `check`.
witten added the
question / support
label 2022-10-27 05:11:15 +00:00
Author

Yes, it appears that /var/services/home/user does not exist when I try to navigate in SSH. I'm not sure if it is the current user's home directory. Will I need to create this folder so that Borg can access it? Am I misunderstanding the purpose of the source directory?

The directory listed in my borgmatic configuration file /volume1/somedatadir is a "real" test directory I'm hoping to backup.

Thanks for clarifying the correct syntax for the options in step 6.

Yes, it appears that `/var/services/home/user` does not exist when I try to navigate in SSH. I'm not sure if it is the current user's home directory. Will I need to create this folder so that Borg can access it? Am I misunderstanding the purpose of the source directory? The directory listed in my borgmatic configuration file `/volume1/somedatadir` is a "real" test directory I'm hoping to backup. Thanks for clarifying the correct syntax for the options in step 6.
Owner

Yeah, the source_directories are the directories to backup.

I'm not sure where /var/services/home/user is coming from (it's not in your configuration file), which is why I speculated it's the current user's home directory. It certainly looks like a home directory. Once you SSH in, you can try echo $HOME to get the user's home directory. If it's /var/services/home/user, then my guess there's a misconfiguration with that user, because their home directory doesn't exist!

Yeah, the `source_directories` are the directories to backup. I'm not sure where `/var/services/home/user` is coming from (it's not in your configuration file), which is why I speculated it's the current user's home directory. It certainly _looks_ like a home directory. Once you SSH in, you can try `echo $HOME` to get the user's home directory. If it's `/var/services/home/user`, then my guess there's a misconfiguration with that user, because their home directory doesn't exist!
Author

Thanks for your response. You are correct, my home directory was misconfigured. Upon running echo $HOME, I was returned var/services/home/user. There is a setting under Control Panel -> User & Group -> User Home for "Enable user home service". Once I checked that, I ran /usr/local/bin/borgmatic init -e repokey-blake2 -c /volume1/BorgBackup/borgmatic.yml again, and the output no longer reports errors with the home directory.

Unfortunately, I'm still unable to initialize the repository:

The authenticity of host 'b36ly8kl.repo.borgbase.com (2001:4830:c210:84::2)' can't be established.
ECDSA key fingerprint is SHA256:BmYzPJ4GEOilkv1z1nwhHMkkFv/FRyYOAcVRZKf0NVQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Remote: Warning: Permanently added 'b36ly8kl.repo.borgbase.com,2001:4830:c210:84::2' (ECDSA) to the list of known hosts.
Repository has no manifest.
A repository already exists at ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo.
ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo: Error running actions for repository
Command 'borg init --encryption repokey-blake2 ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo' returned non-zero exit status 2.
/volume1/BorgBackup/borgmatic.yml: Error running configuration file

summary:
/volume1/BorgBackup/borgmatic.yml: Error running configuration file
ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo: Error running actions for repository
Command 'borg init --encryption repokey-blake2 ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo' returned non-zero exit status 2.

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

Does the "returned non-zero exit status 2" indicate something wrong with my configuration file?

Thanks for your response. You are correct, my home directory was misconfigured. Upon running `echo $HOME`, I was returned `var/services/home/user`. There is a setting under Control Panel -> User & Group -> User Home for "Enable user home service". Once I checked that, I ran `/usr/local/bin/borgmatic init -e repokey-blake2 -c /volume1/BorgBackup/borgmatic.yml` again, and the output no longer reports errors with the home directory. Unfortunately, I'm still unable to initialize the repository: ``` The authenticity of host 'b36ly8kl.repo.borgbase.com (2001:4830:c210:84::2)' can't be established. ECDSA key fingerprint is SHA256:BmYzPJ4GEOilkv1z1nwhHMkkFv/FRyYOAcVRZKf0NVQ. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Remote: Warning: Permanently added 'b36ly8kl.repo.borgbase.com,2001:4830:c210:84::2' (ECDSA) to the list of known hosts. Repository has no manifest. A repository already exists at ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo. ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo: Error running actions for repository Command 'borg init --encryption repokey-blake2 ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo' returned non-zero exit status 2. /volume1/BorgBackup/borgmatic.yml: Error running configuration file summary: /volume1/BorgBackup/borgmatic.yml: Error running configuration file ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo: Error running actions for repository Command 'borg init --encryption repokey-blake2 ssh://b36ly8kl@b36ly8kl.repo.borgbase.com/./repo' returned non-zero exit status 2. Need some help? https://torsion.org/borgmatic/#issues ``` Does the "returned non-zero exit status 2" indicate something wrong with my configuration file?
Owner

It means Borg itself has returned an error. I'm not sure what's wrong, but it might be this part of the Borg error above: "Repository has no manifest." See https://github.com/borgbackup/borg/issues/5955 for another instance of this happening. One thing you count try is adding --verbosity 2 on the borgmatic command-line to see if you get any more information about it. Or try deleting and re-adding the repository on the BorgBase side. Or, failing that, contacting the Borg project or BorgBase support. You can also try running an init command with Borg directly so as to eliminate borgmatic as the potential cause of this problem.

It means Borg itself has returned an error. I'm not sure what's wrong, but it might be this part of the Borg error above: "Repository has no manifest." See https://github.com/borgbackup/borg/issues/5955 for another instance of this happening. One thing you count try is adding `--verbosity 2` on the borgmatic command-line to see if you get any more information about it. Or try deleting and re-adding the repository on the BorgBase side. Or, failing that, contacting the Borg project or BorgBase support. You can also try running an `init` command with Borg directly so as to eliminate borgmatic as the potential cause of this problem.
Author

Looks like deleting and re-adding the repository on the BorgBase side fixed it! Maybe it was corrupted at some point when my user profile home directory wasn't properly configured. In any case, thank you very much for your help.

Looks like deleting and re-adding the repository on the BorgBase side fixed it! Maybe it was corrupted at some point when my user profile home directory wasn't properly configured. In any case, thank you very much for your help.
Owner

Awesome, I'm glad to hear that did it!

Awesome, I'm glad to hear that did it!
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#605
No description provided.