[Solved] Samba and Debian Stretch Cannot start daemon


Samba has become quite unstable last few years and I use it less and less.
However I need it again for some windows clients.

I did a dpkg --purge samba to make sure all old config files are removed.

However upon installation of samba: the daemon refuses to start.
I tried all advice online I could find, also permissions on private folders, but daemon dies at install, or started from /etc/init.d or from service call.

Anyone has an idea.
Here is the output from the install and the error encountered when daemon started by installer.
I dont know why it now want to do active directory and such nonsense I dont need. There is no such package samba-dc or samba-ad-dc available for Debian Stretch so how do I get around this mess ?

$] apt install samba
Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
bind9 bind9utils ctdb ldb-tools smbldap-tools winbind
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/934 kB of archives.
After this operation, 11.2 MB of additional disk space will be used.
Selecting previously unselected package samba.
(Reading database … 651822 files and directories currently installed.)
Preparing to unpack …/samba_2%3a4.5.16+dfsg-1_amd64.deb …
Unpacking samba (2:4.5.16+dfsg-1) …
Processing triggers for ufw (0.35-4) …
Processing triggers for libc-bin (2.24-11+deb9u4) …
Processing triggers for systemd (232-25+deb9u9) …
Processing triggers for man-db ( …
Setting up samba (2:4.5.16+dfsg-1) …
Samba is not being run as an AD Domain Controller, masking samba-ad-dc-service.
Please ignore the following error about deb-systemd-helper not finding samba-ad-dc-service.
Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service → /lib/systemd/system/nmbd.service.
Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory
Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service → /lib/systemd/system/smbd.service.
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.
● smbd.service - Samba SMB Daemon
Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2019-03-10 23:35:19 EDT; 11ms ago
Docs: man:smbd(8)
Process: 2855 ExecStart=/usr/sbin/smbd $SMBDOPTIONS (code=exited, status=1/FAILURE)
Main PID: 2855 (code=exited, status=1/FAILURE)

Mar 10 23:35:18 Tango systemd[1]: Starting Samba SMB Daemon…
Mar 10 23:35:19 Tango systemd[1]: smbd.service: Main process exited, code=exited, status=1/FAILURE
Mar 10 23:35:19 Tango systemd[1]: Failed to start Samba SMB Daemon.
Mar 10 23:35:19 Tango systemd[1]: smbd.service: Unit entered failed state.
Mar 10 23:35:19 Tango systemd[1]: smbd.service: Failed with result ‘exit-code’.
dpkg: error processing package samba (–configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.24-11+deb9u4) …
Processing triggers for systemd (232-25+deb9u9) …
Processing triggers for ufw (0.35-4) …
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)


Seams that problem is here

dpkg: error processing package samba (–configure):
subprocess installed post-installation script returned error exit status 1

So you can simple try to repair missing install or dependencies

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


Thank you for your answer.
I obviously tried to do that several times, and it didnt work.
I should have mentioned it in my original post.

I solved it by completely removing systemd which I found to my horror was installed in place of systemV.
Systemd made it onto this server without me noticing. It seems that when I installed a gnome application, it completely removed my sytemv init and replaced it with systemd and a boatload of problems.

This is serious!
I dont think that an application should be allowed to remove and replace your init system. That is fundamental to your booting and runlevels.

Systemd is in my opinion hell heated up in a microwave, probably one of the worst pieces of compromising software I encountered in my decades of using Linux and Unix.

My recent slew of curious problems all had its source with this unwarranted installation of SystemD.

A lot of people must have started with systemv and then have an application replace the entire init system to systemd.
Sysadmins should be very weary of this. Systemd is in my opinion dangerous and very damaging if it installs underhandedly like this.
The init system is to me the single most crucial software in linux security. If applications can just willy nilly remove systemV and replace it with SystemD, then compromise is trivially easy.

So, once I removed systemD, samba started working again.