env: - FreeBSD 14.2-RELEASE-p1 - net/samba420 command: # samba-tool domain provision --domain=DEV --realm=dev.example.com --adminpass=XXXXXXXXXX --use-rfc2307 --dns-backend=BIND9_DLZ --server-role dc result: WARNING: Using passwords on command line is insecure. Installing the setproctitle python module will hide these from shortly after program start. INFO 2025-02-06 10:38:31,462 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2119: Looking up IPv4 addresses INFO 2025-02-06 10:38:31,462 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2136: Looking up IPv6 addresses WARNING 2025-02-06 10:38:31,462 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2143: No IPv6 address will be assigned INFO 2025-02-06 10:38:31,683 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2309: Setting up share.ldb INFO 2025-02-06 10:38:31,703 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2313: Setting up secrets.ldb INFO 2025-02-06 10:38:31,714 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2318: Setting up the registry INFO 2025-02-06 10:38:31,748 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2321: Setting up the privileges database INFO 2025-02-06 10:38:31,769 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2324: Setting up idmap db INFO 2025-02-06 10:38:31,784 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #2331: Setting up SAM db INFO 2025-02-06 10:38:31,793 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #882: Setting up sam.ldb partitions and settings INFO 2025-02-06 10:38:31,793 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #894: Setting up sam.ldb rootDSE INFO 2025-02-06 10:38:31,795 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1310: Pre-loading the Samba 4 and AD schema Unable to determine the DomainSID, can not enforce uniqueness constraint on local domainSIDs INFO 2025-02-06 10:38:31,828 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1387: Adding DomainDN: DC=dev,DC=example,DC=com INFO 2025-02-06 10:38:31,838 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1419: Adding configuration container INFO 2025-02-06 10:38:31,849 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1434: Setting up sam.ldb schema INFO 2025-02-06 10:38:33,535 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1454: Setting up sam.ldb configuration data INFO 2025-02-06 10:38:33,652 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1496: Setting up display specifiers INFO 2025-02-06 10:38:34,665 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1504: Modifying display specifiers and extended rights INFO 2025-02-06 10:38:34,689 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1511: Adding users container INFO 2025-02-06 10:38:34,691 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1517: Modifying users container INFO 2025-02-06 10:38:34,691 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1520: Adding computers container INFO 2025-02-06 10:38:34,692 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1526: Modifying computers container INFO 2025-02-06 10:38:34,693 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1530: Setting up sam.ldb data INFO 2025-02-06 10:38:34,792 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1561: Setting up well known security principals INFO 2025-02-06 10:38:34,812 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1575: Setting up sam.ldb users and groups INFO 2025-02-06 10:38:34,901 pid:66515 /usr/local/lib/python3.11/site-packages/samba/provision/__init__.py #1583: Setting up self join check_spn_alias_collision: trying to add SPN 'DNS/vm-freebsd2.dev.example.com' on 'CN=dns-vm-freebsd2,CN=Users,DC=dev,DC=example,DC=com' when 'host/vm-freebsd2.dev.example.com' is on 'CN=VM-FREEBSD2,OU=Domain Controllers,DC=dev,DC=example,DC=com' Repacking database from v1 to v2 format (first record CN=ms-DNS-Propagation-Time,CN=Schema,CN=Configuration,DC=dev,DC=example,DC=com) Repack: re-packed 10000 records so far Repacking database from v1 to v2 format (first record CN=domainDNS-Display,CN=412,CN=DisplaySpecifiers,CN=Configuration,DC=dev,DC=example,DC=com) Repacking database from v1 to v2 format (first record CN=AdminSDHolder,CN=System,DC=dev,DC=example,DC=com) ERROR(<class 'NameError'>): uncaught exception - name 'targetdir' is not defined File "/usr/local/lib/python3.11/site-packages/samba/netcmd/__init__.py", line 285, in _run return self.run(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/samba/netcmd/domain/provision.py", line 343, in run result = provision(self.logger, ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/samba/provision/__init__.py", line 2363, in provision provision_fill(samdb, secrets_ldb, logger, names, paths, File "/usr/local/lib/python3.11/site-packages/samba/provision/__init__.py", line 1972, in provision_fill if targetdir and smbd.have_nfsv4_acls() and smbd.has_nfsv4_acls(targetdir): ^^^^^^^^^ misc: - w/o --dns-backend=BIND9_DLZ, or adding --targetdir would not change at all - this was worked on net/samba419. some files created in provisioning are successfully stored into /var/db/samba4/ and also created /usr/local/etc/smb4.conf, but not completely. Regards,
Looks like the problem is that targetdir is used and isn't passed down. The problem can be fixed by passing targetdir to provision_fill, so the calls in join.py, line 919 (I passed ctx.targetdir just before ctx.paths ) and __init__.py, line 1913 ( added targetdir as a parameter ) These files are in /usr/local/lib/python3.11/site-packages/samba
(In reply to Roger Fujii from comment #1) Is this an upstream or downstream problem?
Unclear if it is upstream or downstream - I only debugged the 420 pkg install. As this is with samba-tool, which is a python package, not sure where the source came from, so figured the ports builder would know.
(In reply to Roger Fujii from comment #3) My question was rather whether why apply a downstream patch which could break it. I didn't check it.
(In reply to Michael Osipov from comment #4) I thinks it's a downtream problem: "targetdir" usage in "provision_fill" is added by patch "0024-Cherry-pick-ZFS-provisioning-code-by-iXsystems-Inc.patch". So, possibly, it's that patch that is incomplete.
Adding targetdir at a few places fixes provisioning, as sugessted by Roger Fujii. Plese see https://bugs.freebsd.org/bugzilla/attachment.cgi?id=262046&action=diff#b/net/samba422/files/patch-python_samba_join.py_sec1 and https://bugs.freebsd.org/bugzilla/attachment.cgi?id=262046&action=diff#b/net/samba422/files/patch-python_samba_provision_____init____.py_sec1
the targetdir argument should not be added to provision_fill in python/samba/provision/__init__.py. The official samba 4.20.7's provision_fill() does not have targetdir (look around lines 1965-1968): https://gitlab.com/samba-team/samba/-/blob/samba-4.20.7/python/samba/provision/__init__.py?ref_type=tags While the file from the package samba420-4.20.7_11 has line below on 1972: if targetdir and smbd.have_nfsv4_acls() and smbd.has_nfsv4_acls(targetdir): This line should have been deleted.
(In reply to Hiroo Ono from comment #7) So, would you say that: if targetdir and smbd.have_nfsv4_acls() and smbd.has_nfsv4_acls(targetdir): smbd.set_nfsv4_defaults() is entirely incorrect and should be removed from net/samba420? If so, then we should remove that from net/samba422 and net/samba423 as well.
(In reply to Mateusz Piotrowski from comment #8) As far as I remember, targetdir for is added by some of the zfs/nfsv4acl compatibility patches, I think there's just some place where it needs to be added, rather than removed completely. At least I wouldn't remove it in the working 422 port.
(In reply to Mateusz Piotrowski from comment #8) Sorry, this was a part added by FreeBSD ports' patch, so we should keep it. An annoying thing is that the targetdir argument of provision_fill() is removed between samba4.19 and samba4.20 as it is not used in official version, and we have to add targetdir argument forever. (4.22 and 4.23 also need it). https://gitlab.com/samba-team/samba/-/blob/samba-4.19.9/python/samba/provision/__init__.py?ref_type=tags line 1922 https://gitlab.com/samba-team/samba/-/blob/samba-4.20.8/python/samba/provision/__init__.py?ref_type=tags line 1906