Bug 54041

Summary: Hangs at PowerOff
Product: systemd Reporter: Bastien Dejean <nihilhill>
Component: generalAssignee: systemd-bugs
Status: RESOLVED INVALID QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: freedesktop, j.witteveen
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Output of `systemctl dump`
Output of `dmesg`

Description Bastien Dejean 2012-08-25 08:01:37 UTC
Created attachment 66092 [details]
Output of `systemctl dump`

My system has a high probability of hanging at PowerOff.

I have enabled the debug shell, and the output of `systemctl list-jobs` always indicates, in case of hanging, that the currently running service is: netcfg.service.

Kernel parameters: rootfstype=ext4 ro quiet reboot=pci hpet=disable rootdelay=9.
Comment 1 Bastien Dejean 2012-08-25 08:02:39 UTC
Created attachment 66093 [details]
Output of `dmesg`
Comment 2 j.witteveen 2012-08-29 00:11:33 UTC
I observe similar behavior, but need help finding the root cause.

netcfg.service contains:
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/netcfg-daemon start
ExecStop=/usr/bin/netcfg-daemon stop

The only interesting part in the daemon script regarding stopping boils down to:
tac "$STATE_FILE" | (
  while read profile; do
    /usr/bin/netcfg down "$profile" &
  done
  wait
)

This part is specifically for backgrounded profiles. I would like to know if the problem is related to backgrounded profiles.

If a systemd expert spots a problem in this setup, I would like to know too.
Comment 3 Bastien Dejean 2012-08-31 14:06:46 UTC
I've tried with the Git version of netcfg with the default '/etc/conf.d/netcfg': after forty seconds of hanging the poweroff state is finally reached.

The output of `systemctl status netcfg.service` contains a line going like 'waiting for pid X' but `ps -A` doesn't show any pid numbered 'X'.
Comment 4 Lennart Poettering 2012-09-13 17:49:20 UTC
Is it possible that the netcfg tool invokes some other system service? Then you might run into a deadlock, where the service is blocked because it tries to start another service that is ordered after itself, but which will never run as long as it is blocking for it. After a while the timeout takes action and terminates the process forcibly.

This appears like a netcfg problem, not so much a systemd problem...
Comment 5 Bastien Dejean 2012-09-14 10:07:19 UTC
And there's no traces of what might be happening in the logs I've attached?
Comment 6 j.witteveen 2012-09-15 21:05:35 UTC
Some have reported that the hanging disappears when adding

  KillMode=none

to the service file. This suggests that systemd tries to wait for some forked process, even though we have

  Type=oneshot
Comment 7 Bastien Dejean 2012-09-17 08:16:23 UTC
I confirm. Thanks.
Comment 8 Lennart Poettering 2013-01-15 01:22:16 UTC
What about KillMode=process? Does that fix the issue.

Most likely netfcfg is just confused if all its processes are terminated with SIGTERM.
Comment 9 Lennart Poettering 2014-06-25 09:40:25 UTC
Closing due to lack of response

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.