[Pkg-systemd-maintainers] Bug#739887: Bug#739887: Bug#739887: systemd cannot stop samba (hangs forever)
Adrian Knoth
adi at drcomp.erfurt.thur.de
Fri Feb 28 11:03:16 GMT 2014
> > Can you also provide the output of “systemctl dump” and “systemctl
> > list-jobs” in that situation please?
Before answering your questions, let me add that Michael Biebl's
suggestion fixes the problem.
And now to some 350+ lines of output. ;)
chopin:~# systemctl list-jobs
JOB UNIT TYPE STATE
2333 samba.service stop running
2335 smbd.service stop waiting
2 jobs listed.
chopin:~# systemctl dump (slightly edited)
-> Unit samba.service:
Description: LSB: ensure Samba daemons are started (nmbd and smbd)
Instance: n/a
Unit Load State: loaded
Unit Active State: deactivating
Inactive Exit Timestamp: Fri 2014-02-28 11:53:48 CET
Active Enter Timestamp: Fri 2014-02-28 11:53:49 CET
Active Exit Timestamp: Fri 2014-02-28 11:53:56 CET
Inactive Enter Timestamp: Fri 2014-02-28 11:53:15 CET
GC Check Good: yes
Need Daemon Reload: no
Name: samba.service
Source Path: /etc/init.d/samba
Condition Timestamp: Fri 2014-02-28 11:53:48 CET
Condition Result: yes
Requires: basic.target
WantedBy: multi-user.target
WantedBy: graphical.target
Conflicts: shutdown.target
Before: shutdown.target
Before: multi-user.target
Before: graphical.target
After: cups.service
After: smbd.service
After: nmbd.service
After: systemd-journald.socket
After: basic.target
References: smbd.service
References: nmbd.service
References: systemd-journald.socket
References: basic.target
References: shutdown.target
ReferencedBy: cups.service
ReferencedBy: multi-user.target
ReferencedBy: graphical.target
StopWhenUnneeded: no
RefuseManualStart: no
RefuseManualStop: no
DefaultDependencies: yes
OnFailureIsolate: no
IgnoreOnIsolate: no
IgnoreOnSnapshot: no
ControlGroup: cpu:/system/samba.service
ControlGroup: name=systemd:/system/samba.service
Service State: stop
Result: success
Reload Result: success
PermissionsStartOnly: no
RootDirectoryStartOnly: no
RemainAfterExit: yes
GuessMainPID: no
Type: forking
Restart: no
NotifyAccess: none
Control PID: 12480
KillMode: process
KillSignal: SIGTERM
SendSIGKILL: yes
UMask: 0022
WorkingDirectory: /
RootDirectory: /
NonBlocking: no
PrivateTmp: no
ControlGroupModify: no
ControlGroupPersistent: yes
PrivateNetwork: no
IgnoreSIGPIPE: no
LimitNOFILE: 4096
StandardInput: null
StandardOutput: journal
StandardError: inherit
SyslogFacility: daemon
SyslogLevel: info
-> ExecStart:
Command Line: /etc/init.d/samba start
PID: 12420
Start Timestamp: Fri 2014-02-28 11:53:48 CET
Exit Timestamp: Fri 2014-02-28 11:53:49 CET
Exit Code: exited
Exit Status: 0
-> ExecReload:
Command Line: /etc/init.d/samba reload
-> ExecStop:
Command Line: /etc/init.d/samba stop
PID: 12480
Start Timestamp: Fri 2014-02-28 11:53:56 CET
SysV Init Script has LSB Header: yes
SysVEnabled: yes
SysVStartPriority: 6
-> Job 2333:
Action: samba.service -> stop
State: running
Forced: yes
Irreversible: no
-> Unit smbd.service:
Description: LSB: start Samba SMB/CIFS daemon (smbd)
Instance: n/a
Unit Load State: loaded
Unit Active State: active
Inactive Exit Timestamp: Fri 2014-02-28 11:53:48 CET
Active Enter Timestamp: Fri 2014-02-28 11:53:49 CET
Active Exit Timestamp: Fri 2014-02-28 11:53:13 CET
Inactive Enter Timestamp: Fri 2014-02-28 11:53:14 CET
GC Check Good: yes
Need Daemon Reload: no
Name: smbd.service
Source Path: /etc/init.d/smbd
Condition Timestamp: Fri 2014-02-28 11:53:48 CET
Condition Result: yes
Requires: basic.target
WantedBy: multi-user.target
WantedBy: graphical.target
Conflicts: shutdown.target
Before: shutdown.target
Before: samba.service
Before: multi-user.target
Before: graphical.target
After: nmbd.service
After: network.target
After: local-fs.target
After: remote-fs.target
After: slapd.service
After: cups.service
After: systemd-journald.socket
After: basic.target
References: network.target
References: local-fs.target
References: remote-fs.target
References: slapd.service
References: cups.service
References: systemd-journald.socket
References: basic.target
References: shutdown.target
ReferencedBy: nmbd.service
ReferencedBy: samba.service
ReferencedBy: multi-user.target
ReferencedBy: graphical.target
StopWhenUnneeded: no
RefuseManualStart: no
RefuseManualStop: no
DefaultDependencies: yes
OnFailureIsolate: no
IgnoreOnIsolate: no
IgnoreOnSnapshot: no
ControlGroup: cpu:/system/smbd.service
ControlGroup: name=systemd:/system/smbd.service
Service State: running
Result: success
Reload Result: success
PermissionsStartOnly: no
RootDirectoryStartOnly: no
RemainAfterExit: yes
GuessMainPID: no
Type: forking
Restart: no
NotifyAccess: none
KillMode: process
KillSignal: SIGTERM
SendSIGKILL: yes
UMask: 0022
WorkingDirectory: /
RootDirectory: /
NonBlocking: no
PrivateTmp: no
ControlGroupModify: no
ControlGroupPersistent: yes
PrivateNetwork: no
IgnoreSIGPIPE: no
LimitNOFILE: 4096
StandardInput: null
StandardOutput: journal
StandardError: inherit
SyslogFacility: daemon
SyslogLevel: info
-> ExecStart:
Command Line: /etc/init.d/smbd start
PID: 12445
Start Timestamp: Fri 2014-02-28 11:53:48 CET
Exit Timestamp: Fri 2014-02-28 11:53:49 CET
Exit Code: exited
Exit Status: 0
-> ExecReload:
Command Line: /etc/init.d/smbd reload
-> ExecStop:
Command Line: /etc/init.d/smbd stop
SysV Init Script has LSB Header: yes
SysVEnabled: yes
SysVStartPriority: 5
SysVRunLevels: 2345
-> Job 2335:
Action: smbd.service -> stop
State: waiting
Forced: yes
Irreversible: no
-> Unit nmbd.service:
Description: LSB: start Samba NetBIOS nameserver (nmbd)
Instance: n/a
Unit Load State: loaded
Unit Active State: active
Inactive Exit Timestamp: Fri 2014-02-28 11:53:48 CET
Active Enter Timestamp: Fri 2014-02-28 11:53:48 CET
Active Exit Timestamp: Fri 2014-02-28 11:53:14 CET
Inactive Enter Timestamp: Fri 2014-02-28 11:53:15 CET
GC Check Good: yes
Need Daemon Reload: no
Name: nmbd.service
Source Path: /etc/init.d/nmbd
Condition Timestamp: Fri 2014-02-28 11:53:48 CET
Condition Result: yes
Requires: basic.target
WantedBy: multi-user.target
WantedBy: graphical.target
Conflicts: shutdown.target
Before: smbd.service
Before: shutdown.target
Before: samba.service
Before: multi-user.target
Before: graphical.target
After: network.target
After: local-fs.target
After: remote-fs.target
After: systemd-journald.socket
After: basic.target
References: network.target
References: local-fs.target
References: remote-fs.target
References: smbd.service
References: systemd-journald.socket
References: basic.target
References: shutdown.target
ReferencedBy: samba.service
ReferencedBy: multi-user.target
ReferencedBy: graphical.target
StopWhenUnneeded: no
RefuseManualStart: no
RefuseManualStop: no
DefaultDependencies: yes
OnFailureIsolate: no
IgnoreOnIsolate: no
IgnoreOnSnapshot: no
ControlGroup: cpu:/system/nmbd.service
ControlGroup: name=systemd:/system/nmbd.service
Service State: running
Result: success
Reload Result: success
PermissionsStartOnly: no
RootDirectoryStartOnly: no
RemainAfterExit: yes
GuessMainPID: no
Type: forking
Restart: no
NotifyAccess: none
KillMode: process
KillSignal: SIGTERM
SendSIGKILL: yes
UMask: 0022
WorkingDirectory: /
RootDirectory: /
NonBlocking: no
PrivateTmp: no
ControlGroupModify: no
ControlGroupPersistent: yes
PrivateNetwork: no
IgnoreSIGPIPE: no
LimitNOFILE: 4096
StandardInput: null
StandardOutput: journal
StandardError: inherit
SyslogFacility: daemon
SyslogLevel: info
-> ExecStart:
Command Line: /etc/init.d/nmbd start
PID: 12427
Start Timestamp: Fri 2014-02-28 11:53:48 CET
Exit Timestamp: Fri 2014-02-28 11:53:48 CET
Exit Code: exited
Exit Status: 0
-> ExecStop:
Command Line: /etc/init.d/nmbd stop
SysV Init Script has LSB Header: yes
SysVEnabled: yes
SysVStartPriority: 1
SysVRunLevels: 2345
-> Unit samba-ad-dc.service:
Description: LSB: start Samba daemons for the AD DC
Instance: n/a
Unit Load State: loaded
Unit Active State: inactive
Inactive Exit Timestamp: Fri 2014-02-28 11:53:49 CET
Active Enter Timestamp: Fri 2014-02-28 11:53:49 CET
Active Exit Timestamp: Fri 2014-02-28 11:53:56 CET
Inactive Enter Timestamp: Fri 2014-02-28 11:53:57 CET
GC Check Good: yes
Need Daemon Reload: no
Name: samba-ad-dc.service
Source Path: /etc/init.d/samba-ad-dc
Condition Timestamp: Fri 2014-02-28 11:53:49 CET
Condition Result: yes
Requires: basic.target
WantedBy: multi-user.target
WantedBy: graphical.target
Conflicts: shutdown.target
Before: shutdown.target
Before: multi-user.target
Before: graphical.target
After: network.target
After: local-fs.target
After: remote-fs.target
After: systemd-journald.socket
After: basic.target
References: network.target
References: local-fs.target
References: remote-fs.target
References: systemd-journald.socket
References: basic.target
References: shutdown.target
ReferencedBy: multi-user.target
ReferencedBy: graphical.target
StopWhenUnneeded: no
RefuseManualStart: no
RefuseManualStop: no
DefaultDependencies: yes
OnFailureIsolate: no
IgnoreOnIsolate: no
IgnoreOnSnapshot: no
ControlGroup: cpu:/system/samba-ad-dc.service
ControlGroup: name=systemd:/system/samba-ad-dc.service
Service State: dead
Result: success
Reload Result: success
PermissionsStartOnly: no
RootDirectoryStartOnly: no
RemainAfterExit: yes
GuessMainPID: no
Type: forking
Restart: no
NotifyAccess: none
KillMode: process
KillSignal: SIGTERM
SendSIGKILL: yes
UMask: 0022
WorkingDirectory: /
RootDirectory: /
NonBlocking: no
PrivateTmp: no
ControlGroupModify: no
ControlGroupPersistent: yes
PrivateNetwork: no
IgnoreSIGPIPE: no
LimitNOFILE: 4096
StandardInput: null
StandardOutput: journal
StandardError: inherit
SyslogFacility: daemon
SyslogLevel: info
-> ExecStart:
Command Line: /etc/init.d/samba-ad-dc start
PID: 12463
Start Timestamp: Fri 2014-02-28 11:53:49 CET
Exit Timestamp: Fri 2014-02-28 11:53:49 CET
Exit Code: exited
Exit Status: 0
-> ExecStop:
Command Line: /etc/init.d/samba-ad-dc stop
PID: 12487
Start Timestamp: Fri 2014-02-28 11:53:56 CET
Exit Timestamp: Fri 2014-02-28 11:53:57 CET
Exit Code: exited
Exit Status: 0
SysV Init Script has LSB Header: yes
SysVEnabled: yes
SysVStartPriority: 1
SysVRunLevels: 2345
> 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.
Exactly.
> If you remove "smbd nmbd" from Required-Start:/Required-Stop: and
> reload systemd, this should fix your issue.
It does. So we reassign the bug to the samba package and wait for an
updated init.d script?
Sooner or later, proper service/socket files might be useful, too.
Conveniently, Arch (and others) offers templates. ;)
<https://projects.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/samba>
Cheers
--
mail: adi at thur.de http://adi.thur.de PGP/GPG: key via keyserver
More information about the Pkg-systemd-maintainers
mailing list