[Borgbackup] borg delete failure with stack trace

Thomas Waldmann tw at waldmann-edv.de
Sun Oct 20 11:04:24 EDT 2019


>> Everything is fine.
> 
> The repo looked too big, as if it had at least partially done that
> mistaken create without excluding .nobackup.

If you look at the repo before the next write operation, it will still
have the uncommitted stuff in it from the interrupted borg create run.

But these uncommitted segment files should be "rolled back" (deleted) to
the last committed state at the next borg operation in this repo.

> I decided to start from scratch for various unrelated reasons.
> However, I made a different mistake this time, and the repo won't allow
> creations of any more archives as a result. Here are the details:
> 
> $ borg init --encryption none borgrepo
> 
> $ borg create --exclude-if-present '.nobackup' --stats borgrepo::first /home/me
> 
> $ borg create --exclude-if-present '.nobackup' --stats borgrepo::second /home/me
> 
> all worked, then the mistake (the actual user name wasn't 'me', so the
> actual typo wasn't 'notme' - it was a single letter omission):
> 
> $ borg create --exclude-if-present '.nobackup' --stats borgrepo::third /home/notme
> /home/notme: [Errno 2] No such file or directory: '/home/notme'
> 
> ---> ^C'ed it here - immediately after the error message, and
> retried without the mistake:

Well, no need to Ctrl-C here, it would have terminated soon after anyway
(as it basically had nothing to do).

Of course even if Ctrl-Cing it, it should not bring stuff into a
problematic state...


> $ borg create --exclude-if-present '.nobackup' --stats borgrepo::third /home/me
> Archive third already exists
> 
> it made the archive, or part of it, even though it had no source:
> 
> $ borg list borgrepo
> first                                Sat, 2019-10-19 17:43:39
> [32e1e882ef4948ba8a59abcfbfb655df71704f88366506ba307b8b8d12bc52a1]
> second                               Sat, 2019-10-19 17:45:12
> [b0459333ddece1ce236aecf55f666c5ab639c596f088d86c2fed09596b448a07]
> third                                Sun, 2019-10-20 08:54:22
> [e6277e63fe56ddbff1cd410dfe6826efd2e703a91a306d113e870a4df80c1bf4]
> 
> but won't let go:
> 
> $ borg delete borgrepo::third
> Local Exception
> Traceback (most recent call last):
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 4501,
> in main exit_code = archiver.run(args)
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 4433,
> in run return set_ec(func(args))
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 166,
> in wrapper return method(self, args, repository=repository, **kwargs)
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 1257,
> in do_delete return self._delete_archives(args, repository)
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 1310,
> in _delete_archives repository.commit(save_space=args.save_space)
>   File "/usr/lib/python3.7/site-packages/borg/repository.py", line 438,
> in commit self.check_free_space()
>   File "/usr/lib/python3.7/site-packages/borg/repository.py", line 644,
> in check_free_space compact_working_space =
> sum(self.io.segment_size(segment) - free for segment, free in
> self.compact.items()) File
> "/usr/lib/python3.7/site-packages/borg/repository.py", line 644, in
> <genexpr> compact_working_space = sum(self.io.segment_size(segment) -
> free for segment, free in self.compact.items()) File
> "/usr/lib/python3.7/site-packages/borg/repository.py", line 1349, in
> segment_size return os.path.getsize(self.segment_filename(segment))
> File "/usr/lib/python3.7/genericpath.py", line 50, in getsize return
> os.stat(filename).st_size FileNotFoundError: [Errno 2] No such file or
> directory: '/<...>/borgrepo/data/0/7'
> 
> Platform: Linux <...> 5.3.6-1-MANJARO #1 SMP PREEMPT Sat Oct 12
> 09:30:05 UTC 2019 x86_64 Linux: arch Manjaro Linux
> Borg: 1.1.10  Python: CPython 3.7.4 msgpack: 0.5.6
> PID: 1650  CWD: /home/me/Desktop
> sys.argv: ['/usr/bin/borg', 'delete',
> '/<...>/borgrepo::third'] SSH_ORIGINAL_COMMAND: None

That looks like a bug.


> $ borg info borgrepo::third
> Number of files: 0

Yeah, as I said: nothing to do.


> Worst of all, further creates fail:
> 
> $ borg create --exclude-if-present '.nobackup' --stats borgrepo::fourth /home/me
> Local Exception
> Traceback (most recent call last):
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 4501,
> in main exit_code = archiver.run(args)
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 4433,
> in run return set_ec(func(args))
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 166,
> in wrapper return method(self, args, repository=repository, **kwargs)
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 573,
> in do_create create_inner(archive, cache)
>   File "/usr/lib/python3.7/site-packages/borg/archiver.py", line 538,
> in create_inner archive.save(comment=args.comment,
> timestamp=args.timestamp) File
> "/usr/lib/python3.7/site-packages/borg/archive.py", line 515, in save
> self.repository.commit() File
> "/usr/lib/python3.7/site-packages/borg/repository.py", line 438, in
> commit self.check_free_space() File
> "/usr/lib/python3.7/site-packages/borg/repository.py", line 644, in
> check_free_space compact_working_space =
> sum(self.io.segment_size(segment) - free for segment, free in
> self.compact.items()) File
> "/usr/lib/python3.7/site-packages/borg/repository.py", line 644, in
> <genexpr> compact_working_space = sum(self.io.segment_size(segment) -
> free for segment, free in self.compact.items()) File
> "/usr/lib/python3.7/site-packages/borg/repository.py", line 1349, in
> segment_size return os.path.getsize(self.segment_filename(segment))
> File "/usr/lib/python3.7/genericpath.py", line 50, in getsize return
> os.stat(filename).st_size FileNotFoundError: [Errno 2] No such file or
> directory: '/.../borgrepo/data/0/7'
> 
> Platform: Linux <...> 5.3.6-1-MANJARO #1 SMP PREEMPT Sat Oct 12
> 09:30:05 UTC 2019 x86_64 Linux: arch Manjaro Linux
> Borg: 1.1.10  Python: CPython 3.7.4 msgpack: 0.5.6
> PID: 1669  CWD: /home/me/Desktop
> sys.argv: ['/usr/bin/borg', 'create', '--exclude-if-present',
> '.nobackup', '--stats', '/<...>/borgrepo::fourth',
> '/home/me'] SSH_ORIGINAL_COMMAND: None

Same issue as above.


I'll create an issue on github for this - thanks for finding it!


-- 

GPG ID: 9F88FB52FAF7B393
GPG FP: 6D5B EF9A DD20 7580 5747 B70F 9F88 FB52 FAF7 B393


More information about the Borgbackup mailing list