I recently upgraded my Ubuntu installation from 10.10 to 11.04 and the samba4 package had big problems being updated or installed. I finally found a way to properly install it, so hopefully this will be helpful to others.
First, the tail of the installation output for the samba4 package:
module samba_dsdb initialization failed : No such object
Unable to load modules for /var/lib/samba/private/sam.ldb: dsdb_module_search_dn: did not find base dn @ROOTDSE (0 results)
Traceback (most recent call last):
File “/usr/share/samba/setup/upgradeprovision”, line 1597, in <module>
ldbs = get_ldbs(paths, creds, session, lp)
File “/usr/lib/python2.7/dist-packages/samba/upgradehelpers.py”, line 159, in get_ldbs
ldbs.sam = SamDB(paths.samdb, session_info=session, credentials=creds, lp=lp, options=[“modules:samba_dsdb”])
File “/usr/lib/python2.7/dist-packages/samba/samdb.py”, line 53, in __init__
File “/usr/lib/python2.7/dist-packages/samba/__init__.py”, line 110, in __init__
self.connect(url, flags, options)
File “/usr/lib/python2.7/dist-packages/samba/samdb.py”, line 66, in connect
_ldb.LdbError: (80, ‘dsdb_module_search_dn: did not find base dn @ROOTDSE (0 results)’)
dpkg: error processing samba4 (–configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
I first looked around… a few people had reported similar issues but the answers weren’t useful. The most common one in several places was, “Why are you using samba 4? It’s experimental!” I’ve heard that only samba4 works (well | at all?) with Windows 7 protocols. Not sure about that but it was clear that downgrading to regular samba (v3) wasn’t an ideal solution. (Note: it’s been a while since I dealt with interop issues on samba… I apparently originally installed samba4 in 10.04 or 10.10 as part of trying to talk with Windows 7.)
Finally, having done due diligence, I posted my problem as a bug report. After a few iterations it was mentioned that I should “purge” the samba database. Hmm. I didn’t see that mentioned anywhere else when I searched before (on my particular install error). So I tried it and lo and behold! The purge worked!
So, to install/upgrade samba4 on Ubuntu 11.04, you can try the following (Disclaimer: always back up first!):
# Attempt to install samba4: sudo apt-get install samba4 # Assuming it fails to install correctly #("_ldb.LdbError: (80, 'dsdb_module_search_dn: did not find # base dn @ROOTDSE (0 results)')" is the error I was dealing # with), purge samba4: sudo apt-get purge samba4 # Finally, attempt to install samba4 again: sudo apt-get install samba4
That should do it. If it doesn’t do it, maybe you are having a different issue.
EDIT: There’s some useful info on this page about configuring Ubuntu 11.04 Samba so as to play nice with Windows. Also, your smb.conf is probably in /etc/samba… installing samba doesn’t install a default config file even if this one is absent. I’m not sure why yet but I’d like to know since my existing one is throwing warnings when you run “samba” as a command (several “unknown parameters” are getting “ignored”… probably fine but I wish I had a clean smb.conf for this release to compare against.)
EDIT2: There’s another tutorial here about Ubuntu 11.04, Samba 3 and sharing with Windows.