Bug 85724 - [Systemd 217] System reboots on shutdown
Summary: [Systemd 217] System reboots on shutdown
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-01 02:02 UTC by Aliaksandr Stelmachonak
Modified: 2014-11-07 02:24 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
systemd 216 log (457.00 KB, text/plain)
2014-11-01 02:02 UTC, Aliaksandr Stelmachonak
Details
systemd 217 log (395.48 KB, text/plain)
2014-11-01 02:03 UTC, Aliaksandr Stelmachonak
Details

Description Aliaksandr Stelmachonak 2014-11-01 02:02:29 UTC
After upgrading to systemd 217, my laptop can't shutdown correctly. When running shutdown command (any, I tried "shitdown -h now", "poweroff", "systemctl poweroff"), my laptop rebooting instead of shuting down. Downgrading to systemd 216 helps.

Some details:

Distribution: Arch Linux x64
Hardware: System76 Galago Ultra Pro
Kernel: 3.17.2-1-ARCH

I am attaching two debug logs for systemd 216 and systemd 217. Please let me know, if additional logs or information requested.

I also create bug in the arch bug tracker: https://bugs.archlinux.org/task/42612
Comment 1 Aliaksandr Stelmachonak 2014-11-01 02:02:49 UTC
Created attachment 108748 [details]
systemd 216 log
Comment 2 Aliaksandr Stelmachonak 2014-11-01 02:03:04 UTC
Created attachment 108749 [details]
systemd 217 log
Comment 3 Zbigniew Jedrzejewski-Szmek 2014-11-01 20:15:00 UTC
Does 'systemctl poweroff -f' shutdown the machine?
Comment 4 Aliaksandr Stelmachonak 2014-11-01 20:51:33 UTC
No, machine is rebooting when I run 'systemctl poweroff -f'
Comment 5 Zbigniew Jedrzejewski-Szmek 2014-11-01 21:13:26 UTC
Then most likely this is a kernel problem. Where there any other changes in parallel to the systemd 216-217 change, especially of the kernel package?
Comment 6 Aliaksandr Stelmachonak 2014-11-01 21:31:52 UTC
I checked all dependencies and cases I can blame in the issue, including downgrading the kernel version, but nothing helps when systemd 217 installed (I tried with kernels 3.16.x and 3.17.x). 

It may be related to kernel, but I do not think this is only kernel problem because of the following behavior:

- when I boot with systemd 217 and then I downgrade it to 216 and do poweroff, then poweroff works normally;

- when I boot with systemd 216 and then upgrade systemd to 217 and do poweroff, poweroff doesn't work.

I can't explain this two facts by kernel problems, since I see poweroff behavior changed just by upgrading/downgrading systemd without reboot.
Comment 7 Zbigniew Jedrzejewski-Szmek 2014-11-01 21:52:51 UTC
OK, let's drill down then...

If you compile and run the following program, does it also reboot?

############# reboot-force.c ###########
#include <stdio.h>
#include <unistd.h>
#include <sys/reboot.h>

int main(void) {
        reboot(RB_POWER_OFF);
        perror("poweroff");
        return 1;
}

// gcc -Wall -o reboot-force reboot-force.c && sudo ./reboot-force
#########################################
Comment 8 Aliaksandr Stelmachonak 2014-11-01 22:23:25 UTC
Yes, it does: sudo ./reboot-force shuts down my laptop.
Comment 9 Aliaksandr Stelmachonak 2014-11-01 22:24:32 UTC
Sorry, I mean it does NOT reboot the PC, it DOES shut it down.
Comment 10 Colin Guthrie 2014-11-03 09:16:50 UTC
Downstream bug report in Mageia too for reference https://bugs.mageia.org/show_bug.cgi?id=14432
Comment 11 Colin Guthrie 2014-11-03 09:25:06 UTC
Uneducated guess, but perhaps it's due to the failure-action rework... perhaps some service is failing with a failure action of reboot or something similar.

e.g. something in or around 2928b0a863091f8f291fddb168988711afd389ef
Comment 12 Zbigniew Jedrzejewski-Szmek 2014-11-04 02:38:41 UTC
(In reply to Colin Guthrie from comment #11)
> Uneducated guess, but perhaps it's due to the failure-action rework...
> perhaps some service is failing with a failure action of reboot or something
> similar.
> 
> e.g. something in or around 2928b0a863091f8f291fddb168988711afd389ef
This would seem resonable, but... the shutdown commands have JobTimeoutAction=poweroff-force, so if anything, the machine should shut down hard. The result in comment #9 shows that poweroff works, so this is not a kernel issue.

I just tried, and a failing job with JobTimeoutAction=poweroff-force shuts down the machine.

@Alex, can you remove the JobTimeoutAction settings, by adding
/etc/systemd/system/basic.target.d/timeout.conf, /etc/systemd/system/poweroff.target.d/timeout.conf, /etc/systemd/system/reboot.target.d/timeout.conf, each containing:

[Unit]
JobTimeoutSec=0
JobTimeoutAction=none

and systemctl daemon-reload and shut down. Does this change anythign?
Comment 13 Aliaksandr Stelmachonak 2014-11-04 04:01:24 UTC
> Does this change anythign?

Unfortunately, no :( I still getting reboot on shutdown operation.
Comment 14 Aliaksandr Stelmachonak 2014-11-07 02:18:51 UTC
OK, looks like issue was finally identified and resolved: https://github.com/systemd/systemd/commit/4b5d8d0f22ae61ceb45a25391354ba53b43ee992
I applied the patch for the 217 version and shutdown works good now. Thanks everybody for participation and help!
Comment 15 Aliaksandr Stelmachonak 2014-11-07 02:24:02 UTC
But I still curios - why only limited number of people was affected by this issue? As per fix description it sounds like a problem, which affects all systems, having initrd. Or I am missing something here?


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.