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

Invalid location format on cifs/smb #1705

Closed
DurandA opened this issue Oct 9, 2016 · 10 comments
Closed

Invalid location format on cifs/smb #1705

DurandA opened this issue Oct 9, 2016 · 10 comments
Assignees
Labels

Comments

@DurandA
Copy link

DurandA commented Oct 9, 2016

I got a samba share mounted on /run/user/1000/gvfs/smb-share:server=diskstation.local,share=backup.

When initializing a repo using borg init /run/user/1000/gvfs/smb-share:server=diskstation.local,share=backup I get:
borg init: error: argument REPOSITORY: Invalid location format: "/run/user/1000/gvfs/smb-share:server=diskstation.local,share=backup"

@enkore enkore added the bug label Oct 9, 2016
@enkore enkore added this to the 1.0.8rc1 fixes milestone Oct 9, 2016
@enkore
Copy link
Contributor

enkore commented Oct 9, 2016

A single double-dot should be allowed in paths, but it looks like it isn't. Probably an oversight / simplification of the parsing regex here.

(?P<proto>file)://(?P<path>[^:]+)(?:::(?P<archive>[^/]+))?$
                             ^

In the meantime, try a bind-mount to have a path point at your real mount point, which doesn't contain any double-dots:

# mount --bind /run/user/1000/gvfs/smb-share:server=diskstation.local,share=backup /mnt/theonebackup

A symlink doesn't seem to work. (Another thing to fix here?)

@ThomasWaldmann
Copy link
Member

https://regex101.com/

(?P<path>.+?(?=(?:::|$)))(?:::(?P<archive>[^/]+))?$

some:path::archive

@ThomasWaldmann ThomasWaldmann self-assigned this Oct 10, 2016
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Oct 10, 2016
also:
- refactor / deduplicate the location parsing regexes
- add comments
- add more tests for Location parsing
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Oct 12, 2016
also:
- refactor / deduplicate the location parsing regexes
- add comments
- add more tests for Location parsing
ThomasWaldmann added a commit that referenced this issue Oct 12, 2016
@ThomasWaldmann
Copy link
Member

fixed by #1710

@LinuxOnTheDesktop
Copy link

I am having a similar problem. Is it because my version of Borg is too old?

borg init --encryption=repokey smb://192.168.1.51/backup/Linux/Borg
Local Exception.
Traceback (most recent call last):
  File "borg/archiver.py", line 2184, in main
  File "borg/archiver.py", line 2120, in run
  File "borg/archiver.py", line 99, in wrapper
  File "borg/repository.py", line 82, in __enter__
  File "borg/repository.py", line 103, in create
FileNotFoundError: [Errno 2] No such file or directory: '/home/<username redacted>/smb:/192.168.1.51/backup/Linux/Borg'

Platform: Linux x1 5.0.7-050007-generic #201904052141 SMP Fri Apr 5 21:43:20 UTC 2019 x86_64
Linux: debian buster/sid
Borg: 1.0.13  Python: CPython 3.5.6
PID: 2769  CWD: /home/<username redacted>
sys.argv: ['borg', 'init', '--encryption=repokey', 'smb://192.168.1.51/backup/Linux/Borg']
SSH_ORIGINAL_COMMAND: None

Cf. #111?

@ThomasWaldmann
Copy link
Member

directly using smb: is not supported, mount it first.

@LinuxOnTheDesktop
Copy link

    Thanks, but I do, I believe, have the location mounted. For, see below.

$  borg init --encryption=repokey /run/user/1000/gvfs
Repository /run/user/1000/gvfs already exists.
 ~  $  borg create /run/user/1000/gvfs::Thursday /home/<username redacted>/scripts
Failed to create/acquire the lock /run/user/1000/gvfs/lock.exclusive ([Errno 2] No such file or directory: '/run/user/1000/gvfs/lock.exclusive').
Traceback (most recent call last):
  File "borg/archiver.py", line 2184, in main
  File "borg/archiver.py", line 2120, in run
  File "borg/archiver.py", line 99, in wrapper
  File "borg/repository.py", line 83, in __enter__
  File "borg/repository.py", line 183, in open
  File "borg/locking.py", line 291, in acquire
  File "borg/locking.py", line 304, in _wait_for_readers_finishing
  File "borg/locking.py", line 146, in acquire
borg.locking.LockFailed: Failed to create/acquire the lock /run/user/1000/gvfs/lock.exclusive ([Errno 2] No such file or directory: '/run/user/1000/gvfs/lock.exclusive').

Platform: Linux x1 5.0.7-050007-generic #201904052141 SMP Fri Apr 5 21:43:20 UTC 2019 x86_64
Linux: debian buster/sid 
Borg: 1.0.13  Python: CPython 3.5.6
PID: 12095  CWD: /home/<username redacted>
sys.argv: ['borg', 'create', '/run/user/1000/gvfs::Thursday', '/home/<username redacted>/scripts']
SSH_ORIGINAL_COMMAND: None

    Perhaps you had in mind mounting the share using Samba, alone, i.e. without gvfs. I do not wish to do that. Here is why. The only way I managed to get shares working properly on my computer - because of problems with, I believe, all of systemd, samba itself, and the Nemo file manager - was to access shares via gvfs.

    (More precisely, I use the following procedure.

  1. Install gvfs.
  2. Give my file manager a path starting smb://.
  3. Bookmark the result.

Shares made available in that way are accessible outside of the file manager only after I have accessed them in the file manager. That is: if, since the last boot, I have not used my file manager bookmark, attempts to access the shares - outside of the file manager - fail until I do use the file manager. Yet, in the case in question, i.e. with borg, I had done that. Hence the /run/user/1000/gvfs mount point.)

@ThomasWaldmann
Copy link
Member

borg init --encryption=repokey smb://192.168.1.51/backup/Linux/Borg

This is not a normal fs path, nor is smb://... supported by borg.

@ThomasWaldmann
Copy link
Member

And for your last comment: there seems to be a lock in the repo. You can use borg break-lock ... to remove it, after making sure there is no other borg process accessing that repo.

@dankert
Copy link

dankert commented Jan 14, 2020

Hello,
i am using borg 1.1.10 with Xubuntu 19.10.
I want to create a borg repo on a samba share:

username@lx:~$ borg init -e repokey /run/user/1000/gvfs/smb-share:domain=hh.example.net,server=hmfs99.hh.example.net,share=usr_home,user=username/backup/borg-backup
Local Exception
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 4501, in main
    exit_code = archiver.run(args)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 4433, in run
    return set_ec(func(args))
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 151, in wrapper
    with repository:
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 187, in __enter__
    self.create(self.path)
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 280, in create
    self.save_config(path, config)
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 301, in save_config
    config.write(fd)
  File "/usr/lib/python3/dist-packages/borg/platform/base.py", line 176, in __exit__
    os.replace(self.tmppath, self.path)
FileNotFoundError: [Errno 2] No such file or directory: '/run/user/1000/gvfs/smb-share:domain=hh.example.net,server=hmfs99.hh.example.net,share=usr_home,user=username/backup/borg-backup/config.tmp' -> '/run/user/1000/gvfs/smb-share:domain=hh.example.net,server=hmfs99.hh.example.net,share=usr_home,user=username/backup/borg-backup/config'

Platform: Linux lx 5.3.0-26-generic #28-Ubuntu SMP Wed Dec 18 05:37:46 UTC 2019 x86_64
Linux: Ubuntu 19.10 eoan
Borg: 1.1.10  Python: CPython 3.7.5 msgpack: 0.5.6
PID: 9519  CWD: /home/username
sys.argv: ['/usr/bin/borg', 'init', '-e', 'repokey', '/run/user/1000/gvfs/smb-share:domain=hh.example.net,server=hmfs99.hh.example.net,share=usr_home,user=username/backup/borg-backup']
SSH_ORIGINAL_COMMAND: None

Shouldn't this bug be fixed in 1.1.10? Or am i doing someting wrong?
Thank you!

@ThomasWaldmann
Copy link
Member

@dankert what does this have to do with the topic of this issue?

Please do not append to random old and closed tickets.

Also, maybe try to mount the smb share at a simpler mountpoint and give that to borg.

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

No branches or pull requests

5 participants