Bug 1276424

Summary: Shutdown with a TIME parameter fails, and immediately shuts down the system.
Product: [Fedora] Fedora Reporter: Vinicius Reis <angiolucci>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: alex.ploumistos, johannbg, jsynacek, lnykryn, msekleta, s, systemd-maint, zbyszek
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: https://github.com/systemd/systemd/issues/1120
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-155.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-02 11:56:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vinicius Reis 2015-10-29 16:08:41 UTC
Description of problem:
Shutdow with a TIME parameter fails, and immediately shuts down the system.

Version-Release number of selected component (if applicable):
NAME=Fedora
VERSION="23 (Workstation Edition)"


How reproducible:
Always, no specific condition required.

Steps to Reproduce:
1. Open gnome-terminal
2. type 'sudo shutdown -h 1:30' (or any future timestamp)
3. shutdown prints an error message and imediately shuts down the system, not respecting the given TIME argument.


Actual results:
Shuts down computeri mmediately, closing applications in use, ignoring the TIME argument.

Expected results:
Shuts down computer at TIME o'clock.

Additional info:
(1) I've typed "sudo shutdown -h 1:30 2> shutdown_output.txt" to recover the error message after a system halt,  and it says:
"Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Access denied"

(2) Systemd version:
$ rpm -qa systemd
systemd-222-8.fc23.x86_64

(3) It was working fine on Fedora 22, 21, 20.

Comment 1 Vinicius Reis 2015-11-06 05:47:24 UTC
Well, I'm not sure if systemd is causing this issue alone. Because of new SELinux policies, I needed to set it to permissive mode. Doing so, shutdown with a TIME parameter now works (it stop working if I set SELinux again to enforcing).

Now I'm really confuse about what is really causing shutdown to fail.
Please, see more at https://bugzilla.redhat.com/show_bug.cgi?id=1277987

Comment 2 Alexander Ploumistos 2015-11-08 04:02:34 UTC
I've always run shutdown as root and I've kept SELinux in enforcing mode. After upgrading to F23 and trying to schedule a shutdown, I got no SELinux alerts in my logs, but the system does shut down immediately.

Comment 3 Alexander Ploumistos 2015-11-08 04:16:20 UTC
I was wrong, it was right there in the logs, but I missed it the first time:

Nov 08 05:54:10 <hostname> audit[965]: AVC avc:  denied  { create } for  pid=965 comm="systemd-logind" name=".#scheduledCcLX9o" scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:object_r:init_var_run_t:s0 tclass=file permissive=0
Nov 08 05:54:10 <hostname> systemd-logind[965]: Failed to save information about scheduled shutdowns: Permission denied
Nov 08 05:54:10 <hostname> audit[965]: SYSCALL arch=c000003e syscall=2 success=no exit=-13 a0=55ee8983b1f0 a1=800c2 a2=180 a3=0 items=0 ppid=1 pid=965 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="systemd-logind" exe="/usr/lib/systemd/systemd-logind" subj=system_u:system_r:systemd_logind_t:s0 key=(null)
Nov 08 05:54:10 <hostname> audit: PROCTITLE proctitle="/usr/lib/systemd/systemd-logind"
Nov 08 05:54:10 <hostname> dbus[990]: [system] Activating service name='org.fedoraproject.Setroubleshootd' (using servicehelper)
Nov 08 05:54:10 <hostname> polkitd[1141]: Registered Authentication Agent for unix-process:5454:26150 (system bus name :1.105 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.utf8)
Nov 08 05:54:10 <hostname> systemd[1]: Stopping Daemon for power management...
Nov 08 05:54:10 <hostname> systemd[1]: Stopped target Graphical Interface.
Nov 08 05:54:10 <hostname> systemd[1]: Stopping Graphical Interface.

Comment 4 Jan Synacek 2015-12-02 09:49:58 UTC
I can't reproduce this issue with the latest updates. Could you please verify?

$ rpm -q systemd selinux-policy
systemd-222-8.fc23.x86_64
selinux-policy-3.13.1-155.fc23.noarch

Comment 5 Vinicius Reis 2015-12-02 10:51:08 UTC
Hello.

It seems to be fixed now.
I can't reproduce this issue anymore.

$ rpm -q systemd selinux-policy
systemd-222-8.fc23.x86_64
selinux-policy-3.13.1-155.fc23.noarch

Thanks!

Comment 6 Jan Synacek 2015-12-02 11:56:01 UTC
See bug #1287592 for the related part.