Cannot talk to upowerd over D-Bus

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 5 Feb 2016 15:32
(address . bug-guix@gnu.org)(address . swedebugia@riseup.net)
87powbgrdi.fsf@gnu.org
On GuixSD as of v0.9.0-1430-g234ea8a, attempts to talk to upowerd over
D-Bus fail:

Toggle snippet (4 lines)
$ sudo dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend
Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist

L
L
Ludovic Courtès wrote on 7 Feb 2016 15:49
(address . 22565@debbugs.gnu.org)
871t8oy3qj.fsf@gnu.org
tags 22565 notabug
close 22565
thanks

ludo@gnu.org (Ludovic Courtès) skribis:

Toggle quote (9 lines)
> On GuixSD as of v0.9.0-1430-g234ea8a, attempts to talk to upowerd over
> D-Bus fail:
>
> $ sudo dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend
> Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist
>
> See
> <https://lists.gnu.org/archive/html/guix-devel/2016-01/msg01004.html>.

Actually the above method simply does not exist (the blog post
years old.)

If we invoke methods that do exist, everything is fine:

Toggle snippet (14 lines)
$ dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.GetCriticalAction
method return time=1454855982.307374 sender=:1.1 -> destination=:1.51 serial=449 reply_serial=2
string "PowerOff"
$ dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.GetDisplayDevice
method return time=1454855987.010638 sender=:1.1 -> destination=:1.52 serial=450 reply_serial=2
object path "/org/freedesktop/UPower/devices/DisplayDevice"
$ dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.EnumerateDevices
method return time=1454856012.554536 sender=:1.1 -> destination=:1.53 serial=451 reply_serial=2
array [
object path "/org/freedesktop/UPower/devices/line_power_AC"
object path "/org/freedesktop/UPower/devices/battery_BAT0"
]

The thing is, poweroff/suspend/hibernate is now delegated to logind (see
src/linux/up-backend.c in UPower.)

Indeed, the ‘loginctl’ command (or, presumably, other elogind clients
such as GNOME or Xfce) can talk to elogind:

Toggle snippet (4 lines)
$ loginctl suspend
Failed to suspend: Interactive authentication required.

I suppose we need some polkit magic to allow unprivileged users to
invoke those actions, but that’s a different issue.

Thanks,
Ludo’.
R
R
Ricardo Wurmus wrote on 17 Feb 2016 23:03
bug#22565: Cannot talk to upowerd over D-Bus
(address . 22565@debbugs.gnu.org)
8737sr570u.fsf@elephly.net
I’m trying to figure out why we cannot use the Xfce menu to shut down or
reboot, and while doing that I found that

loginctl poweroff

(as root on the TTY) does have the intended effect. When run as a user
I see a similar error as mentioned above:

Failed to power off: Interactive authentication required.

I think this is just fine.
L
L
Ludovic Courtès wrote on 21 Feb 2016 23:47
(name . Ricardo Wurmus)(address . rekado@elephly.net)(address . 22565@debbugs.gnu.org)
87lh6dr89f.fsf@gnu.org
Ricardo Wurmus <rekado@elephly.net> skribis:

Toggle quote (12 lines)
> I’m trying to figure out why we cannot use the Xfce menu to shut down or
> reboot, and while doing that I found that
>
> loginctl poweroff
>
> (as root on the TTY) does have the intended effect. When run as a user
> I see a similar error as mentioned above:
>
> Failed to power off: Interactive authentication required.
>
> I think this is just fine.

I don’t know if it’s fine. :-) I would expect that on GNOME/Xfce a
password window would pop up when that RPC is invoked, but I’m not sure
how it’s supposed to happen, or under what conditions.

Ludo’.
R
R
Ricardo Wurmus wrote on 29 Feb 2016 08:13
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 22565@debbugs.gnu.org)
87si0cat0v.fsf@elephly.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (18 lines)
> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> I’m trying to figure out why we cannot use the Xfce menu to shut down or
>> reboot, and while doing that I found that
>>
>> loginctl poweroff
>>
>> (as root on the TTY) does have the intended effect. When run as a user
>> I see a similar error as mentioned above:
>>
>> Failed to power off: Interactive authentication required.
>>
>> I think this is just fine.
>
> I don’t know if it’s fine. :-) I would expect that on GNOME/Xfce a
> password window would pop up when that RPC is invoked, but I’m not sure
> how it’s supposed to happen, or under what conditions.

After strace’ing “xfce4-session” when clicking on the shutdown button in
the Xfce menu I see the same error returned over DBus.

xfce4-session sends “PowerOff” to “org.freedesktop.login1” via DBus and
gets “org.freedesktop.DBus.Error.InteractiveAuthorizationRequired” back,
which causes the whole thing to fail. (I wonder why it doesn’t use the
fallback mechanism to shut down, but maybe that’s because it detected
systemd/logind and committed to shutting down via DBus.)

So maybe it’s not fine after all.

~~ Ricardo
L
L
Ludovic Courtès wrote on 29 Feb 2016 10:29
(name . Ricardo Wurmus)(address . rekado@elephly.net)
87lh63kgps.fsf@gnu.org
Ricardo Wurmus <rekado@elephly.net> skribis:

Toggle quote (23 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Ricardo Wurmus <rekado@elephly.net> skribis:
>>
>>> I’m trying to figure out why we cannot use the Xfce menu to shut down or
>>> reboot, and while doing that I found that
>>>
>>> loginctl poweroff
>>>
>>> (as root on the TTY) does have the intended effect. When run as a user
>>> I see a similar error as mentioned above:
>>>
>>> Failed to power off: Interactive authentication required.
>>>
>>> I think this is just fine.
>>
>> I don’t know if it’s fine. :-) I would expect that on GNOME/Xfce a
>> password window would pop up when that RPC is invoked, but I’m not sure
>> how it’s supposed to happen, or under what conditions.
>
> After strace’ing “xfce4-session” when clicking on the shutdown button in
> the Xfce menu I see the same error returned over DBus.

Presumably the underlying problem is the polkit issue (determining which
users are “active” and thus allowed to execute privileged operation)
that Andy has been working on and discussed on IRC and at:


Ludo’.
?