borgmatic-collective / docker-borgmatic

Borgmatic in Docker
GNU General Public License v3.0
314 stars 88 forks source link

Issue with first time use: /mnt/borg-repositor is not a valid repository. Check repo config. #280

Open joao8545 opened 7 months ago

joao8545 commented 7 months ago

This probably happened due to me having zero experience with borg and starting directly on the borgmatic. So I would totally understand if this get disregarded, but I will write it here, so if anyone face this issue in the future, maybe they will find the solution quicker than I did.

The issue was that whenever the cronjob triggered the job failed with that error message. I followed all the steps in the Usage part of the README, but this issue was always appearing. The missed information was that before running the container, the repository directory must be already inited. I would suggest an addition of this step to the README or even better if the script would init the repository in case it was not inited yet.

Thanks for the awesome tool!

nWacky commented 5 months ago

As of now, this command can be used to initialize the repository:

# ssh into the container:
#   docker exec -it borgmatic bash

# init all repositories
borgmatic init --encryption=repokey-blake2
# or init repository in one folder:
# borg init --encryption repokey-blake2 /mnt/borg-repository

--encryption can be either repokey or repokey-blake2. Use whichever one is faster on your client machines (more details)

UPD: added borgmatic init

ekirchman commented 5 months ago

As of now, this command can be used to initialize the repository:

# ssh into the container:
#   docker exec -it borgmatic bash

borg init --encryption repokey-blake2 /mnt/borg-repository

--encryption can be either repokey or repokey-blake2. Use whichever one is faster on your client machines (more details)

Will doing this still leave the passphrase to be what is defined in the env variable BORG_PASSPHRASE ? I did this and Borg printed out the key, but never asked me for a passphrase like the borg documentation said it would

nWacky commented 5 months ago

Will doing this still leave the passphrase to be what is defined in the env variable BORG_PASSPHRASE ?

I think yes

If you want to automate, you can alternatively supply the passphrase directly or indirectly using some environment variables.

You can directly give a passphrase:

# use this passphrase (use safe permissions on the script!):
export BORG_PASSPHRASE='my super secret passphrase'

from Passphrase notes - borgbackup.readthedocs.io