Samba daemon does not work as systemd service, but works in foreground

by Michael Kremser   Last Updated July 17, 2017 10:00 AM

I am running a fresh install of Ubuntu Server 16.04.1 and having troubles with smbd. service smbd status tells me that smbd should be running:

   ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
   Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
   Active: active (exited) since Die 2016-10-18 17:35:23 CEST; 2s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 24218 ExecStop=/etc/init.d/smbd stop (code=exited, status=0/SUCCESS)
  Process: 21980 ExecReload=/etc/init.d/smbd reload (code=exited, status=0/SUCCESS)
  Process: 25190 ExecStart=/etc/init.d/smbd start (code=exited, status=0/SUCCESS)

Okt 18 17:35:22 speedy systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
Okt 18 17:35:23 speedy smbd[25190]:  * Starting SMB/CIFS daemon smbd
Okt 18 17:35:23 speedy smbd[25190]:    ...done.
Okt 18 17:35:23 speedy systemd[1]: Started LSB: start Samba SMB/CIFS daemon (smbd).

and this can be verified by ps axf | grep smbd:

25356 pts/2    S+     0:00  |   \_ grep --color=auto smbd
19915 ?        Ss     0:08      \_ /usr/sbin/smbd -D
19919 ?        S      0:00          \_ /usr/sbin/smbd -D

However, netstat -tpln | grep "smbd" returns nothing and also nmap shows "closed" on ports 139 and 445.

What I tried so far is activating these options in /etc/samba/smb.conf, but it doesn't help:

interfaces = enp2s0 bind interfaces only = true

If I start Samba in foreground using /usr/sbin/smbd -F, it works. I can then connect from another machine to the server and exchange files.

I have no clue that there might be wrong or how I could track down the problem.

Best regards,


Answers 1

Got the same issue, in my case the problem was that another issue of smbd was running in a docker container, which was detected by start-stop-daemon, so it wouldn't start the service. In this case, I've changed this line in the file /etc/init.d/smbd:

 if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D ; then


 if ! start-stop-daemon --start --quiet --oknodo --pidfile /var/run/samba/ --exec /usr/sbin/smbd -- -D ; then

This way it starts smbd if it's pid file does not exist.

Szász Eduárd István
Szász Eduárd István
July 17, 2017 09:01 AM

Related Questions

Ubuntu 16.04 Systemd not possible to use systemctl

Updated November 13, 2016 08:00 AM

varnish daemon not listening on configured port

Updated January 05, 2017 08:00 AM

Samba/CIFS Ubuntu 14.04 mount error(112)

Updated May 21, 2016 08:00 AM

Unit polkitd.service is masked

Updated December 17, 2015 10:00 AM