I got mad about the broken config file for samba. I just deleted the /etc/samba folder. Now I want to reinstall samba but I cannot.

This is what I did:

sudo apt-get install samba
sudo vim /etc/samba/... # broke something in the config
sudo apt-get remove --purge samba
# realized that the config file in the `/etc/samba` is still there.
sudo rm -r /etc/samba
sudo apt-get install samba # getting error

I want to remove samba (delete completely) then install it like nothing happened before?

How to do this?


dpkg: error processing package samba (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (215-17+deb8u4) ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)


  • The first install was 54.2MB
  • The uninstall was 11.5MB
  • The second install was 11.5MB
  • After you purge it, if you then run sudo apt-get --purge autoremove, does that make any difference?
    – user364819
    Sep 2 '16 at 17:36
  • Also, what is the output of locate samba and service --status-all | grep samba after running the purge command you ran and the one I gave?
    – user364819
    Sep 2 '16 at 17:45

Well mostly your installation have install more dependent packages other than the samba package alone. So why your next install doesn't need the size of files that downloaded earlier. So if you need to remove it completely like you asked then you need to uninstall it and remove the unwanted dependecies.

sudo apt-get remove --purge samba samba-*
sudo apt-get autoremove

After that If you find the config files in /etc/samba better rename it.

sudo mv  /etc/samba /etc/samba.old

Now you can install samba by issuing the command

sudo apt-get install samba

Thats it.

  • 1
    sudo apt-get remove --purge samba samba-* then install solved it. Sep 2 '16 at 19:24
  • Thank you so much. I was fed up with those errors May 23 '20 at 18:48
  • This removed ubuntu-desktop as well as a few other things for me, weirdly.
    – Danny
    Aug 1 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.