[Pkg-systemd-maintainers] Bug#739887: Bug#739887: Bug#739887: systemd cannot stop samba (hangs forever)

Michael Biebl biebl at debian.org
Thu Feb 27 21:57:22 GMT 2014


Am 27.02.2014 22:35, schrieb Michael Stapelberg:
> Hi Adrian,
> 
> Adrian Knoth <adi at drcomp.erfurt.thur.de> writes:
>> Surprisingly, using
>>
>>    /etc/init.d/samba stop
>>
>> works:
> The unexpected difference in behavior stems from the fact that
> /etc/init.d/samba is missing the “. /lib/lsb/init-functions” line, hence
> the stop call is not redirected to systemd.
> 
> 
>> chopin:/home/adi# systemctl stop samba
>> [hangs, so let's switch to another  terminal]
>>
>> chopin:/home/adi# systemctl status samba
>> samba.service - LSB: ensure Samba daemons are started (nmbd and smbd)
>>    Loaded: loaded (/etc/init.d/samba)
>>    Active: deactivating (stop) since Sun 2014-02-23 15:19:53 CET; 37s ago
>>   Process: 19903 ExecStart=/etc/init.d/samba start (code=exited, status=0/SUCCESS)
>>   Control: 20064 (samba)
>>    CGroup: name=systemd:/system/samba.service
>>            └─control
>>              ├─20064 /bin/sh /etc/init.d/samba stop
>>              ├─20080 /bin/sh /etc/init.d/smbd stop
>>              └─20085 /bin/systemctl stop smbd.service
>>
>> Feb 23 15:18:21 chopin samba[19903]: Starting nmbd (via systemctl): nmbd.service.
>> Feb 23 15:18:21 chopin samba[19903]: Starting smbd (via systemctl): smbd.service.
>> Feb 23 15:18:21 chopin samba[19903]: Starting samba-ad-dc (via systemctl): samba-ad-dc.service.
>> Feb 23 15:18:21 chopin systemd[1]: Started LSB: ensure Samba daemons are started (nmbd and smbd).
>> Feb 23 15:19:53 chopin systemd[1]: Stopping LSB: ensure Samba daemons are started (nmbd and smbd)...
>> Feb 23 15:19:54 chopin samba[20064]: Stopping samba-ad-dc (via systemctl): samba-ad-dc.service.
> Can you also provide the output of “systemctl dump” and “systemctl
> list-jobs” in that situation please?
> 
> Also, which version of the samba package? And can you provide your
> configs? samba-ad-dc is not running at all for me with my configuration,
> and stopping samba (2:4.1.4+dfsg-3) works without any problems.

The samba sysv init script is an odd one. I'm copying the relevant parts
here:

### BEGIN INIT INFO
# Provides:          samba
# Required-Start:    smbd nmbd
# Required-Stop:     smbd nmbd
# Default-Start:
# Default-Stop:
# Short-Description: ensure Samba daemons are started (nmbd and smbd)
### END INIT INFO

set -e

# start nmbd, smbd and samba-ad-dc unconditionally
# the init scripts themselves check if they are needed or not
case $1 in
        start)
                /etc/init.d/nmbd start
                /etc/init.d/smbd start
                /etc/init.d/samba-ad-dc start
                ;;
        stop)
                /etc/init.d/samba-ad-dc stop
                /etc/init.d/smbd stop
                /etc/init.d/nmbd stop

So, the samba.service depends on smbd.service and nmbd.service (via its
LSB header) yet it stops those services manually. This leads to a dead lock.

If you remove "smbd nmbd" from  Required-Start:/Required-Stop: and
reload systemd, this should fix your issue.

So yeah, I think this is a bug in the samba LSB header.

The issue is, that insserv doesn't consider such dependencies in a
dynamic way.


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20140227/b2611436/attachment-0002.sig>


More information about the Pkg-systemd-maintainers mailing list