latest git version root@sys11:/etc/ssl/local# /usr/local/samba/bin/samba-tool domain classicupgrade --dbdir=/tmp/samba --use-xattrs=yes --realm=ad.vpac.org /tmp/smb.conf Reading smb.conf WARNING: The "idmap backend" option is deprecated WARNING: The "idmap uid" option is deprecated WARNING: The "idmap gid" option is deprecated Unknown parameter encountered: "share modes" Ignoring unknown parameter "share modes" Provisioning Exporting account policy Exporting groups Exporting users Skipping wellknown rid=501 (for username=nobody) Next rid = 101007 Failed to bind - LDAP client internal error: NT_STATUS_UNEXPECTED_NETWORK_ERROR Failed to connect to 'ldapi:///' with backend 'ldapi': (null) Could not open ldb connection to ldapi:///, the error message is: (1, None) Exporting posix attributes ERROR(<type 'exceptions.UnboundLocalError'>): uncaught exception - local variable 'ldb_object' referenced before assignment File "/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py", line 175, in _run return self.run(*args, **kwargs) File "/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain.py", line 1318, in run useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs) File "/usr/local/samba/lib/python2.7/site-packages/samba/upgrade.py", line 800, in upgrade_from_samba3 homes[username] = get_posix_attr_from_ldap_backend(logger, ldb_object, base_dn, username, "homeDirectory") It doesn't connect to the passdb LDAP server, but it just connected to the same server fine to export the users/groups? There is also the issue that it doesn't abort cleanly, and as a result gets confused because ldb_object is never defined. I notice it says "backend 'ldapi'", wondering if that is normal? Or should it be ldapsam?
Seems to work better if I replace: passdb backend = ldapsam:ldapi:/// with: passdb backend = ldapsam:ldap://localhost/ In the source smb.conf
This exact error was possible in (e.g.) 4.0.26, because we had around line 790: for url in urls.split(): try: ldb_object = Ldb(url, credentials=creds) except ldb.LdbError, e: logger.warning("Could not open ldb connection to %s, the error message is: %s", url, e) else: break which smothers the LdbError, but the function goes on to try to use ldb_object, which is not set because of the exception. This was fixed by the combination of these commits in 2013 and 2014: e7e37b3b90100f762a45f2f3c047e14e3619c216 c9b1f6b366e4f51c8fbf1051bcb44c7d91364b89 The underlying issue that caused the LdbError seems to have been addressed in comment 1, above.