immediate shutdown after pressing shutdown button

Bug #268734 reported by Marcel Schaal
114
This bug affects 13 people
Affects Status Importance Assigned to Milestone
acpi-support (Debian)
Fix Released
Unknown
acpid (Fedora)
Fix Released
Low
acpid (Ubuntu)
Fix Released
Undecided
Unassigned
Nominated for Jaunty by Marcel Schaal

Bug Description

1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu.
Description: Ubuntu intrepid (development branch)
Release: 8.10
(kubuntu alpha5 with latest updates)

2) The version of the package you are using, via 'apt-cache policy packagename' or by checking in Synaptic.
no specific package

3) What you expected to happen
pressing the shutdown button should start a dialog where the user can choose whether to shutdown or not. when working on the tty1 the button should be hit twice or something like that

4) What happened instead
the system began shutdown without user confirmation immediate

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

If you're in the GUI though you get the logoff dialog don't you? So this only affects you if you're in a tty when you hit the power button?

Revision history for this message
Marcel Schaal (marcelschaal) wrote :

no there's no dialog when using kde 4.1. the system just shutdowns without logging off from kde or saving any work left open.

Revision history for this message
Adam Niedling (krychek) wrote :

Is this still in issue in updated Intrepid?

Revision history for this message
Marcel Schaal (marcelschaal) wrote :

Yes, hitting the power-button initializes a shutdown without notification.

Revision history for this message
Adam Niedling (krychek) wrote :

I'm not sure this is a bug. The shutdown funcionality has changed since Hardy. There is no more shutdown applet on the top right corner. System -> shutdown just shuts down the system. The user switching applet has option to sign out, reboot, shutdown etc. So there is no need to ask you what you want to do.

Revision history for this message
Marcel Schaal (marcelschaal) wrote :

Losing your work because you or somebody else accidentally clicked on the power button is a bug in my opinion. Windows for example notifies all running applications about the shutdown so they are able to ask you whether you want to save your work or not. All applications are be killed by initd.
If other users are using the system they will also loose their work.
Using the shutdown system of kde it asks me whether i really want to shutdown or not if another user is logged in. I don't know the behavior of ubuntu. Maybe the acpi event of hitting the power button should be forwarded to dbus.

Revision history for this message
sickrandir (kint1) wrote :

I think that pressing the power button of the pc should trigger the shutdown dialog of kde and not automatically shutdown the pc!
Last time I used ubuntu with gnome (hardy, some months ago) the behaviour was to trigger the dialog and I think that in kubuntu/kde should be the same.

Revision history for this message
Adam Niedling (krychek) wrote :

You should find the right package for this bug as it's related to Kubuntu instead of Ubuntu.

Revision history for this message
sickrandir (kint1) wrote :

Set the package to kdebase. Hope it's the right one...

Revision history for this message
Harald Sitter (apachelogger) wrote :

If I am not mistaken powerbtn.sh is the script responsible for the action - moving bug.
acpid: /etc/acpi/powerbtn.sh

Revision history for this message
Darwin Bautista (baudm) wrote :

Attached is a patch for /etc/acpi/powerbtn.sh.

I've already tested this (single-user only) on my machine. Of course, I wasn't able to do it without valuable help:
http://samwiseandthestereotypical.blogspot.com/2008/09/using-dbus-and-ksmserver-to-logout-and.html
http://www.g-loaded.eu/2007/11/18/problems-using-libnotify-for-user-to-user-notifications/

Revision history for this message
Tom Helner (duffman) wrote :

Darwin's patch solves the immediate shutdown issue on my system (8.10 w/ KDE 4.2). Its still not 100% because /etc/acpi/powerbtn.sh trumps my powerdevil settings.

Currently /etc/acpi/powerbtn.sh looks to see if gnome-power-manager, kpowersave or klaptopdaemon are running to let those programs handle this policy. I would suggest that the powerdevil daemon be added to this list in preparation for 9.04 and KDE 4.2 where powerdevil will be the default power manager.

Revision history for this message
Darwin Bautista (baudm) wrote :

Updated patch. /etc/acpi/powerbtn.sh now checks for powerdevil. Checking for klaptopdaemon has been removed since it no longer exists in the official repositories of Intrepid and later.

Revision history for this message
Tom Helner (duffman) wrote :

Updated patch works perfectly on my system. Thanks Darwin.

Revision history for this message
In , l (l-redhat-bugs) wrote :

Description of problem: the file /etc/acpi/actions/power.sh should be modified to check if KDE's power-management applet (plasmoid) is running.

Version-Release number of selected component (if applicable): acpid-1.0.6-9.fc10

Actual results: if the power-button is pressed while running KDE's power-management applet, the system shuts down

Expected results: instead of shutting down, the system should present the standard logout/poweroff/restart dialog

Additional info: I don't have the skills to fix this so I changed my /etc/acpi/actions/power.sh like so, starting at line 19:

# Check that there is a power manager, otherwise shut down.
[ "$uid_session" ] || shutdown -h now

#[ "$uid_session" ] &&
#ps axo uid,cmd | \
#awk '
# $1 == '$uid_session' &&
# ($2 ~ /gnome-power-manager/ || $2 ~ /kpowersave/) \
# { found = 1; exit }
# END { exit !found }
#' ||
# shutdown -h now

In this way, if there's an X11 session running, pushing the power button does not shutdown the system and KDE's power-management plasmoid takes control.

I don't have kpowersave installed as this is not the default in KDE 4.2.0.

Revision history for this message
In , l (l-redhat-bugs) wrote :

By the way, this is similar to bug 169476

Revision history for this message
In , Rex (rex-redhat-bugs) wrote :

Also consider guidance-power-manager, which is the F-10/kde default.

Revision history for this message
In , Jaroslav (jaroslav-redhat-bugs) wrote :

For guidance it's easy:
# ($2 ~ /gnome-power-manager/ || $2 ~ /kpowersave/ || $3 ~ /guidance-power-manager/) \

Question is how to determine PowerDevil status? It's KDED module, so does not appear in list of processes. Some distributions only tests if kded4 process is running - it should be enough assume that some power manager is running but... Another approach is to use DBUS - org.kde.powerdevilsystem.

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

I vote for kded4 check only. This test should be enough these days.

Revision history for this message
In , Rex (rex-redhat-bugs) wrote :

removing from kde42 blocker, it's not a regression or kde42 specific.

the dbus idea looks sounds interesting, but checking for a KDE session, ie, not processing
if "${KDE_FULL_SESSION}" == "true"
is agreeable too.

Revision history for this message
In , Jaroslav (jaroslav-redhat-bugs) wrote :

I think it's KDE 4 regression - users expect dialog not direct shutdown and it's KDE 4.2 specific too - PowerDevil is new feature and we have to check if it's running. So for me it's blocker :)

This check sounds pretty easy but again we have to believe that some power management is running on top of KDE, haven't we? I hope it's 99.9% sure...

Revision history for this message
In , Rex (rex-redhat-bugs) wrote :

It's a regression since F-8 true... :0 but blocking the 4.2 update for this? No.

Revision history for this message
Darwin Bautista (baudm) wrote :

Any chance of pushing an official fix now? This issue looks pretty minor at first, but considering the fact that it causes actual data loss due to the system shutting down without any confirmation, I believe that this should be considered of high importance. I've actually been hit by this bug at least twice already (yeah, and I lost unsaved work!) before I decided to dig into it.

I don't understand why this kind of bug, which involves a simple case "porting" a short shell script from KDE3 to KDE4, takes such a long time to fix. Or is it because only KDE is affected by this bug and not Ubuntu's default, GNOME?

Revision history for this message
In , Kevin (kevin-redhat-bugs) wrote :

Will KDE_FULL_SESSION be set at that point? It's only set for processes started from within the session.

Revision history for this message
In , Rex (rex-redhat-bugs) wrote :

You're right, nevermind. dbus queries may be the way to go.

Revision history for this message
In , Rex (rex-redhat-bugs) wrote :

The compromise idea from the kde-sig meeting earlier today was to simply add a check for a "kded4" process (which is what opensuse apparently does here too), so

# ($2 ~ /gnome-power-manager/ || $2 ~ /kded4/) \

should do the trick.

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

I agree with <email address hidden>. I'm going to add two more checks. First one for guidance-power-manager and second one for kded4.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

acpid-1.0.6-10.fc10 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report.

Revision history for this message
In , l (l-redhat-bugs) wrote :

All swell now. Thanks a million!!!

Revision history for this message
In , Lukáš (luk-redhat-bugs) wrote :

As a followup, here's a quick method (Qt-way), to check for PowerDevil's presence:

QDBusInterface kdedInterface("org.kde.kded", "/kded", "org.kde.kded");
QDBusReply<QStringList> reply = kdedInterface.call("loadedModules");
if (reply.isValid() && reply.value().contains("powerdevil"))
{
    // we are alive
}

Revision history for this message
In , Kevin (kevin-redhat-bugs) wrote :

But that only works within a session, as it needs to connect to the D-Bus session bus.

Revision history for this message
In , Sergio (sergio-redhat-bugs) wrote :

(In reply to comment #0)
>
> In this way, if there's an X11 session running, pushing the power button does
> not shutdown the system and KDE's power-management plasmoid takes control.
>
> I don't have kpowersave installed as this is not the default in KDE 4.2.0.

Hi, have you something else that substitute kpowersave , to change
CPU Frequency Policy and active schema of power management ?

thanks,

BTW: kpowersave seems not obey to power manager profiles on system settings

Revision history for this message
In , Kevin (kevin-redhat-bugs) wrote :

Add a battery plasmoid to the panel. That plasmoid integrates with PowerDevil, which is also what the settings in System Settings are for.

Revision history for this message
In , Sergio (sergio-redhat-bugs) wrote :

Are you talking about Battery Monitor v1.0 ?
Doesn't have nothing but batt status

Revision history for this message
In , Kevin (kevin-redhat-bugs) wrote :

I'm talking about the applet/widget/plasmoid which comes with KDE 4.2.

Revision history for this message
Marcel Schaal (marcelschaal) wrote :

same in jaunty... maybe we get it in 9.10 or 10.04

gnome guys want amarok and digikam from kde only.

Revision history for this message
Malte S. Stretz (mss) wrote :

This is the same as bug 321100 and both have a (slightly different) patch. Not sure which to mark as a dup of the other :)

Revision history for this message
Malte S. Stretz (mss) wrote :

Fedora, OpenSuSE, Debian seem to have used the simple check for a running kded (as in the patch in bug 321100), see eg. http://fedoraproject.org/wiki/SIGs/KDE/Meetings/2009-02-03

Revision history for this message
Darwin Bautista (baudm) wrote :

Checking for a running kded is not enough because a running kded does not guarantee that the PowerDevil service is actually running. Checking if kded is running AND if the PowerDevil module is loaded should be the way to go (this is actually the way klaptopdaemon was being checked for by powerbtn.sh).

The rest of the patch merely ports to KDE4 the existing logout/shutdown logic for KDE3. The code became a little bit longer because D-BUS doesn't have an equivalent for DCOP's --all-sessions and --all-users options.

Revision history for this message
Malte S. Stretz (mss) wrote :

Everybody else just checks for kded and that seems to work fine.

Actually, I think thats indeed more correct: If kded is running (ie. somebody is logged into a KDE session), I can assume that KDE takes care of the Power Button event, may it be via PowerDevil or some other app. I never ever want to have somebody accidentally hitting the power button (think of the stupid setup at my university's lab where people never know if the PC right or left of them is the one for their screen) kill my session just because PowerDevil wasn't running for some reason. I prefer the power button not doing anything over it accidentally killing my session.

I think (haven't tried though) that the logout block isn't needed because PowerDevil takes care of showing the logout request (on all sessions?).

Simples way to go, at least for karmic, would be to just sync acpid/acpi-support/acpi-support-base with the upstream Debian version (IMHO).

Changed in acpi-support (Debian):
status: Unknown → Fix Released
Revision history for this message
Darwin Bautista (baudm) wrote :

Debian's CheckPolicy() essentially does the same thing as my patch (that is, check for PowerDevil and not just for kded). Actually, it does even more because it switches to the current non-root user first before using qdbus to check for PowerDevil.

Anyway, you're right. The most sensible solution is to just sync the acpi packages with the ones in Debian.

Changed in acpid (Fedora):
status: Unknown → Fix Released
Revision history for this message
Isaac Kriegman (zackriegman) wrote :

This problem seems to be back in Kubuntu 10.04. Despite the fact that in each power profile, the action for the power button is set to suspend to ram, or to present a dialog, when the power button is pressed, it just shuts down the computer, killing whatever is open without closing gracefully. This was working fine in 9.10, but in 10.04 it's broken again.

Changed in acpid (Ubuntu):
status: Confirmed → New
Revision history for this message
Tom Helner (duffman) wrote :

There's a new bug report for the reappearance of this issue in 10.04:
kde power button configuration ignored
https://bugs.launchpad.net/ubuntu/+source/acpid/+bug/553557

Revision history for this message
Tom Chiverton (bugs-launchpad-net-falkensweb) wrote :

Busted in 11.11 beta 2 still

Revision history for this message
Swâmi Petaramesh (swami-petaramesh) wrote :

Confirming the problem is present in KDE in Oneiric Beta2.

Changed in acpid (Ubuntu):
status: New → Confirmed
Revision history for this message
aaron-bru (aaron-bru) wrote :

When I press the power button or click shutdown in the user menu in Gnome 3, the dialog box pops up for a fraction of a second before the computer shuts down. At first it says something like "Waiting for apps to quit" and then "Powering off the system"

Is this the same bug, or should I file a new bug report?

Also, when I click logoff from the user menu in Gnome 3, the confirmation dialog box pops up ("Aaron Brubacher will be logged out automatically in 60 seconds") for a fraction of a second, and then the computer proceeds to logoff. Presumable they are related...

Revision history for this message
Adam Niedling (krychek) wrote :

Aaron: which version of Ubuntu are you using?

Revision history for this message
aaron-bru (aaron-bru) wrote :

I am on Ubuntu 11.10 x64, fully updated.
Also, I ran the logout with a stress test to slow it down and noticed the 60 seconds change to 30 seconds, so it seems like its counting down really fast, although I could be wrong about that.

Revision history for this message
Marius B. Kotsbak (mariusko) wrote :

The fix should be there in the Debian package version 0.121-1 and the latest in Ubuntu is 0.1.40. I also do not reproduce this in Kubuntu 12.04. Pressing the power button presents a shutdown menu.

Changed in acpid (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Tom Chiverton (bugs-launchpad-net-falkensweb) wrote :

This appears to have reappeared in Saucy. I've opened a new bug. Despite comment:21 the acpi scripts still try to do all sorts of extra weird checks rather than just seeing kded and leaving that to take care of things.

Changed in acpid (Fedora):
importance: Unknown → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.