Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

borg serve ignores --repo attribute for repo-create #8591

Open
andresbott opened this issue Dec 22, 2024 · 7 comments
Open

borg serve ignores --repo attribute for repo-create #8591

andresbott opened this issue Dec 22, 2024 · 7 comments

Comments

@andresbott
Copy link

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

YES

Is this a BUG / ISSUE report or a QUESTION?

Bug

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

Your borg version (borg -V).

bug reproduced with borg vers 2.0.0b13 and 2.0.0b14

Operating system (distribution) and version.

OS for both client and server:
Debian stable bookworkm AMD64 Linux 6.1.0-13-amd64

Hardware / network configuration, and filesystems used.

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

Describe the problem you're observing.

on the server i have my ssh config as follows:

.ssh/authorized_keys

command="borg serve -r /media/zfs_raidz_backup/borg/archive ssh-ed25519 AA....

on the client, set env vars

BORG_RSH=ssh -i /home/user/.ssh/ed25519_borg_alexia_archive
BORG_PASSPHRASE=<PW>
BORG_REPO=ssh://borg@alexia/borg/archive

uppon trying to create the repo with

borg repo-create -e=keyfile-aes-ocb

i get the following FileNotFoundError error

borg repo-create -e=keyfile-aes-ocb


Traceback (most recent call last):
  File "borgstore/backends/posixfs.py", line 55, in create
  File "pathlib.py", line 1311, in mkdir
FileNotFoundError: [Errno 2] No such file or directory: '/home/borg/borg/archive'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "borg/remote.py", line 266, in inner_serve
  File "borg/remote.py", line 417, in open
  File "borg/repository.py", line 161, in __enter__
  File "borg/repository.py", line 180, in create
  File "borgstore/store.py", line 94, in create
  File "borgstore/backends/posixfs.py", line 57, in create
borgstore.backends.errors.BackendError: posixfs storage base path's parent directory does not exist: /home/borg/borg/archive

it looks like the --repo argument is ignored from the serve command (at least on the create step) and the repo path falls back to the severs user home.

workaround: after downgrading to borg 2.0.0b12 repo creation worked without any issue

@andresbott
Copy link
Author

OK, just quickly checked borg repo-list on 2.0.0b14 and seems to be affected by the same issue

@ThomasWaldmann
Copy link
Member

I don't think one was ever supposed to use --repo with borg serve because the repository is already given on the client side.

The reason why the --repo option appears within borg serve help / docs is because it is implemented as a common option for all commands, so it is present no matter what.

Also, please don't confuse a repository with an archive (like in BORG_REPO=ssh://borg@alexia/borg/archive).

A repository is the container (usually a directory), an archive is the result of a single backup. A repository contains archives.

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Dec 22, 2024

export BORG_REPO=ssh://borg@alexia/borg/myfirstrepo

This means to use a relative path borg/myfirstrepo in the cwd after logging in as borg@alexia.

These are the relevant docs (and they changed recently!):

https://borgbackup.readthedocs.io/en/2.0.0b14/usage/general.html#repository-urls

Especially:

Remote repositories accessed via ssh:

ssh://user@host:port//abs/path/to/repo - absolute path

ssh://user@host:port/rel/path/to/repo - path relative to current directory

"current directory" here means the cwd of the borg serve process, which usually is the home directory of the user used to log into the borg server.

@ThomasWaldmann ThomasWaldmann changed the title [regression] borg serve ignores --repo attribute for create repo on 2.0.0b13 and 2.0.0b14 borg serve ignores --repo attribute for repo-create Dec 22, 2024
@andresbott
Copy link
Author

I don't think one was ever supposed to use --repo with borg serve because the repository is already given on the client side.

i see... this is unfortunate, this was a good way for me to isolate the client path from the server implementation. e.g.
on my server i can put the repo wherever i want without needing to tell the client about the internal file system structure of the server.

Also, if --repo was never supposed to be part of the serve command, maybe it would be good to remove it/not allow it at all, it leads to confusion

I can live with it but I still would like to point out that if i would be a provider, (like borgbase) this makes the whole user experience less transparent.

I will verify ASAP that absolute paths work as expected, thanks for looking into this

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Dec 24, 2024

@andresbott Since the recent change to interpret the repo path as a relative path, there now actually is some isolation:

  • the client url usually has only the relative path component and the user does not need to know the full absolute path
  • the home directory / cwd on the server can be changed and repos can be moved around as long as the relative path of the repos stays the same (e.g. moving a home dir WITH contents is possible now)

OTOH, using full absolute paths in the repo URLs (with the new syntax) is also possible, but does not have the advantages I listed above.

@andresbott
Copy link
Author

@andresbott Since the recent change to interpret the repo path as a relative path, there now actually is some isolation:

  • the client url usually has only the relative path component and the user does not need to know the full absolute path
  • the home directory / cwd on the server can be changed and repos can be moved around as long as the relative path of the repos stays the same (e.g. moving a home dir WITH contents is possible now)

OTOH, using full absolute paths in the repo URLs (with the new syntax) is also possible, but does not have the advantages I listed above.

Got it, thanks for clarifying.
I would close this issue then or is there any action you want to link to this?

Thanks

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Dec 26, 2024

We could check whether an error msg can be emitted by borg serve or to just document that --repo is ignored by borg serve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants