14

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.

19

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
  • After I have completed both "server" and "client" components, how come Nautilus still shows "Browse Network" and "Windows Network" then? – jldupont Nov 2 '11 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 '11 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 '11 at 16:49
  • apt-get purge samba does the same. – Oxwivi Nov 2 '11 at 16:56
  • 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 '11 at 18:52
7

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

  • This commands are completes total removal. – tanaydin Sep 1 '17 at 12:46
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.

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.