Bug 470752

Summary: ACPID is claiming power button even when gnome-power-manager is running
Product: [Fedora] Fedora Reporter: Martin Ebourne <fedora>
Component: acpidAssignee: Zdenek Prikryl <zprikryl>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: martin, zprikryl
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-11-12 06:33:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Ebourne 2008-11-10 00:35:51 UTC
Description of problem:
If I press the laptop power button to suspend to RAM (as configured in g-p-m and as was working for F9) the machine shuts down.

Version-Release number of selected component (if applicable):
acpid-1.0.6-8.fc10.x86_64
ConsoleKit-0.3.0-2.fc10.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Press power button

Actual results:
Machine shuts down

Expected results:
Action configured as per g-p-m should occur.

Additional info:
Looks like ConsoleKit has changed the output of ck-list-sessions:

# ck-list-sessions
Session2:
        unix-user = '500'
        realname = 'Martin Ebourne'
        seat = 'Seat1'
....

UID is 'unix-user' whereas /etc/acpi/actions/power.sh is looking for 'uid':

ck-list-sessions | \
awk '
/^Session[0-9]+:$/ { uid = active = x11 = "" ; next }
{ gsub(/'\''/, "", $3) }
$1 == "uid" { uid = $3 }

Changing this to:

$1 == "unix-user" { uid = $3 }

fixes the problem. Could be more fancy and check for either I guess.

Comment 1 MartinG 2008-11-11 10:41:15 UTC
I can confirm that /etc/acpi/actions/power.sh does not correctly detect a running kpowersave (the g-p-m for KDE4). My power.sh script does detect the correct uid, but it fails to match the output of ps, as "ps axo uid,cmd" outputs "/usr/bin/kpowersave" and not "kpowersave". Maybe this also goes for gnome-power-manager?

On this box I'm running Fedora 9, 2.6.26.6-79.fc9.x86_64., pm-utils-1.1.0-7.fc9.x86_64.

In /etc/acpi/actions/power.sh, if I change "kpowersave" to "/usr/bin/kpowersave", I get the wanted behaviour.

The man page of "ps" states that "cmd" means the "simple name of executable", which I guess means the full path including the name, but not the option list.

Comment 2 Martin Ebourne 2008-11-11 11:00:58 UTC
MartinG, that is clearly a different but very much related bug.

My issue is due to a change in Fedora 10 that breaks the UID check. It was working on F9 and it works on F10 once I fix the check. I am using gnome though.

Looks like in the KDE case it's already broken on F9. Not currently at my machine so can't check to see if there's any change in that for F10.

Is anyone looking at this bug? Can we get this fixed before F10 final? From my experience having the power button shut the machine down when the user only expected it to suspend to RAM is very unpleasant.

Comment 3 Zdenek Prikryl 2008-11-11 13:27:59 UTC
(In reply to comment #0)
> fixes the problem. Could be more fancy and check for either I guess.

I think check for "unix-user" is sufficient. 

(In reply to comment #1)
> In /etc/acpi/actions/power.sh, if I change "kpowersave" to
> "/usr/bin/kpowersave", I get the wanted behaviour.

I'll fix the script in other way, instead "==" I'll use "~". This solution catches either kpowersave or /usr/bin/kpowersave.

Also I'll try to get this update to the F-10 final.

Comment 4 MartinG 2008-11-11 13:47:01 UTC
Great - thanks :)