borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
11.15k stars 743 forks source link

Repository not recognized when using docker #4508

Closed Matzz closed 5 years ago

Matzz commented 5 years ago

Have you checked borgbackup docs, FAQ, and open Github issues?

yes

Is this a BUG / ISSUE report or a QUESTION?

Issue / Question

System information. For client/server mode post info for both machines.

Your borg version (borg -V).

1.1.8

Operating system (distribution) and version.

fedora:29

Hardware / network configuration, and filesystems used.

docker image

How much data is handled by borg?

N/A

Full borg command line that lead to the problem (leave away excludes and passwords)

Run twice following commands

mkdir borg-archive borg-repo source-test

docker run -h foo --privileged \
-e "BACKUP_DIRS=/to-backup" \
-e BORG_REPO="/mnt/s3fs/backup" \
-e ARCHIVE="$(date +%Y-%m-%d--%H-%M-%S)" \
-v $(pwd)/borg-archive:/root/.cache/borg \
-v $(pwd)/source-test:/to-backup \
-v $(pwd)/borg-repo:/mnt/s3fs \
pschiffe/borg

Output:

matzz@matzz ~/test/test $ mkdir borg-archive borg-repo source-test
matzz@matzz ~/test/test $ docker run -h foo --privileged \
> -e "BACKUP_DIRS=/to-backup" \
> -e BORG_REPO="/mnt/s3fs/backup" \
> -e ARCHIVE="$(date +%Y-%m-%d--%H-%M-%S)" \
> -v $(pwd)/borg-archive:/root/.cache/borg \
> -v $(pwd)/source-test:/to-backup \
> -v $(pwd)/borg-repo:/mnt/s3fs \
> pschiffe/borg
Not using encryption. If you want to encrypt your files, set $BORG_PASSPHRASE variable.
ls: cannot access '/mnt/s3fs/backup': No such file or directory
Initializing repository at "/mnt/s3fs/backup"
Encryption NOT enabled.
Use the "--encryption=repokey|keyfile" to enable encryption.
Synchronizing chunks cache...
Archives: 0, w/ cached Idx: 0, w/ outdated Idx: 0, w/o cached Idx: 0.
Done.
terminating with success status, rc 0
------------------------------------------------------------------------------
Archive name: 2019-02-24--00-17-53
Archive fingerprint: f2a0ce71ff6d0593934330faa4e6d82c3a77a64e759e5d1a699aed72ae38170e
Time (start): Sat, 2019-02-23 23:17:54
Time (end):   Sat, 2019-02-23 23:17:54
Duration: 0.00 seconds
Number of files: 0
Utilization of max. archive size: 0%
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
This archive:                  556 B                524 B                524 B
All archives:                  556 B                524 B                524 B

                       Unique chunks         Total chunks
Chunk index:                       2                    2
------------------------------------------------------------------------------
terminating with success status, rc 0
Starting repository check
Starting repository index check
Completed repository check, no problems found.
Starting archive consistency check...
Analyzing archive 2019-02-24--00-17-53 (1/1)
Archive consistency check complete, no problems found.
terminating with success status, rc 0
matzz@matzz ~/test/test $ docker run -h foo --privileged \
> -e "BACKUP_DIRS=/to-backup" \
> -e BORG_REPO="/mnt/s3fs/backup" \
> -e ARCHIVE="$(date +%Y-%m-%d--%H-%M-%S)" \
> -v $(pwd)/borg-archive:/root/.cache/borg \
> -v $(pwd)/source-test:/to-backup \
> -v $(pwd)/borg-repo:/mnt/s3fs \
> pschiffe/borg
Not using encryption. If you want to encrypt your files, set $BORG_PASSPHRASE variable.
Warning: Attempting to access a previously unknown unencrypted repository!
Do you want to continue? [yN] Aborting.
Cache initialization aborted
terminating with error status, rc 2

Describe the problem you're observing.

I'm using pschiffe/docker-borg docker image. I know that borg don't maintain any official docker image. But my issue seems to be related to borg rather than the way how this image works. I already asked here https://github.com/pschiffe/docker-borg/issues/6 but I was redirected to borg repo.

When I'm trying to backup directory using unencrypted repository I'm getting "Attempting to access a previously unknown unencrypted repository" error. I know that I could avoid that using BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK. However, I still feel that something is wrong. Due to this error I'm not fully sure that borg will use cache which is essential for me. I would like to know what borg check before emitting Attempting to access a previously unknown unencrypted repository. I thought it is check if hostname is the same as before but adding -h foo didn't help me.

ThomasWaldmann commented 5 years ago

do you need to also give /root/.config/borg?

Matzz commented 5 years ago

@ThomasWaldmann I'm backuping s3 bucket mapped via s3fs. So I wan't to limit the number of read/write operations on that filesystem to reduce the cost. As far as I understand keeping /root/.cache/borg is essential to do that.

ThomasWaldmann commented 5 years ago

I didn't say you shall not keep the cache - I said you might want to keep the config also (to avoid the error msg you run into and not need the workaround via the env var).

Matzz commented 5 years ago

@ThomasWaldmann Sorry I misread your message. Mounting config directory helped. Thanks!