Open feboss opened 9 years ago
Likely your fs does not support fcntl.lockf (with LOCK_EX to get an exclusive lock).
An idea would be to implement (or reuse) a different way of locking, e.g. directory based. portalocker?
I'm getting the same error after running attic init
on a repository located on a ZFS file system:
$ attic init test-repository
Initializing repository at "test-repository"
attic: Error: Failed to acquire write lock on test-repository/config
The repository appears to have been created even after the error, but attempting to attic create
to it fails with the same error after a moment or two.
I would be happy to implement a directory-based locking mechanism, but pointers on where to start would be appreciated.
@jasontbradshaw that was a locally mounted zfs? which OS precisely?
Just wondering: considering the amount of stuff ZFS does support, it would seem strange it does not support such simple things as fcntl.lockf.
The ZFS volume is running on a different machine running FreeNAS 9.3 on my local network, and is mounted using NFSv3. My desktop (on which I was attempting to run attic) runs Arch Linux.
Now that you mention it, NFS is probably the issue. However, this doesn't change the general problem that attic (apparently) requires a lock to operate, and can't reliably obtain one on all filesystems.
Ah, NFS, that explains it.
For NFS, maybe running lockd would help?
About the state of locking in general: http://0pointer.de/blog/projects/locking.html
@feboss @jasontbradshaw ^^^ can you try?
i installed borg with pip3. get this:
root@server1:/mnt/ftpB# borg init b
Initializing repository at "b"
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/borg/helpers.py", line 50, in __init__
fcntl.lockf(self.fd, fcntl.LOCK_EX)
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 857, in main
exit_code = archiver.run(sys.argv[1:])
File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 813, in run
return args.func(args)
File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 62, in do_init
repository = self.open_repository(args.repository, create=True, exclusive=True)
File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 37, in open_repository
repository = Repository(location.path, create=create, exclusive=exclusive)
File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 59, in __init__
self.open(path, exclusive)
File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 120, in open
self.lock = UpgradableLock(os.path.join(path, 'config'), exclusive)
File "/usr/local/lib/python3.4/dist-packages/borg/helpers.py", line 56, in __init__
raise self.WriteLockFailed(self.path)
borg.helpers.WriteLockFailed: b/config
borg: Error: Failed to acquire write lock on b/config
I meant the code from git (the new locking code is not on pypi yet).
lockd
already appears to be running on the FreeNAS box.
After installing attic manually from git (python setup.py install
, etc.), I get the exact same error.
I did the changes in borgbackup (a fork of attic): https://github.com/borgbackup/borg
Sorry for the confusion.
BTW, if you test the new code and have feedback for it, please use the issue tracker there.
I want backup in a ftp and i mount my ftp with curlftpfs. But i can't init. This is the error i get attic: Error: Failed to acquire write lock on test/config what can i do?