Bug 7995 - Port lightdm to use systemd(-logind) instead of consolekit
Summary: Port lightdm to use systemd(-logind) instead of consolekit
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Jani Välimaa
QA Contact:
URL:
Whiteboard:
Keywords:
: 8416 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-06 14:38 CET by Jani Välimaa
Modified: 2012-12-22 12:08 CET (History)
2 users (show)

See Also:
Source RPM: lightdm
CVE:
Status comment:


Attachments
lightdm greeter log (2.35 KB, text/plain)
2012-12-21 02:29 CET, Derek Jennings
Details
Patch to disable check for support of shutdown/reboot (1.07 KB, patch)
2012-12-21 11:54 CET, Derek Jennings
Details | Diff
Replacement for Fedora patch (3.76 KB, patch)
2012-12-21 14:15 CET, Derek Jennings
Details | Diff

Description Jani Välimaa 2012-11-06 14:38:12 CET
Currently lightdm requires obsoleted consolekit to be able to reboot or shutdown from greeter menu. Port lightdm to use systemd-logind.

Links to other similar reports in upstream/downstream:
https://bugs.launchpad.net/lightdm/+bug/930488
https://bugzilla.redhat.com/show_bug.cgi?id=867924
Jani Välimaa 2012-11-06 14:39:22 CET

See Also: (none) => https://launchpad.net/bugs/930488, https://bugzilla.redhat.com/show_bug.cgi?id=867924

Georges Eckenschwiller 2012-11-16 14:54:55 CET

CC: (none) => paiiou

Jani Välimaa 2012-11-19 20:01:46 CET

See Also: (none) => https://bugzilla.redhat.com/show_bug.cgi?id=872797

Comment 1 Jani Välimaa 2012-12-17 20:15:17 CET
*** Bug 8416 has been marked as a duplicate of this bug. ***

CC: (none) => derekjenn

Comment 2 Jani Välimaa 2012-12-17 21:26:32 CET
I guess I'll push new lightdm with systemd-logind patches from Fedora to core/updates_testing to see if things works for other users than me.

For me (with Xfce) there's no reboot/shutdown options in lightdm menu with Fedora's patches. Also, shutdown from desktop asks password as

gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanPowerOff

returns 'challenge'.

Please update lightdm from core/updates_testing and report results.
Comment 3 Derek Jennings 2012-12-17 23:59:32 CET
Thanks for that Jani
I tried out lightdm-1.4.0-6.1.mga3   Still no shutdown or restart option in the gtk greeter, but then I tried  it with lightdm-razorqt-greeter-0.5.1-2.mga3  and restart and shutdown works OK in the razor greeter.

I then downgraded back to lightdm-1.4.0-6.mga3 and confirmed that restart/shutdown did NOT work with the razor greeter with the old package. It complains of a dbus error.

So the new package works with the razor greeter but not the gtk greeter.
Comment 4 Derek Jennings 2012-12-20 20:22:59 CET
It appears that the Fedora patch works to the extent that shudown and restart using systemd-logind  works.  What does not work is the function login1_call_function to check if shutdown and restart is supported.

As a quick and dirty workaround if we just disable the check in lightdm-gtk-greeter then it works OK with lightdm-1.4.0-6.1.mga3

Here is the patch (including the patch for Bug 8413 )

--- lightdm-gtk-greeter/src/lightdm-gtk-greeter.c	2012-08-30 18:39:09.000000000 +0100
+++ /home/derek/rpmbuild/SOURCES/lightdm-gtk-greeter.c	2012-12-20 19:03:20.347275000 +0000
@@ -801,6 +801,7 @@
            g_warning ("Failed to load background: %s", error->message);
         g_clear_error (&error);
         g_free (path);
+	background_pixbuf=gdk_pixbuf_add_alpha (background_pixbuf,FALSE,255,255,255);
     }
     else
         g_debug ("Using background color %s", value);
@@ -952,14 +953,14 @@
     gtk_widget_show (image);
     gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0);
 
-    if (!lightdm_get_can_suspend ())
+/*    if (!lightdm_get_can_suspend ())
         gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "suspend_menuitem")));
     if (!lightdm_get_can_hibernate ())
         gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "hibernate_menuitem")));
     if (!lightdm_get_can_restart ())
         gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "restart_menuitem")));
     if (!lightdm_get_can_shutdown ())
-        gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "shutdown_menuitem")));
+        gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "shutdown_menuitem")));  */
 
     renderer = gtk_cell_renderer_text_new();
     gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (session_combo), renderer, TRUE);
Comment 5 Jani Välimaa 2012-12-20 21:27:43 CET
I'll check this tomorrow.

But before that, could you please add your patch as an attachment without alpha channel part. Then it's easier to read and apply them.
Comment 6 Derek Jennings 2012-12-20 22:06:20 CET
no probs

--- lightdm-gtk-greeter/src/lightdm-gtk-greeter.c	2012-08-30 18:39:09.000000000 +0100
+++ lightdm-gtk-greeter/src/lightdm-gtk-greeter.c	2012-12-20 20:59:25.315950000 +0000
@@ -952,14 +952,14 @@
     gtk_widget_show (image);
     gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0);
 
-    if (!lightdm_get_can_suspend ())
+/*    if (!lightdm_get_can_suspend ())
         gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "suspend_menuitem")));
     if (!lightdm_get_can_hibernate ())
         gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "hibernate_menuitem")));
     if (!lightdm_get_can_restart ())
         gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "restart_menuitem")));
     if (!lightdm_get_can_shutdown ())
-        gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "shutdown_menuitem")));
+        gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "shutdown_menuitem")));  */
 
     renderer = gtk_cell_renderer_text_new();
     gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (session_combo), renderer, TRUE);
Comment 7 Derek Jennings 2012-12-21 02:29:30 CET
Created attachment 3270 [details]
lightdm greeter log

Jani

Attached is the log from lightdm without the patch. It looks like the Fedora patch has some errors in it.  I will have an attempt to fix it tomorrow but I am not currently able to compile lightdm locally. Do you have any idea what dependencies I need to satisfy these failures?

error: Failed build dependencies:
	pkgconfig(QtCore) < 5.0.0 is needed by lightdm-1.4.0-6.1.mga3.i586
	pkgconfig(QtDBus) < 5.0.0 is needed by lightdm-1.4.0-6.1.mga3.i586
	pkgconfig(QtGui) < 5.0.0 is needed by lightdm-1.4.0-6.1.mga3.i586
Comment 8 Jani Välimaa 2012-12-21 10:17:37 CET
(In reply to comment #6)
> no probs
> 

I ment as an attachment, a separate file, like you did with the greeter log. :)
Comment 9 Jani Välimaa 2012-12-21 10:21:50 CET
(In reply to comment #7)
> Do you have any idea what
> dependencies I need to satisfy these failures?
> 
> error: Failed build dependencies:
>     pkgconfig(QtCore) < 5.0.0 is needed by lightdm-1.4.0-6.1.mga3.i586
>     pkgconfig(QtDBus) < 5.0.0 is needed by lightdm-1.4.0-6.1.mga3.i586
>     pkgconfig(QtGui) < 5.0.0 is needed by lightdm-1.4.0-6.1.mga3.i586

If you have the .spec available you can do 'urpmi lightdm.spec' to install needed BuildRequires.

You can also do "urpmf --provides --literal 'pkgconfig(QtCore)'" to see which pkg provides QtCore pkgconfig file.
Comment 10 Derek Jennings 2012-12-21 11:54:35 CET
Created attachment 3272 [details]
Patch to disable check for support of shutdown/reboot
Comment 11 Derek Jennings 2012-12-21 11:59:47 CET
>If you have the .spec available you can do 'urpmi lightdm.spec' to install
>needed BuildRequires.

Hey That's great!  How come I have not known this all these years?
Comment 12 Derek Jennings 2012-12-21 14:15:25 CET
Created attachment 3273 [details]
Replacement for Fedora patch

Hi Jani

I think I have succeeded in fixing the Fedora patch.
The attached patch removes some cruft and fixes the bug in the Fedora patch. It now works with lightdm-gtk-greeter without having to use the disable check hack I gave you yesterday.

Attachment 3272 is obsolete: 0 => 1

Derek Jennings 2012-12-21 15:56:50 CET

Attachment 3273 is patch: 0 => 1
Attachment 3273 mime type: application/octet-stream => text/plain

Comment 13 Jani Välimaa 2012-12-22 09:13:36 CET
Thx again. Reused your mods in original patch and modified it a bit by myself too [1]. Pushed fixed release to core/updates_testing. Please test it so I can push it to core/release if all works.

[1] http://svnweb.mageia.org/packages/cauldron/lightdm/current/SOURCES/lightdm-1.4.0-systemd_login1_power.patch?r1=333812&r2=333811&pathrev=333812
Comment 14 Derek Jennings 2012-12-22 11:05:56 CET
Confirming lightdm-1.4.0-6.2.mga3  works great

I can Shutdown and Restart using either the gtk or razorqt greeters.

The only thing I can find wrong is that the drop down list of users for the gtk greeter shows entries for

"system user for lightdm"
"system user for openssh"

I will take a look into it and see if I can work out what is happening.
Comment 15 Jani Välimaa 2012-12-22 11:12:43 CET
(In reply to comment #14)
> Confirming lightdm-1.4.0-6.2.mga3  works great
> 
> I can Shutdown and Restart using either the gtk or razorqt greeters.
> 
> The only thing I can find wrong is that the drop down list of users for the gtk
> greeter shows entries for
> 
> "system user for lightdm"
> "system user for openssh"
> 

For openssh it's because sshd user's login shell is set to /sbin/true. If you change it to e.g. /sbin/false it doesn't appear anymore. Dunno if this is a bug in lightdm or accountsservice.

Never saw lightdm in user list. I may have created lightdm user by hand with "correct" options when testing lightdm, though.
Comment 16 Jani Välimaa 2012-12-22 11:15:43 CET
BTW, I'm closing this bug as FIXED and will push lightdm to release. Please open a new one for other issues.

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 17 Derek Jennings 2012-12-22 11:28:19 CET
>For openssh it's because sshd user's login shell is set to /sbin/true. If you
>change it to e.g. /sbin/false it doesn't appear anymore. Dunno if this is a bug
>in lightdm or accountsservice.

>Never saw lightdm in user list. I may have created lightdm user by hand with
>"correct" options when testing lightdm, though.

Ah. That will be my fault. I changed lightdm's login shell to /bin/bash so I could issue gdbus call commands as lightdm.

I will poke about and see if lightdm is doing anything wrong and raise a new bug if necessary.

Thanks for the work on this one. That is another bug squashed :-)
Comment 18 Manuel Hiebel 2012-12-22 12:08:49 CET
for ssh its seems an accountsservice bug (see bug 7995)

Note You need to log in before you can comment on or make changes to this bug.