Hi, I'm using fedora 17 and KDE 4.8.3 I've set the kde power manager to sleep on power button press. However, pressing the button always results in shutdown. I see in /etc/acpi/actions/power.sh the use of ck-list-sessions to figure out the user id. Entering that command manually, both as the user running kde or root, do not output anything and always returns 0. Modifying this file to directly exit prevents the shutdown, but the machine do not get to sleep.
I have a similar problem since upgrade from F16 to F17. In an effort to fix, I changed the KDE power manager to pop up the "prompt logout dialog" instead of going to sleep. Now when I press the power button, the logout dialog appears for a fraction of a second before the system proceeds with shutdown. For me, the ck-list-sessions command does produce output. However, the output produced contains the line "active = FALSE", which causes /etc/acpi/actions/power.sh to disregard me. In case it is relevant, after upgrade I experienced many error messages followed by kernel panic when I press the shutdown button. Eventually I found this to be caused by a F16 kernel that was lingering after upgrade. Removing the F16 kernel fixed those errors, but still the error described in this report remains.
A workaround is to comment out everything in /etc/acpi/actions/power.sh. The side effect, as far as I can guess, is that the power button would not do anything when there is nobody logged into an X session.
Created attachment 594608 [details] systemd enabled power.sh I rewrote the consolekit based script to use systemd commands instead. Question: should we leave the original consolekit enabled version into that script too in case someone is not using systemd but running consolekit? - or does Fedora 17 even support running without systemd sessions?
See also #819559, which claims to fix this. It fails for me, partly because it looks for "Active: yes" in the output of "systemd-loginctl session-status", but the version in systemd-44-17.fc17.i686 outputs "State: active" instead.
(In reply to comment #4) > See also #819559, which claims to fix this. It fails for me, partly because > it looks for "Active: yes" in the output of "systemd-loginctl > session-status", but the version in systemd-44-17.fc17.i686 outputs "State: > active" instead. It seems the output of systemd-loginctl changed, thanks for info.
acpid-2.0.16-4.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/acpid-2.0.16-4.fc17
Package acpid-2.0.16-4.fc17: * should fix your issue, * was pushed to the Fedora 17 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing acpid-2.0.16-4.fc17' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2012-10439/acpid-2.0.16-4.fc17 then log in and leave karma (feedback).
I've had the same issue. After update to 2.0.16-4 it's almost OK. The only problem I've noticed is when I run amarok. Pressing the power button results in amarok shutdown and dialog which reads "Shutting down" and the whole enviroment acts strangely until I press Ctrl+Alt+Backspace and login again. I use Gnome 3.
(In reply to comment #8) > I've had the same issue. After update to 2.0.16-4 it's almost OK. The only > problem I've noticed is when I run amarok. Pressing the power button results > in amarok shutdown and dialog which reads "Shutting down" and the whole > enviroment acts strangely until I press Ctrl+Alt+Backspace and login again. > I use Gnome 3. This one doesn't seem to be an acpid issue, because I can reproduce this even after: # yum remove acpid Probably the KDE stub acts strangely after catching the shutdown event, that should be handled by gnome-settings-daemon (correctly handed over by acpid). Probably amarok or kdelibs issue.
acpid-2.0.16-4.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.
*** Bug 848424 has been marked as a duplicate of this bug. ***
(In reply to comment #10) > acpid-2.0.16-4.fc17 has been pushed to the Fedora 17 stable repository. If > problems still persist, please make note of it in this bug report. The problem still persists. I upgraded acpid to version 2.0.16-4.fc17 but after pressing Power button of my keyboard, my PC shuts down immediately and the shutdown confirmation dialog of my Kde desktop (version 4.8.3) never appears. Renaming the file /etc/acpi/actions/power.sh solves this issue. I don't know weather the command ck-list-sessions written in the file /etc/acpid/actions/power.sh works, in the terminal it outputs nothing.
(In reply to comment #12) > I don't know weather the command ck-list-sessions written in the file > /etc/acpid/actions/power.sh works, in the terminal it outputs nothing. Right, but there is 'systemd-loginctl list-sessions' that should take preference. Please check: # yum list installed '*acpid*' # rpm -qV acpid The code snippet from power.sh that should handle it is pretty simple: session_ids=$(systemd-loginctl list-sessions 2>/dev/null | awk '{print $1}') for session in ${session_ids} ; do session_status=$(systemd-loginctl session-status ${session}) echo "${session_status}" | grep -e '\(Active: yes\|State: active\)' &> /dev/null && echo "${session_status}" | grep -e '\(gnome-settings-daemon\|kded4\|xfce4-power-manager\)' &> /dev/null && exit 0 done ... shutdown -h now I.e. if "kded4" is detected in you session the shutdown is not executed by acpid, otherwise the "shutdown -h now" is run. Currently I have no idea why it is not working for you, I was unable to reproduce on my systems.
I removed the acpid package and the shutdown confirmation dialog appears. I upgraded the systemd package and that issue is still present. About the power.sh script: I execute in the terminal the command systemd-loginctl list-sessions 2>/dev/null | awk '{print $1}' and the output is 1 ; I execute in the terminal the command systemd-loginctl session-status 1 | grep -e '\(Active: yes\|State: active\)' and the output is Active: yes └ 1823 grep --color=auto -e \(Active: yes\|State: active\... I execute in the terminal the command systemd-loginctl session-status 1 | grep -e '\(gnome-settings-daemon\|kded4\|xfce4-power-manager\)' and the output is ├ 802 kded4 └ 1825 grep --color=auto -e \(gnome-settings-daemon\|kded... This piece of the power.sh script seems OK.
(In reply to comment #14) Hmm, shouldn't be a selinux issue? Try with "setenforce 0".
(In reply to comment #15) > (In reply to comment #14) > Hmm, shouldn't be a selinux issue? > > Try with "setenforce 0". Now the script works.
Please try to update your selinux-policy to latest version, than: touch /.autorelabel reboot It should work then.
I still experienced a shutdown last week. I had opened the laptop lid and pressed the power button (thinking "on"). Probably opening the lid did a wakeup, and pressing the button triggered power.sh before KDE had started up. Is there any reason to ever do a shutdown on button press? It seems to me that if there is no power manager running, it would be safer to ignore the button press. Shutting down without confirmation isn't a safe choice for a default action. For now, I have emptied the contents of power.sh and things work fine.
(In reply to comment #17) > Please try to update your selinux-policy to latest version, than: > touch /.autorelabel > reboot > > It should work then. Well, upgraded selinux-policy and selinux-policy-targeted and selinux-policy-devel. Now that issue seems solved.
To all with had the same issue than me : With the updated script, the shutdown command was correctly discarded but no action was taken by my DM. In kde, I had to ensure the global shortcut (Kde Daemon module) for the 'PowerOff' action was correctly set to the default 'Power off' key. Only after that I was able to set the custom actions in the power management settings for that button.