Bug 807616

Summary: upower org.freedesktop.UPower.EnumerateDevices timeout
Product: [openSUSE] openSUSE 12.3 Reporter: Christian Boltz <suse-beta>
Component: BasesystemAssignee: Cristian Rodríguez <crrodriguez>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None CC: forgotten_DV81ZEWZkN, oliver.henshaw
Version: RC 2   
Target Milestone: ---   
Hardware: Other   
OS: openSUSE 12.2   
Whiteboard:
Found By: Beta-Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: grep dbus /var/log/messages (without workaround symlink)

Description Christian Boltz 2013-03-05 21:06:24 UTC
(using Factory from 2013-02-20 - I don't know if this also affects 12.3)

While debugging a powerdevil crash (see https://bugs.kde.org/show_bug.cgi?id=314922 ) I entered this command in a KDE Konsole (as user):

# time dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.EnumerateDevices
Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

real    0m25.063s
user    0m0.001s
sys     0m0.001s

As you can see, the command just runs into a timeout. 
Can you fix it, please? ;-)
Comment 1 Vincent Untz 2013-03-06 07:19:00 UTC
Can you kill upower and run it as root again in a terminal? IIRC, the binary is /usr/lib/upower/upowerd. Then do that again and see if there's some weird output (there's also a verbose option).

Also, is there anything about the dbus call in /var/log/messages?
Comment 2 Christian Boltz 2013-03-06 12:37:26 UTC
upowerd was not running, and trying to start it as root results in:

# /usr/lib/upower/upowerd -v
TI:13:35:37     Starting upowerd version 0.9.19

(upowerd:5881): UPower-ERROR **: failed to get pokit authority: Error initializing authority: Could not connect: Connection refused
Trace/Breakpoint ausgelöst

# echo $?
133

/var/log/messages contains this line from trying to start upowerd:
$timestamp geeko kernel: [ 4569.000840] traps: upowerd[5890] trap int3 ip:7f9f754c79b7 sp:7fff96f5f100 error:0

Given this, attaching the /var/log/messages entry doesn't make too much sense ;-)
Comment 3 Vincent Untz 2013-03-06 12:46:14 UTC
Looks to me like you have a broken polkit setup. Can you check it's all correctly installed, with latest versions, and so on? Maybe try to run polkit as root, manually in the same way you ran upower?
Comment 4 Christian Boltz 2013-03-07 22:11:47 UTC
(In reply to comment #3)
> Looks to me like you have a broken polkit setup. Can you check it's all
> correctly installed, with latest versions, and so on?

"latest versions" was the key - after updating to latest Factory some minutes ago, upower is running and the dbus call from comment #0 works :-)
Comment 5 Christian Boltz 2013-04-05 19:24:56 UTC
After updating to latest factory yesterday, the problem is back :-(

Not even polkitd can be started (as root):

# /usr/lib/polkit-1/polkitd 
Successfully changed to user polkitd
Error getting system bus: Could not connect: Connection refused
** (polkitd:7920): WARNING **: Error getting system bus: Could not connect: Connection refused
21:22:53.369: Loading rules from directory /etc/polkit-1/rules.d
21:22:53.369: Loading rules from directory /usr/share/polkit-1/rules.d
21:22:53.371: Finished loading, compiling and executing 3 rules
Entering main event loop
21:22:53.372: Lost the name org.freedesktop.PolicyKit1 - exiting
Shutting down
Exiting with code 0
Comment 6 Christian Boltz 2013-04-27 14:21:17 UTC
Cristian, do you have an idea why polkitd gets a "connection refused" from dbus? (see comment #5)

I'm using Factory, last update 2013-04-24.
Comment 7 Christian Boltz 2013-05-24 07:41:36 UTC
I think I found the problem.

/var/run/dbus/system_bus_socket existed, but was created two weeks ago and nobody was listening on it.

Instead, there is /run/dbus/system_bus_socket now.

Workaround:
cd /var/run/dbus && ln -sf /run/dbus/system_bus_socket
Comment 8 Christian Boltz 2013-05-31 10:17:33 UTC
My workaround symlink was deleted and replaced with a real socket (with noone listening) during the last factory update.

# ls -l --time-style\=full-iso /var/run/dbus/system_bus_socket
srw-rw-rw- 1 root root 0 2013-05-30 18:01:50.121873996 +0200 /var/run/dbus/system_bus_socket

This happened about 20 seconds after dbus was updated:
2013-05-30 18:01:32|install|dbus-1|1.7.2-1.2|x86_64||factory-oss|e548be1071b93160d4d1c128641a3067077a876503f027ba8be120d31efbb336|

# rpm -q --scripts dbus-1
postinstall scriptlet (using /bin/sh):
# Temporarily override the socket path systemd sees, so the running D-Bus process won't be clobbered.
mkdir -p /run/systemd/system
/usr/bin/sed 's#ListenStream=/run/dbus/system_bus_socket#ListenStream=/var/run/dbus/system_bus_socket#' < /usr/lib/systemd/system/dbus.socket > /run/systemd/system/dbus.socket
[...]

That _might_ explain it...
Comment 9 Christian Boltz 2013-05-31 10:26:59 UTC
(In reply to comment #8)
> That _might_ explain it...

Confirmed:
    zypper in -f dbus-1
    systemctl daemon-reload
creates /var/run/dbus/system_bus_socket as socket.

So basically we have two issues here:
a) polkitd tries to open /var/run/dbus/system_bus_socket instead of
   /run/dbus/system_bus_socket
b) %post of dbus-1 breaks the workaround symlink by replacing it with a socket
Comment 10 Forgotten User DV81ZEWZkN 2013-07-16 01:00:27 UTC
(In reply to comment #9)
> Confirmed:
>     zypper in -f dbus-1
>     systemctl daemon-reload
> creates /var/run/dbus/system_bus_socket as socket.
> 
> So basically we have two issues here:
> a) polkitd tries to open /var/run/dbus/system_bus_socket instead of
>    /run/dbus/system_bus_socket
> b) %post of dbus-1 breaks the workaround symlink by replacing it with a socket

Cristian, is this still valid with latest dbus package? at least 2) is fixed, as for 1) i can't remember off the top of my head
Comment 11 Christian Boltz 2013-07-17 11:55:13 UTC
Created attachment 548326 [details]
grep dbus /var/log/messages (without workaround symlink)

It seems various things still need /var/run/dbus/system_bus_socket - without my workaround symlink, KDE started extremely slow, and the log contains several "timed out" failure notices:

dbus[1766]: [system] Failed to activate service 'org.freedesktop.Avahi': timed out
dbus[1766]: [system] Failed to activate service 'org.freedesktop.ConsoleKit': timed out
dbus[1766]: [system] Failed to activate service 'org.freedesktop.systemd1': timed out
dbus[1766]: [system] Failed to activate service 'org.freedesktop.UDisks2': timed out
dbus[1766]: [system] Failed to activate service 'org.freedesktop.UPower': timed out

The full output of "grep dbus /var/log/messages" is attached, it includes the full messages including timestamps and also some more failing services.
Comment 12 Christian Boltz 2017-08-03 20:19:54 UTC
Nowadays /run and /var/run both have the same tmpfs (bind?)mounted, so this old issue shouldn't cause any problems anymore.