[Pkg-xfce-devel] Bug#732623: possible explanation and patch proposal

Pascal Dormeau pdormeau at free.fr
Sat Dec 28 14:45:45 UTC 2013


Hi Yves-Alexis,

Please find hereafter an explanation of the problem based on my personal
interpretation. Vincent has been very much involved in debugging so I
CC him too.

 * What is going on :
This happens when logind is running.
Before logout, we have at least one logind user session and one
logind lightdm session (implies that libpam-systemd is installed).
At logout, lightdm immediately starts a new session (and runs a new
lightdm-gtk-greeter process), then the former lightdm session is
removed, and only then the user session is removed.
So when the new lightdm-gtk-greeter process is launched, more than one
logind session exists.
lightdm-gtk-greeter checks if suspend, hibernate, restart, shutdown
are allowed using the
lightdm_get_can_suspend/hibernate/restart/shutdown() functions.
If one of those actions is not allowed, it is hidden from the power
menu, from beginning to end of the lightdm-gtk-greeter process.
If logind is running, power actions are allowed according
to /usr/share/polkit-1/actions/org.freedesktop.login1.policy.
For multiple-sessions, restart and hibernate are
allow_active "auth_admin_keep".
So at logout we have temporary a multi-sessions configuration implying
that hibernate and restart are not allowed. Because the power menu is
static inside a given lightdm-gtk-greeter process, hibernate and
restart remain forbidden even after only one lightdm session remains.
The bug could be in the way the different logind sessions are removed
and created at logout, but still, lightdm-gtk-greeter is unable to
track session changes (for instance, if someone else logs into a
VT).

* proposal
The proposal is to check whether hibernate, restart, shutdown
are allowed, only when the power menu is opened.
The patch in attachment is doing this.
But BIG WARNING:
I spend only a couple of days digging into the GTK documentation
available on the web, it's all new for me. It might be dirty.
Check needed. Help also welcome for improvement (I guess there is a
smarter way to avoid those 5 new GtkWidget objects).
I run lightdm and lightdm-gtk-greteer with it, so far they behave as
expected (in particular, if I log in a VT resulting into a multiple
session situation, I can see the change in the menu).

Regards
Pascal Dormeau
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 07-run_time_power_menu.patch
Type: text/x-diff
Size: 3164 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-xfce-devel/attachments/20131228/1453a6f9/attachment.patch>


More information about the Pkg-xfce-devel mailing list