Bug 13898 - samba-tool domain backup offline --targetdir=/home/samba-backup FAILS
Summary: samba-tool domain backup offline --targetdir=/home/samba-backup FAILS
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.10.2
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Tim Beale
QA Contact: Samba QA Contact
Depends on:
Reported: 2019-04-15 19:48 UTC by Luc Lalonde
Modified: 2019-04-30 14:35 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Luc Lalonde 2019-04-15 19:48:46 UTC
I can't seem to get offline backups working.

Here's my environment:
- Samba 4.10.2
- Python 3.6.6
- CentOS 7.6.1810

Command line issued:

samba-tool domain backup offline --targetdir=/home/samba-backup


py_smbd_create_file: init_files_struct failed: NT_STATUS_INVALID_PARAMETER
. multiple repeats of previous line

ERROR(<class 'OSError'>): uncaught exception - [Errno 24] Too many open files: '/tmp/tmpz6unmjap/example.org/scripts'
  File "/usr/local/samba/lib64/python3.6/site-packages/samba/netcmd/__init__.py", line 185, in _run
    return self.run(*args, **kwargs)
  File "/usr/local/samba/lib64/python3.6/site-packages/samba/netcmd/domain_backup.py", line 1091, in run
    backup_offline(paths.sysvol, sysvol_tar, samdb, paths.smbconf)
  File "/usr/local/samba/lib64/python3.6/site-packages/samba/ntacls.py", line 570, in backup_offline
  File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 402, in _rmtree_safe_fd
    onerror(os.listdir, path, sys.exc_info())
  File "/usr/lib64/python3.6/shutil.py", line 399, in _rmtree_safe_fd
    names = os.listdir(topfd)
Comment 1 Douglas Bagnall 2019-04-18 04:18:22 UTC
> ERROR(<class 'OSError'>): uncaught exception - [Errno 24] Too many open files:

Have you tried increasing the limit on the number of open files? 
There are different ways to do that, depending on what kind of limit is set.

We may still have a problem, but that seems like the simplest workaround to try.
Comment 2 Luc Lalonde 2019-04-18 14:06:34 UTC
(In reply to Douglas Bagnall from comment #1)

If I do a "cat /proc/sys/fs/file-max", here's what I get:


What would you suggest I increase this to?
Comment 3 Stefan Metzmacher 2019-04-26 16:05:54 UTC
I saw something similar on restore.

a ulimit -n 819200 before fixed it.

But we should fix the fd leak...
Comment 4 Luc Lalonde 2019-04-30 14:35:08 UTC
(In reply to Stefan Metzmacher from comment #3)

Ok thanks.   I'll use the old backup script for the moment... until the leak gets fixed.