19

How do I completely rip-out smb / samba from my Ubuntu 11.10 machine?

How do I, afterwards, reinstall it cleanly?

UPDATE: My goal is to rip out any functionality related to Windows SMB from my desktop and do a clean re-install of these components. See this question for some background.

5 Answers 5

26

So, for the server, from the Terminal:

sudo apt-get remove --purge samba
sudo apt-get install samba

But, if you are having client problems, it would be more like:

sudo apt-get remove --purge smbclient libsmbclient
sudo apt-get install smbclient libsmbclient

Update:

Note that this answer only applies to Ubuntu 11.10! More recent Ubuntus will probably remove useful software with the apt remove command, so be sure to check what is being removed and if needed "cherrypick" packages in synaptic or similar.

9
  • After I have completed both "server" and "client" components, how come Nautilus still shows "Browse Network" and "Windows Network" then?
    – jldupont
    Nov 2, 2011 at 16:47
  • Is there a relationship with Gnome/GVFS somewhere along the lines? How do I get rid / re-install that too?
    – jldupont
    Nov 2, 2011 at 16:47
  • Even after your proposed steps, I still can do "mount -t cifs". How do I completely get rid of smb stuff and do a clean install?
    – jldupont
    Nov 2, 2011 at 16:49
  • 1
    The reason that you can still mount a cifs filesystem even after removing samba is that the cifs kernel module is not a part of any samba package. It is included in the kernel. That module has client support only for accessing cifs shares on a network. One does not need samba to access shares. But to create them samba needs to be installed.
    – Zoke
    Nov 2, 2011 at 18:52
  • 1
    sudo apt-get remove --purge smbclient libsmbclient command is removing useful softwares like gvfs-backends* libsmbclient* python3-smbc* software-center* system-config-printer-common* system-config-printer-gnome* ubuntu-desktop* vlc-plugin-samba* so vote down
    – Alex Jones
    May 30, 2015 at 11:07
14

A easier way to remove Samba that is simpler and cleaner.

sudo apt-get autoremove samba samba-common

This step uses the autoremove to remove the package.

sudo apt-get purge samba samba-common

This step cleans any configuration file you may have

1
  • This commands are completes total removal.
    – tanaydin
    Sep 1, 2017 at 12:46
3

In Ubuntu 18.04/20.04:

remove:

sudo apt -y remove --purge samba samba-common cifs-utils smbclient
sudo rm -rf /var/cache/samba /etc/samba /run/samba /var/lib/samba /var/log/samba

install:

sudo apt -y install samba samba-common smbclient cifs-utils winbind

source: Samba full audit

0

These solutions all relay on the system booting. But what do you do if your system is not booting because of samba?

If you are stuck in recovery mode, IE the rescue disk. apt-get does not always work, in fact it will get you a seg fault in a recovery shell, atleast on Ubuntu from what I've seen. To get around that, you can use dpkg --purge --force-all samba and also for common and winbind if the system still wont boot.

Remember if you are in the recorvery mode shell, do not use sudo, because that will cause a seg fault. Just use the commands as you would if you were in as root.

But I have had Samba cause a system to stop booting, and this is how I was able to rip samba out, and then do a clean install after I got the system booting all the way up again. Once it's booted all the way up, go through and do the sudo apt-get remove --purge samba samba-common command to make sure everything has been removed. Unfortunately, you may also have to manually delete some items, because dpkg does not always delete startup scripts and other items the binary creates. This is what I've had to do, to thoroughly remove samba, when I couldn't get the system to boot.

I hope this helps someone who was stuck in the same situation as me.

0

I recently installed Ubuntu 17.04 under VirtualBox on a Windows 7 host and I needed to access files on the host. I'm fairly new to Linux so I thought I needed samba to access those shares. As mentioned above by dpb, I was having client problems. It turned out all I really needed to do was remove samba. Having Ubuntu 17.04 meant I had to re-install cifs-utils, not smbclient in order to get client functionality back:

sudo apt-get install cifs-utils

After reboot, all my Windows network shares were accessible and client issues resolved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .