Kubuntu 13.04 power button always turn off system

Bug #1124149 reported by Turbo on 2013-02-13
This bug report is a duplicate of:  Bug #1201180: powerbtn.sh conflicts with logind. Edit Remove
202
This bug affects 40 people
Affects Status Importance Assigned to Milestone
kde-workspace (Ubuntu)
Undecided
Unassigned

Bug Description

Hi all,

In my house we both use Kubuntu 13.04 with Kernel 3.8 and full updates in two very different systems.

If you press the power button it will ALWAYS turn the system off with no questions or warnings. Is totally ignoring every single option you set on Energy or Startup in Systems Settings. On Kubuntu 12.10 + KDE 4.10 it works perfect.

Regards.

Turbo.

Turbo (axelhc) on 2013-02-13
description: updated
Philip Muškovac (yofel) on 2013-02-13
affects: kdebase-workspace (Ubuntu) → kde-workspace (Ubuntu)
Philip Muškovac (yofel) wrote :

Hi,

thank you for taking your time to report this bug and helping to make Kubuntu better.
Can you please check how many kded4 processes you have running when that happens? The kde session check in
/etc/acpi/powerbtn.sh
isn't particulary robust and might cause that. Try commenting the shutdown command at the bottom out and please report back whether it still immediately shuts down when you press the power button.

tags: added: kubuntu raring
Turbo (axelhc) wrote :

Hi,

Attached, the powerbtn.sh

By the way, there is only one "kded4" running.

Thank you.

Turbo (axelhc) wrote :

Hi,

This weekend formated one of the computers, keeping personal settings (home) and installing Kubuntu 12.10 x64 with full updates. The button behavior, oddly, is still there. I'm VERY sure I saw that working fine in 12.10 before... :-o :-o

Regards.

Harald Sitter (apachelogger) wrote :

please do the following in a terminal

$ qdbus org.kde.kded /modules/powerdevil &> qdbus.log
$ kdebugdialog
select all and apply
$ kquitapp kded; sleep 3
$ kded4 --nofork &> kded.log

hit the power, after having started again you should find the files qdbus.log and kded.log in your home directory, please attach them to the bug report.

Changed in kde-workspace (Ubuntu):
status: New → Incomplete
foggydude (rogier-stekje) wrote :

affects me too. when pressed, x is closed immediately and a terminal says 'root@mylaptop broadcast message power button pressed'

(very annoying as on my new laptop 'resume laptop on lid open' does work, as opposed to my old one. hence, i still press it on opening it resulting in heavy cursing when entering trains or meetings)

Luke Johnstone (john-wella) wrote :

I'm also experiencing this, on a fresh Ubuntu 13.04 beta 2 installation with the lastest kubuntu-desktop installed. If i bump the button, poof I loose everything..

TeXHaPb (staryx) wrote :

The source of the bug is qdbus (4:4.8.4+dfsg-0ubuntu9). The binary file was moved from /usr/bin/qdbus to /usr/lib/i386-linux-gnu/qt4/bin/qdbus. So it is not in root's PATH and can't be run in powerbtn.sh:46.
There are TEMPORARY solutions for users:
1) Install http://packages.ubuntu.com/quantal/qdbus and hold it.
2) Create symlink from /usr/bin/qdbus pointing to /usr/lib/i386-linux-gnu/qt4/bin/qdbus.
3) Patch /etc/acpi/powerbtn.sh:
diff --git a/acpi/powerbtn.sh b/acpi/powerbtn.sh
--- a/acpi/powerbtn.sh
+++ b/acpi/powerbtn.sh
@@ -43,7 +43,7 @@ elif test "$XUSER" != "" && test -x /usr/bin/qdbus; then
         kded4pid=$(pgrep -n -u $XUSER kded4)
         if test "$kded4pid" != ""; then
                 dbusaddr=$(su - $XUSER -c "grep -z DBUS_SESSION_BUS_ADDRESS /proc/$kded4pid/environ")
- if test "$dbusaddr" != "" && su - $XUSER -c "export $dbusaddr; qdbus org.kde.kded" | grep -q powerdevil; then
+ if test "$dbusaddr" != "" && su - $XUSER -c "export $dbusaddr; /usr/lib/i386-linux-gnu/qt4/bin/qdbus org.kde.kded" | grep -q powerdevil; then
                         exit
                 fi
         fi

I don't know whom to ask to fix this bug. So please tell the right person to fix it, because it's a release blocking bug I think.

Philip Collins (pa-collins) wrote :

This bug also affects me, and was introduced with kubuntu 13.04 that I upgraded to yesterday. I can confirm that the power button indeed operated correctly in version 12.10 as I made extensive use of the facility. (Sony Vaio laptop model VGN-FE41M).

Tuukka Ruhanen (truhanen) wrote :

I just upgraded to Kubuntu 13.04 and got the same bug.

Commenting out the last line from /etc/acpi/powerbtn.sh worked for me:
#/sbin/shutdown -h now "Power button pressed"

Now my laptop (Samsung RF511) goes to sleep as desired, when power button is pressed.

Thanks!

Tuukka Ruhanen (truhanen) wrote :

I take that back.

My system does not go to sleep, afterall. Instead of just commenting the line, I replaced it with
/usr/sbin/pm-suspend
and removed any power button actions from power management settings.

Chris Morgan (chmorgan) wrote :

Ran the commands specified. Hoping to move this out of 'incomplete' and possibly get it resolved to get this nice thing working again.

Chris Morgan (chmorgan) wrote :

And the other file, since launchpad didn't appear to let me attach multiple files....

bt (web-bt) wrote :

Hello,
this bug affects me too.
thanks

Holger Engels (hengels-7) wrote :

Same issue here .. I'm using kubuntu raring since yesterday .. suspend on power button worked with quantal, it doesn't work with raring. /usr/bin/qdbus is in place, so that's not the problem .. however, I found out something strange ..

export $dbusaddr; qdbus org.kde.kded ... as user holger does work

su - holger -c "export $dbusaddr; qdbus org.kde.kded" ... produces the message: qdbus: could not find a Qt installation of ''

hope that helps!

regards,

holger

Holger Engels (hengels-7) wrote :

$ which -a qdbus
/usr/lib/x86_64-linux-gnu/qt4/bin/qdbus
/usr/bin/qdbus

$ ls -l /usr/bin/qdbus
lrwxrwxrwx 1 root root 9 Mai 6 11:57 /usr/bin/qdbus -> qtchooser

I think this bug report is not a duplicate of #1176686 .. seems like qtchooser isn't working for some other reason ..

Lupe Christoph (lupe) wrote :
Download full text (3.2 KiB)

Here is some information from a run of powerbtn.sh (without the forced shutdown, of course):

Environment:

UPSTART_INSTANCE=
UPSTART_JOB=acpid
TERM=linux
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
RUNLEVEL=2
PREVLEVEL=N
UPSTART_EVENTS=runlevel
PWD=/

id:
uid=0(root) gid=0(root) groups=0(root)

Shell trace:
+ [ -r /usr/share/acpi-support/power-funcs ]
+ . /usr/share/acpi-support/power-funcs
+ umask 022
+ PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/bin/X11
+ POWERSTATE=/var/lib/acpi-support/powerstate
+ LAPTOP_MODE=/usr/sbin/laptop_mode
+ HDPARM=/sbin/hdparm -q
+ LIDSTATE=/var/lib/acpi-support/lidstate
+ test -f /var/lock/acpisleep
+ [ -r /usr/share/acpi-support/power-funcs ]
+ getXconsole
+ local displaynum
+ ck-list-sessions
+ awk BEGIN { active = 0; } /^Session/ { active = 0; } /active = TRUE/ { active = 1; } active && /x11-display = ':.+'/ { gsub(/':*/,"",$3); print $3; exit (0); }
+ displaynum=0
+ [ -n 0 ]
+ export DISPLAY=:0
+ getXuser
+ pinky -fw
+ awk { if ($2 == ":0" || $(NF) == ":0" ) { print $1; exit; } }
+ user=lupe
+ [ xlupe = x ]
+ [ xlupe != x ]
+ getent passwd lupe
+ cut -d: -f6
+ userhome=/home/lupe
+ export XAUTHORITY=/home/lupe/.Xauthority
+ export XUSER=lupe
+ PMS=gnome-settings-daemon kpowersave xfce4-power-manager
+ PMS=gnome-settings-daemon kpowersave xfce4-power-manager guidance-power-manager.py dalston-power-applet
+ pidof x gnome-settings-daemon kpowersave xfce4-power-manager guidance-power-manager.py dalston-power-applet
+ test lupe !=
+ pidof dcopserver
+ test lupe !=
+ test -x /usr/bin/qdbus
+ pgrep -n -u lupe kded4
+ kded4pid=3186
+ test 3186 !=
+ su - lupe -c grep -z DBUS_SESSION_BUS_ADDRESS /proc/3186/environ
+ dbusaddr=DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-BemSTMbtIA,guid=c5e7571096c4f63756b9815c518c959d
+ test DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-BemSTMbtIA,guid=c5e7571096c4f63756b9815c518c959d !=
+ su - lupe -c export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-BemSTMbtIA,guid=c5e7571096c4f63756b9815c518c959d; qdbus org.kde.kded
+ grep -q powerdevil
qdbus: could not find a Qt installation of ''

And:

# su - lupe -c "which qdbus"
/usr/bin/qdbus
# ls -l /usr/bin/qdbus
lrwxrwxrwx 1 root root 9 Feb 12 16:38 /usr/bin/qdbus -> qtchooser
# ls -l /usr/bin/qtchooser
-rwxr-xr-x 1 root root 23072 Feb 12 16:38 /usr/bin/qtchooser
# file /usr/bin/qtchooser
/usr/bin/qtchooser: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x79b3acf468ac83ae183de0958540ef99c3d5457f, stripped

So it has nothing to do with qdbus:i386.

The problem is that the script picks up qtchooser. The right qdbus executable is here:
$ ls -l /usr/lib/x86_64-linux-gnu/qt4/bin/qdbus
-rwxr-xr-x 1 root root 64928 Mar 27 02:09 /usr/lib/x86_64-linux-gnu/qt4/bin/qdbus

Replacing qdbus with /usr/lib/x86_64-linux-gnu/qt4/bin/qdbus in the script makes it work:

+ su - lupe -c export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-BemSTMbtIA,guid=c5e7571096c4f63756b9815c518c959d; /usr/lib/x86_64-linux-gnu/qt4/bin/qdbus org.kde.kded
+ grep -q powerdevil
+ exit

So whoever dreamed up this mess must have sm...

Read more...

sergwy (sergwy) wrote :

Lupe,

changing the path to qdbus fixed the problem.

plainly inserted /usr/lib/x86_64-linux-gnu/qt4/bin/qdbus to the script where needed.

TeXHaPb (staryx) wrote :

The problem can be also solved by installing qt4-default and libqt4-dev . If you try to run qdbus command in "root" user environment you can see the error, and after installing this packages it disappears.

TeXHaPb (staryx) wrote :

I think this bug is caused by bug 1177823, not by bug 1176686.

e X t 7 3 (ext73) wrote :

It is strange that such a simple problem to fix them so hard. I gave a running script powerbtn.sh for 13.04 and 13.10 [64-bit]:

https://dl.dropboxusercontent.com/u/72313101/skrypty/powerbtn.sh

I can confirm this bug and was able to simply fix it by installing qt4-default and libqt4-dev as proposed. I did not need to modify powerbtn.sh

Turbo (axelhc) wrote :

Hi,

Yesterday I downloaded and installed the daily build of Kubuntu 13.10 beta and the bug is still there. I also installed qt4-default and libqt4-dev with no change at all. Only formated the root ( / ) partition, keeping intact the Home with my settings.

Regards.

Turbo.

Mephisto861 (rcaez) wrote :

TEMPORARY FIX:
change target of sym.link "/usr/bin/qdbus" from "qtchooser" to "/usr/lib/i386-linux-gnu/qt4/bin/qdbus" (for 32bit)

... and TA-DAAA qdbus call is renable and SHUTDOWN dialog or other preference you've enabled in PowerDevil energy profile. However, now etc/acpi/powerbtn.sh work normally

(For 64bit) point the sym.link to "/usr/lib/x86_64-linux-gnu/qt4/bin/qdbus".

This temporary solution prevents qdbus to invoke bugged qtchooser and calls directly qt4's qdbus bin.

If u want use qt5 i think u must find in "/usr/lib/x86_64-linux-gnu/qt5/bin/ " the right binary for qdbus but iI do not know, have not tried with QT5

Tested on kubuntu 13.04 but but should be fine on ubuntu 13.04 and all derived afflicted by the bug .
However, the problem stems from qtchooser executable. I hope will be resolved soon

...sorry for my poor english... i'm ITALIAN

Mephisto861 (rcaez) wrote :

problem is qdbus command in powerbtn.sh. /usr/bin/qdbus point to bugged qtchooser binary this broke many qt dbus call

Amadu (amadu80) wrote :

FIX: sudo apt-get install qt5-default qttools5-dev-tools

Sooo, any news on fixing this bug?

Simply installing qt5-default qttools5-dev-tools as per the last comment didn't work.

Figure I'll try to symlink shuffle that was described a couple times next...

Before I muck about trying to figure it out myself, does anyone already have handy the exact details for a confirmed currently working recipe for fixing the problem on the most up-to-date Kubuntu 13.10, 32 and 64 bit? (dir names to use etc...?)

Oh wait, nevermind. None of the symlink shuffling nonsense worked, but this did:

http://askubuntu.com/questions/375415/kubuntu-energy-saving-event-on-power-button-pressed-not-working/378795#378795

Hi All,

Just can't believe how OLD this bug is. We have two computers with 13.10 and still having nightmares. The best part: Kubuntu 14.04 alpha 2 also carries this disease. Acording to the explanations found here and there, it is not so hard to fix, so, what's the big deal with this one ??

Is there any hope ????

Regards.

> Date: Fri, 31 Jan 2014 09:32:00 +0000
> From: <email address hidden>
> To: <email address hidden>
> Subject: [Bug 1124149] Re: Kubuntu 13.04 power button always turn off system
>
> *** This bug is a duplicate of bug 1201180 ***
> https://bugs.launchpad.net/bugs/1201180
>
> Oh wait, nevermind. None of the symlink shuffling nonsense worked, but
> this did:
>
> http://askubuntu.com/questions/375415/kubuntu-energy-saving-event-on-
> power-button-pressed-not-working/378795#378795
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1124149
>
> Title:
> Kubuntu 13.04 power button always turn off system
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/kde-workspace/+bug/1124149/+subscriptions

Wiloman (wiloman) wrote :

Bugs is still, Kubuntu 12.10 - 14.04, its really big problem fixt it? o.O If bug is in 4 versions of system is really sad.

And this is not duplicate of: Bug #1201180: Pressing power button turns off the PC ignoring the presence of another s...

Beacuse the same bug is in Ubuntu, Lubuntu and Kaubuntu since version 12.10. I know it beacuse i used all this versions and a distributions.

Bernhard (baumber) on 2014-03-22
tags: added: 14.04 trusty
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers