This problem with samba shutting down seems to have happened since the upgrade from systemd 208 to 215. I believe the samba init script(s) have been been in place for awhile now (at least 9/22/2013 according to this changelog entry "Merge contents of samba-ad-dc into samba.") and there wasn't a problem shutting smbd/nmbd/samba-ad-dc before.
Adding to the confusion is a different test machine I have, same level of systemd (215-5+b1) and samba (2:4.1.11+dfsg-1) which shuts down samba (samba-ad-dc/smbd/nmbd) via systemctl in about 3 seconds. It was not necessary to mask samba-ad-dc on that machine. On the production machine, running lsof against /etc/init.d/nmbd stop shows it reading the magic redirection scriptlet of /lib/lsb/init-functions.d/40-systemd, which spawns another systemctl command (systemctl stop nmbd.service), and there it seems each process has a the same Unix socket open (node 305782): systemctl status samba ● samba.service - LSB: ensure Samba daemons are started (nmbd and smbd) Loaded: loaded (/etc/init.d/samba) Active: deactivating (stop) since Sat 2014-10-11 11:06:21 EDT; 42s ago Process: 28336 ExecStart=/etc/init.d/samba start (code=exited, status=0/SUCCESS) Control: 31288 (samba) CGroup: /system.slice/samba.service └─control ├─31288 /bin/sh /etc/init.d/samba stop ├─31306 /bin/sh /etc/init.d/nmbd stop └─31311 /bin/systemctl stop nmbd.service Oct 11 09:56:27 asusb202 samba[28336]: Starting nmbd (via systemctl): nmbd.service. Oct 11 09:56:28 asusb202 samba[28336]: Starting smbd (via systemctl): smbd.service. Oct 11 09:56:28 asusb202 systemd[1]: Started LSB: ensure Samba daemons are started (nmbd and smbd). Oct 11 11:06:21 asusb202 systemd[1]: Stopping LSB: ensure Samba daemons are started (nmbd and smbd)... Oct 11 11:06:22 asusb202 samba[31288]: Stopping smbd (via systemctl): smbd.service. [11:07:04]root@asusb202:/var/log/samba# lsof -p 31306 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nmbd 31306 root cwd DIR 8,1 4096 2 / nmbd 31306 root rtd DIR 8,1 4096 2 / nmbd 31306 root txt REG 8,1 112204 8255 /bin/dash nmbd 31306 root mem REG 8,1 1745808 24697 /lib/i386-linux-gnu/i686/cmov/libc-2.19.so nmbd 31306 root mem REG 8,1 135596 24693 /lib/i386-linux-gnu/ld-2.19.so nmbd 31306 root 0r CHR 1,3 0t0 1045 /dev/null nmbd 31306 root 1u unix 0xecea9d00 0t0 385702 socket nmbd 31306 root 2u unix 0xecea9d00 0t0 385702 socket nmbd 31306 root 10r REG 8,1 1948 100476 /etc/init.d/nmbd nmbd 31306 root 11r REG 8,1 11506 16307 /lib/lsb/init-functions nmbd 31306 root 12r REG 8,1 2424 24546 /lib/lsb/init-functions.d/40-systemd lsof -p 31311 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME systemctl 31311 root cwd DIR 8,1 4096 2 / systemctl 31311 root rtd DIR 8,1 4096 2 / systemctl 31311 root txt REG 8,1 583220 8158 /bin/systemctl systemctl 31311 root mem REG 8,1 1607712 302019 /usr/lib/locale/locale-archive systemctl 31311 root mem REG 8,1 76848 24510 /lib/i386-linux-gnu/libgpg-error.so.0.12.2 systemctl 31311 root mem REG 8,1 15592 24756 /lib/i386-linux-gnu/i686/cmov/libdl-2.19.so systemctl 31311 root mem REG 8,1 456424 24762 /lib/i386-linux-gnu/libpcre.so.3.13.1 systemctl 31311 root mem REG 8,1 720496 25283 /lib/i386-linux-gnu/libgcrypt.so.20.0.2 systemctl 31311 root mem REG 8,1 154784 24853 /lib/i386-linux-gnu/liblzma.so.5.0.0 systemctl 31311 root mem REG 8,1 155360 24782 /lib/i386-linux-gnu/libselinux.so.1 systemctl 31311 root mem REG 8,1 1745808 24697 /lib/i386-linux-gnu/i686/cmov/libc-2.19.so systemctl 31311 root mem REG 8,1 132541 24712 /lib/i386-linux-gnu/i686/cmov/libpthread-2.19.so systemctl 31311 root mem REG 8,1 135596 24693 /lib/i386-linux-gnu/ld-2.19.so systemctl 31311 root 0r CHR 1,3 0t0 1045 /dev/null systemctl 31311 root 1u unix 0xecea9d00 0t0 385702 socket systemctl 31311 root 2u unix 0xecea9d00 0t0 385702 socket systemctl 31311 root 3u unix 0xf44b3a80 0t0 385734 @001db The /etc/init.d/nmbd stop script is indeed waiting: strace -p 31306 Process 31306 attached wait4(-1, The internally issued systemctl stop nmbd.service command is polling (?) strace -p 31311 Process 31311 attached ppoll([{fd=3, events=POLLIN}], 1, NULL, NULL, 8 -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org