My environment (although probably not distribution specific) is Ubuntu Focal 20.04 using default packages. After a recent upgrade from 4.11.x to 4.13.14 the domain backup command has started failing with this exception: running backup on dirs: /var/lib/samba/private /var/lib/samba /etc/samba ERROR(<class 'FileNotFoundError'>): uncaught exception - [Errno 2] No such file or directory: '/var/lib/samba/dfs/netlogon' File "/usr/lib/python3/dist-packages/samba/netcmd/__init__.py", line 186, in _run return self.run(*args, **kwargs) File "/usr/lib/python3/dist-packages/samba/netcmd/domain_backup.py", line 1105, in run if any(os.path.samefile(full_path, file) for file in all_files): File "/usr/lib/python3/dist-packages/samba/netcmd/domain_backup.py", line 1105, in <genexpr> if any(os.path.samefile(full_path, file) for file in all_files): File "/usr/lib/python3.8/genericpath.py", line 100, in samefile s1 = os.stat(f1) $ apt-cache policy samba samba: Installed: 2:4.13.14+dfsg-0ubuntu0.20.04.1 Candidate: 2:4.13.14+dfsg-0ubuntu0.20.04.1 Version table: *** 2:4.13.14+dfsg-0ubuntu0.20.04.1 500 500 http://gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages 100 /var/lib/dpkg/status 2:4.11.6+dfsg-0ubuntu1 500 500 http://gb.archive.ubuntu.com/ubuntu focal/main amd64 Packages The backup is executed as: /usr/bin/samba-tool domain backup offline --targetdir="${BACKDIR}" I suspect that the cause of the issue is having a [dfs] share under /var/lib/samba which is included in the backup. The directory contains dangling symbolic links of the form: lrwxrwxrwx 1 root root 39 Mar 26 2021 sysvol -> msdfs:dc0\sysvol,dc1\sysvol
Created attachment 17026 [details] possible fix Are you able to try this patch?
This may have been caused by the fix for bug #14027.
There is an extra umatched '(' in the last '+' line but otherwise applying that patch allows the backup command to complete. I see the new 'info' message printed for the dangling links.
Created attachment 17033 [details] fix v2, with non-symlink-following variation thanks for that. I am wondering if we actually want to follow symlinks at all, or just back them up as is (as per the second patch in this series). We already won't follow directory symlinks. Joseph? Andrew?
Comment on attachment 17033 [details] fix v2, with non-symlink-following variation Yes, I think this is the right approach. Please push up a MR.
(In reply to Andrew Bartlett from comment #5) https://gitlab.com/samba-team/samba/-/merge_requests/2275
This bug was referenced in samba master: 697abc15ea50e9069eb483fdd734588281bae123 0f7e58b0e29778711d3385adbba957c175c3bdef