Bug 13898 - samba-tool domain backup offline --targetdir=/home/samba-backup FAILS
Summary: samba-tool domain backup offline --targetdir=/home/samba-backup FAILS
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.12.5
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2019-04-15 19:48 UTC by Luc Lalonde
Modified: 2021-03-11 11:47 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.
Comment 5 Luc Lalonde 2020-11-24 18:49:30 UTC
This is still a bug with version 4.12.5

The ulimit command is helpful in getting past it.
Comment 6 Samba QA Contact 2021-02-10 15:07:12 UTC
This bug was referenced in samba master:

Comment 7 Björn Jacke 2021-02-10 16:51:19 UTC
Karo, the commit should also be cherry-picked to the supported release branches.
Comment 8 Karolin Seeger 2021-02-15 12:32:30 UTC
(In reply to Björn Jacke from comment #7)
Pushed to autobuild-v4-{14,13,12-test}.
Comment 9 Samba QA Contact 2021-02-16 17:17:21 UTC
This bug was referenced in samba v4-13-test:

Comment 10 Samba QA Contact 2021-02-16 18:28:21 UTC
This bug was referenced in samba v4-14-test:

Comment 11 Samba QA Contact 2021-02-16 22:34:06 UTC
This bug was referenced in samba v4-12-test:

Comment 12 Samba QA Contact 2021-02-18 09:52:48 UTC
This bug was referenced in samba v4-14-stable (Release samba-4.14.0rc3):

Comment 13 Samba QA Contact 2021-03-09 11:02:34 UTC
This bug was referenced in samba v4-13-stable (Release samba-4.13.5):

Comment 14 Samba QA Contact 2021-03-11 11:47:13 UTC
This bug was referenced in samba v4-12-stable (Release samba-4.12.12):