This is "just one more" case of the common old init scripts didn't consider there could be more (=containers).
Interesting is that the stop already runs with the --pidfile so the stop will not kill it. But the start will be blocked, as the existance of such a process will make --start be a no-op. Man page: Note: unless --pid or --pidfile are specified, start-stop-daemon behaves similar to killall(1). start-stop-daemon will scan the process table looking for any processes which match the process name, parent pid, uid, and/or gid (if specified). Any matching process will prevent --start from starting the daemon. All matching processes will be sent the TERM signal (or the one specified via --signal or --retry) if --stop is specified. For daemons which have long-lived children which need to live through a --stop, you must specify a pidfile. -S, --start [--] arguments Check for the existence of a specified process. If such a process exists, start-stop-daemon does nothing, and exits with error status 1 (0 if --oknodo is specified). If such a process does not exist, it starts an instance, using either the executable specified by --exec or, if specified, by --startas. Any arguments given after -- on the command line are passed unmodified to the program being started. The --oknodo will make it a silent non fatal exit int hat case - as it is fine to run "start" if it is running already. I'd recommend "--pidfile $SMBDPID" instead of the suggested path, but otherwise would agree to the fix. It should be safe as that is essentially how later versions (Bionic) do it (via MAINPID tracking in systemd). ** Changed in: samba (Ubuntu) Status: New => Confirmed ** Tags added: server-next ** Also affects: samba (Ubuntu Xenial) Importance: Undecided Status: New ** Changed in: samba (Ubuntu Xenial) Status: New => Triaged ** Changed in: samba (Ubuntu) Status: Confirmed => Fix Released -- You received this bug notification because you are a member of नेपाली भाषा समायोजकहरुको समूह, which is subscribed to Xenial. Matching subscriptions: Ubuntu 16.04 Bugs https://bugs.launchpad.net/bugs/1792400 Title: smbd failed in host when both lxd container and host have smbd Status in samba package in Ubuntu: Fix Released Status in samba source package in Xenial: Triaged Bug description: Setup: install smbd in host and lxd-container. Now restart smbd in host: service smbd restart All is OK. Problem: nmap shows "closed" on ports 139 and 445. And users cannot use smbd server in host. ● 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). 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. Workaround [1]: change /etc/init.d/smbd: if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D ; then to if ! start-stop-daemon --start --quiet --oknodo --pidfile /var/run/samba/smbd.pid --exec /usr/sbin/smbd -- -D ; then I reported this to: https://discuss.linuxcontainers.org/t/samba-in-host-and-container/2523 apt-cache policy samba samba: Installed: 2:4.3.11+dfsg-0ubuntu0.16.04.15 Candidate: 2:4.3.11+dfsg-0ubuntu0.16.04.16 Version table: 2:4.3.11+dfsg-0ubuntu0.16.04.16 500 500 http://de.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages *** 2:4.3.11+dfsg-0ubuntu0.16.04.15 500 500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages 100 /var/lib/dpkg/status 2:4.3.8+dfsg-0ubuntu1 500 500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages 1. https://serverfault.com/questions/810544/samba-daemon-does-not- work-as-systemd-service-but-works-in-foreground To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1792400/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~group.of.nepali.translators Post to : group.of.nepali.translators@lists.launchpad.net Unsubscribe : https://launchpad.net/~group.of.nepali.translators More help : https://help.launchpad.net/ListHelp