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 create crashes if parent dir of recursion root can not be opened #6374

Closed
skibbipl opened this issue Feb 26, 2022 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@skibbipl
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).

borg 1.2.0

Operating system (distribution) and version.

Linux xxxx 5.16.0-1-amd64 #1 SMP PREEMPT Debian 5.16.7-2 (2022-02-09) x86_64 GNU/Linux

Hardware / network configuration, and filesystems used.

ext4, nothing fancy

Describe the problem you're observing.

After upgrading to 1.2 borg crashes when it cannot find file from the configuration. In 1.1.x version it skipped it with warning.

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

Add non exisiting file to backup script.

Include any warning/errors/backtraces from the system logs

Local Exception
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/borg/archive.py", line 264, in OsOpen
    fd = os_open(path=path, parent_fd=parent_fd, name=name, flags=flags, noatime=noatime)
  File "/usr/lib/python3/dist-packages/borg/helpers/fs.py", line 290, in os_open
    fd = os.open(fname, _flags_noatime, dir_fd=parent_fd)
FileNotFoundError: [Errno 2] No such file or directory: '/etc/dnsmasq.d'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 5089, in main
    exit_code = archiver.run(args)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 5020, in run
    return set_ec(func(args))
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 183, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 668, in do_create
    create_inner(archive, cache, fso)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 595, in create_inner
    with OsOpen(path=parent_dir, flags=flags_root, noatime=True, op='open_root') as parent_fd:
  File "/usr/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/lib/python3/dist-packages/borg/archive.py", line 264, in OsOpen
    fd = os_open(path=path, parent_fd=parent_fd, name=name, flags=flags, noatime=noatime)
  File "/usr/lib/python3/dist-packages/borg/archive.py", line 218, in __exit__
    raise BackupOSError(self.op, exc_val) from exc_val
borg.archive.BackupOSError: open_root: [Errno 2] No such file or directory: '/etc/dnsmasq.d'

Platform: Linux xxxxx 5.16.0-1-amd64 #1 SMP PREEMPT Debian 5.16.7-2 (2022-02-09) x86_64
Linux: Unknown Linux
Borg: 1.2.0  Python: CPython 3.9.10 msgpack: 1.0.3 fuse: pyfuse3 3.2.0 [pyfuse3,llfuse]
@ThomasWaldmann
Copy link
Member

Please give the precise command that led to that traceback.

@ThomasWaldmann ThomasWaldmann added this to the 1.2.1 milestone Feb 26, 2022
@skibbipl
Copy link
Author

skibbipl commented Feb 26, 2022

Standard borg create:

borg create                                             \
    --verbose                                           \
    --filter=AME                                        \
    --list                                              \
    --stats                                             \
    --show-rc                                           \
    --compression=lzma,9                                \
    --exclude 'lost+found/*'                            \
    --exclude '*.git/'                                  \
    --exclude '*~'                                      \
                                                        \
    ::'{hostname}-{now}'                                \
    ...                                                 \
    /etc/dnsmasq.d/`hostname`.conf                      \
    ...

And this computer don't have /etc/dnsmasq.d/ currently, but I never modfied the backup script...

ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Feb 27, 2022
@ThomasWaldmann ThomasWaldmann self-assigned this Feb 27, 2022
@ThomasWaldmann ThomasWaldmann changed the title Borg backup crashes when there is no file in the backup borg create crashes if parent dir of recursion root can not be opened Feb 27, 2022
@ThomasWaldmann
Copy link
Member

Thanks for reporting this issue, I could reproduce and fix it.

Just a hint (unrelated to this bug):

You use lzma,9 - that is super slow and likely wastes a lot of cpu cycles for nothing.

See our docs about the maximum recommended lzma level and maybe even better: consider using zstd (much more modern and likely better/faster than lzma).

@skibbipl
Copy link
Author

Great news. About that lzma, you're absolutely right. This is just an old server and the backup script was configured long time ago. I use zstd on other boxes with borgbackup.

ThomasWaldmann added a commit that referenced this issue Mar 5, 2022
create: skip with warning if opening the parent dir of recursion root fails, fixes #6374
ThomasWaldmann added a commit that referenced this issue Mar 5, 2022
create: skip with warning if opening the parent dir of recursion root fails, fixes #6374
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

2 participants