Unable to Fully Uninstall and Reinstall Samba - Unique errors?

5,092

First list all instances of the samba packages that are installed:

The command for pre 14.04 is:

 $ dpkg --get-selections | grep -v deinstall | egrep samba

For 14.04 and after the command is:

 $ apt list --installed | egrep samba

The latter comes with a warning that can be ignored. (https://askubuntu.com/a/463966/29012)

Now manually remove those instances from the output individually with:

$ sudo apt remove [item from output]

Now finally remove the no longer required packages with:

$ sudo apt autoremove
Share:
5,092
thursDave
Author by

thursDave

Updated on September 18, 2022

Comments

  • thursDave
    thursDave almost 2 years

    Running 16.04.1 server 32 with LXDE on top. Just made a mess for myself. Please help. Want to fix it to understand Linux better. Reinstall OS easy enough but just don't wanna.

    Uninstalled Samba with

    sudo apt-get remove --purge samba
    

    Also tried these

    sudo apt-get -f install
    
    
    
    dnsadmin@trm-linfs04:~$ sudo apt-get -f install
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.3) ...
    Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    dpkg: error processing package samba (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu5) ...
    Errors were encountered while processing:
     samba
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
        sudo apt-get autoremove
    
    
    Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    dpkg: error processing package samba (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu5) ...
    Errors were encountered while processing:
     samba
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    Probably a mistake to do the purge, but...

    dnsadmin@trm-linfs04:~$ sudo dpkg --configure -a                                                                                Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.3) ...
    Job for smbd.service failed because the control process exited with error code.                                                 See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    dpkg: error processing package samba (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu5) ...
    Errors were encountered while processing:
     samba
    dnsadmin@trm-linfs04:~$ sudo status smbd
    status: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/up                                                start: Connection refused
    dnsadmin@trm-linfs04:~$ status: Unable to connect to Upstart: Failed to connect                                                 to socket /com/ubuntu/upstart: Connection refused
    No command 'status:' found, did you mean:
     Command 'status' from package 'upstart' (main)
    status:: command not found
    dnsadmin@trm-linfs04:~$ serevice smbd status
    No command 'serevice' found, did you mean:
     Command 'service' from package 'init-system-helpers' (main)
    serevice: command not found
    dnsadmin@trm-linfs04:~$ service smbd status
    ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
       Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Tue 2017-01-31 11:54:05 EST; 2min 21
         Docs: man:systemd-sysv-generator(8)
      Process: 12400 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE
    
    Jan 31 11:54:05 trm-linfs04 systemd[1]: Starting LSB: start Samba SMB/CIFS daemo
    Jan 31 11:54:05 trm-linfs04 smbd[12400]:  * Starting SMB/CIFS daemon smbd
    Jan 31 11:54:05 trm-linfs04 smbd[12400]:    ...fail!
    Jan 31 11:54:05 trm-linfs04 systemd[1]: smbd.service: Control process exited, co
    Jan 31 11:54:05 trm-linfs04 systemd[1]: Failed to start LSB: start Samba SMB/CIF
    Jan 31 11:54:05 trm-linfs04 systemd[1]: smbd.service: Unit entered failed state.
    Jan 31 11:54:05 trm-linfs04 systemd[1]: smbd.service: Failed with result 'exit-c
    lines 1-13/13 (END)
    ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
       Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Tue 2017-01-31 11:54:05 EST; 2min 21s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 12400 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)
    

    Any ideas?

    Just want to get rid of it completely and reinstall.

    Will be using Webmin 1.831 to manage. I obviously have no clue what I'm doing.

    Any help would be grand. Thanks, Ubuntu Warriors!

  • thursDave
    thursDave over 7 years
    Well, that worked superbly. Thank you so much. The first command using dpkg gave a simplified output, while the apt command gave a much more detailed one. Both worked on my 16.04.1 box.
  • thursDave
    thursDave over 7 years
    Now I would like to understand what was actually happening. It seems that the purge command I ran at first merely cued the packages up for uninstall but I did not execute a full removal/installation of the packages. The purge command did not actually uninstall them, but did disable them and made certain commands unable to see them for processing? Any short explanation of how the uninstall process actually works and what's best practice for a 16.04 installation? Thanks again.
  • Apologician
    Apologician over 7 years
    @davidintheusa Glad it worked. Consider clicking the gray checkmark to mark the answer as accepted.
  • thursDave
    thursDave over 7 years
    James, new at this. Will get the upvoting, checking down. Thanks.