Problems updating/installing samba4 in Ubuntu 11.04? Read here!

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/”, 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/”, line 53, in __init__
File “/usr/lib/python2.7/dist-packages/samba/”, line 110, in __init__
self.connect(url, flags, options)
File “/usr/lib/python2.7/dist-packages/samba/”, 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.


  1. I tried to install samba4 (for apache2) on ubuntu 11.10, and came across the same situation. After I purged and installed samba4 again. The installation still fails, but an error message is returned prompting me to remove /etc/samba/smb.conf.

    I did just that by
    # sudo su
    cd /etc/samba/
    rm smb.conf

    and then repeat
    agt-get install samb4.

    This time the installation succeeded
    Thank you for your posting on the purge hint.


  2. I’ve got the same / similar problem. Unfortunately I’ve already tried the above but the reinstall still fails.

    Any ideas


  3. I’ve got the same problem too. who can give me some ideas?


  4. Obrigado !
    resolveu o problema !


    1. Good start with the Wikipedia article. We had a slimiar effort to create an article for Ask Ubuntu as well. The entire process wasn’t as smooth as we would have expected, as we ran into several problems like spam regulations on Wikipedia and as such. It is good to see that Ubuntu forums don’t have that issues right now. And, good luck on your endeavours.


Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.