Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LightDM login screen: Suspend button is greyed-out [Solved]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Sat Jan 07, 2017 6:05 pm    Post subject: LightDM login screen: Suspend button is greyed-out [Solved] Reply with quote

The Suspend button is greyed-out on the LightDM login screen but the Restart and Shutdown buttons are not and work as expected. Any help or advice on how to get the Suspend button on the login screen to work would be much appreciated.

I am not sure if this problem is particular to my installation, or if it is a bug in the upstream code or Gentoo ebuilds.

When I am logged-in, the Suspend button in the Plasma 5 application-launcher menu works fine (as do all the other buttons). The following command also causes the laptop to suspend as expected:

Code:
$ qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend


I am using the latest Stable version of KDE Plasma 5 (5.8.3) and the latest stable versions of LightDM and LightDM KDE Greeter:

Code:
$ eix -I lightdm
[I] x11-misc/lightdm
     Available versions:  1.16.7^t 1.18.3^t ~1.20.0^t ~1.21.3^t {audit +gnome +gtk +introspection kde qt4 qt5}
     Installed versions:  1.18.3^t(15:25:10 07/01/17)(introspection kde qt4 -audit -gnome -gtk -qt5)
     Homepage:            https://www.freedesktop.org/wiki/Software/LightDM
     Description:         A lightweight display manager

[I] x11-misc/lightdm-kde
     Available versions:  (4) 0.3.2.1-r1
       {aqua debug L10N="bs cs da de el es et fi fr ga gl hu it ja km lt mr nds nl pl pt pt-BR ro ru sk sl sv tr uk"}
     Installed versions:  0.3.2.1-r1(4)(01:13:13 12/07/16)(-aqua -debug L10N="pt-BR -bs -cs -da -de -el -es -et -fi -fr -ga -gl -hu -it -ja -km -lt -mr -nds -nl -pl -pt -ro -ru -sk -sl -sv -tr -uk")
     Homepage:            https://projects.kde.org/projects/playground/base/lightdm
     Description:         LightDM KDE greeter

Found 2 matches


I have configured LightDM as follows:

Code:
$ /usr/sbin/lightdm --show-config
   [LightDM]
A  session-wrapper=/etc/lightdm/Xsession

   [Seat:*]
A  greeter-session=lightdm-kde-greeter
A  session-wrapper=/etc/lightdm/Xsession
A  display-setup-script=/etc/X11/Sessions/plasma

Sources:
A  /etc/lightdm/lightdm.conf

Although I believe it is not relevant to the current problem, for information the file /etc/X11/Sessions/plasma contains the following:

Code:
#!/bin/bash
GPU=`eselect opengl list | grep \* | awk '{ print $2 }'`
if [ "$GPU" = "nvidia" ]; then
    xrandr --setprovideroutputsource modesetting NVIDIA-0
    xrandr --auto
fi


As my installation uses OpenRC there is no systemd-logind, and therefore the following command fails as expected, but I don't think that matters:

Code:
$ qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend true
Cannot find 'org.freedesktop.login1.Manager.Suspend' in object /org/freedesktop/login1 at org.freedesktop.login1


The most pertinent Web page I have found is Red Hat Bugzilla Bug Report No. 872797 - lightdm: provide polkit .rules for actions. The polkit rules file attached in Comment #16 of that bug report contains the following:

Code:
polkit.addRule(function(action, subject) {
    // check user is light dm
    if (subject.user == "lightdm") {
        // log requests
        polkit.log("action=" + action);
        polkit.log("subject=" + subject);
        // check for shutdown / restart requests
        if (action.id.indexOf("org.freedesktop.consolekit.system.") == 0) {
            return "yes";
        }
        // check for suspend / hibernate requests
        if (action.id.indexOf("org.freedesktop.upower.") == 0) {
            return "yes";
        }
        // check for logind requests
        if (action.id.indexOf("org.freedesktop.login1.") == 0) {
            return "yes";
        }
    }
});


As it refers to "org.freedesktop.consolekit.system." and "org.freedesktop.upower." in addition to "org.freedesktop.login1." I assume this rules file should work in an installation that does not use systemd-logind. However, the Gentoo ebuild for LightDM does not create a user lightdm (see Gentoo Bugzilla Bug Report No. 563564 - x11-misc/lightdm no create lightdm system user) so the above rules file cannot work in any case. But if I change the user in the above file from "lightdm" to "root" and save it as /etc/polkit-1/rules.d/60-lightdm.rules, the Suspend button on the LightDM KDE login screen is still greyed-out.

I've run out of ideas and would appreciate some help. TIA.


EDIT (2017-01-08 04:50 UTC): Looks like the upstream LightDM code might be the cause: Light Display Manager Bug #1631707 - Missing suspend and hibernate functionality for non-systemd systems with upower 0.99.0 => . Perhaps the LightDM developers only support systemd these days. :(
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog


Last edited by Fitzcarraldo on Wed Jan 11, 2017 5:26 am; edited 1 time in total
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Wed Jan 11, 2017 1:59 am    Post subject: Reply with quote

Yep, I'd forgotten about suspend/hibernate support being dropped by upower and moved to systemd-logind back in 2014:

https://gentoo.org/support/news-items/2014-06-03-upower-loses-hibernate-suspend-to-systemd.html

Gentoo News wrote:
Title: UPower loses hibernate / suspend to systemd
Author: Samuli Suominen <ssuominen@gentoo.org>
Content-Type: text/plain
Posted: 2014-06-03
Revision: 1
News-Item-Format: 1.0
Display-If-Installed: <sys-power/upower-0.99.0

UPower discontinued hibernate and suspend support in favor of systemd.
Because of this, we have created a compability package at
sys-power/upower-pm-utils which will give you the old UPower with
sys-power/pm-utils support back.
Some desktops have integrated the sys-power/pm-utils support directly
to their code, like Xfce, and as a result, they work also with the new
UPower as expected.

All non-systemd users are recommended to choose between:

# emerge --oneshot --noreplace 'sys-power/upower-pm-utils'

or

# emerge --oneshot --noreplace '>=sys-power/upower-0.99.0'

However, all systemd users are recommended to stay with sys-power/upower.

A small tip for GNOME _and_ systemd users, only 3.12 and newer support 0.99,
so if you see the package manager pulling in sys-power/upower-pm-utils
while using old GNOME, like 2.32 or 3.10, you _can_ prevent it by adding
a package.mask entry for >=sys-power/upower-0.99


Looking at the lightdm-1.18.3 source code, I see in liblightdm-gobject/power.c that, indeed, LightDM uses org.freedesktop.login1 (systemd-logind) to Suspend and Hibernate, with org.freedesktop.UPower as the fallback if systemd-logind is not working. And, as we know, upower =>0.99 no longer supports suspension and hibernation.

These days the advice in the Gentoo News item of 2014-06-03 has been superseded: We are now told that upower-pm-utils is no longer needed (Gentoo Bug Report No. 596988 - [TRACKER] sys-power/upower-pm-utils removal request) and we should unmerge it, merge upower, and merge consolekit with USE="pm-utils". This is because the version of ConsoleKit used by Gentoo supports Suspend/Hibernate. Even so, the LightDM code as it stands still uses only org.freedesktop.login1 and org.freedesktop.UPower, and so it still does not allow suspension and hibernation in Gentoo without systemd. So I attempted to modify power.c in lightdm-1.18.3 to use org.freedesktop.ConsoleKit for Suspend/Resume instead of org.freedesktop.UPower. I'm not sure I have done it correctly, but here's my patch anyway:

Code:
diff -crB 1.18.3/liblightdm-gobject/power.c 1.18.3-upower-fix/liblightdm-gobject/power.c
*** 1.18.3/liblightdm-gobject/power.c   2017-01-10 14:31:57.887194653 +0000
--- 1.18.3-upower-fix/liblightdm-gobject/power.c   2017-01-11 00:39:37.704643002 +0000
***************
*** 8,13 ****
--- 8,20 ----
   * See http://www.gnu.org/copyleft/lgpl.html the full text of the license.
   */
 
+ /*
+  * Modified 2017-01-11
+  * Author: Fitzcarraldo <fitzcarralo1@hotmail.com>
+  *
+  * Replaced UPower Suspend and Hibernate functionality with ConsoleKit.
+  */
+
  #include <config.h>
 
  #include <string.h>
***************
*** 15,48 ****
 
  #include "lightdm/power.h"
 
- static GDBusProxy *upower_proxy = NULL;
  static GDBusProxy *ck_proxy = NULL;
  static GDBusProxy *login1_proxy = NULL;
 
  static GVariant *
! upower_call_function (const gchar *function, GError **error)
  {
!     if (!upower_proxy)
      {
!         upower_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
!                                                       G_DBUS_PROXY_FLAGS_NONE,
!                                                       NULL,
!                                                       "org.freedesktop.UPower",
!                                                       "/org/freedesktop/UPower",
!                                                       "org.freedesktop.UPower",
!                                                       NULL,
!                                                       error);
!         if (!upower_proxy)
!             return NULL;
      }
 
!     return g_dbus_proxy_call_sync (upower_proxy,
!                                    function,
!                                    NULL,
!                                    G_DBUS_CALL_FLAGS_NONE,
!                                    -1,
!                                    NULL,
!                                    error);
  }
 
  static GVariant *
--- 22,58 ----
 
  #include "lightdm/power.h"
 
  static GDBusProxy *ck_proxy = NULL;
  static GDBusProxy *login1_proxy = NULL;
 
  static GVariant *
! ck_call_function (const gchar *function, GVariant *parameters, GError **error)
  {
!     GVariant *r;
!
!     if (!ck_proxy)
      {
!         ck_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
!                                                   G_DBUS_PROXY_FLAGS_NONE,
!                                                   NULL,
!                                                   "org.freedesktop.ConsoleKit",
!                                                   "/org/freedesktop/ConsoleKit/Manager",
!                                                   "org.freedesktop.ConsoleKit.Manager",
!                                                   NULL,
!                                                   error);
!         if (!ck_proxy)
!             return FALSE;
      }
 
!     r = g_dbus_proxy_call_sync (ck_proxy,
!                                 function,
!                                 parameters,
!                                 G_DBUS_CALL_FLAGS_NONE,
!                                 -1,
!                                 NULL,
!                                 error);
!
!     return r;
  }
 
  static GVariant *
***************
*** 100,108 ****
      }
      else
      {
!         r = upower_call_function ("SuspendAllowed", NULL);
!         if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
!             g_variant_get (r, "(b)", &can_suspend);
      }
      if (r)
          g_variant_unref (r);
--- 110,120 ----
      }
      else
      {
!         r = ck_call_function ("CanSuspend", NULL, NULL);
!         gchar *result;
!         if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
!             g_variant_get (r, "(&s)", &result);
!             can_suspend = g_strcmp0 (result, "yes") == 0;
      }
      if (r)
          g_variant_unref (r);
***************
*** 128,136 ****
      if (!result)
      {
          if (error)
!             g_debug ("Can't suspend using logind; falling back to UPower: %s", (*error)->message);
          g_clear_error (error);
!         result = upower_call_function ("Suspend", error);
      }
 
      suspended = result != NULL;
--- 140,148 ----
      if (!result)
      {
          if (error)
!             g_debug ("Can't suspend using logind; falling back to ConsoleKit: %s", (*error)->message);
          g_clear_error (error);
!         result = ck_call_function ("Suspend", g_variant_new("(b)", FALSE), error);
      }
 
      suspended = result != NULL;
***************
*** 165,173 ****
      }
      else
      {
!         r = upower_call_function ("HibernateAllowed", NULL);
!         if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
!             g_variant_get (r, "(b)", &can_hibernate);
      }
      if (r)
          g_variant_unref (r);
--- 177,187 ----
      }
      else
      {
!         r = ck_call_function ("CanHibernate", NULL, NULL);
!         gchar *result;
!         if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
!             g_variant_get (r, "(&s)", &result);
!             can_hibernate = g_strcmp0 (result, "yes") == 0;
      }
      if (r)
          g_variant_unref (r);
***************
*** 193,201 ****
      if (!result)
      {
          if (error)
!             g_debug ("Can't hibernate using logind; falling back to UPower: %s", (*error)->message);
          g_clear_error (error);
!         result = upower_call_function ("Hibernate", error);
      }
 
      hibernated = result != NULL;
--- 207,215 ----
      if (!result)
      {
          if (error)
!             g_debug ("Can't hibernate using logind; falling back to ConsoleKit: %s", (*error)->message);
          g_clear_error (error);
!         result = ck_call_function ("Hibernate", g_variant_new("(b)", FALSE), error);
      }
 
      hibernated = result != NULL;
***************
*** 205,239 ****
      return hibernated;
  }
 
- static GVariant *
- ck_call_function (const gchar *function, GError **error)
- {
-     GVariant *r;
-
-     if (!ck_proxy)
-     {
-         ck_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
-                                                   G_DBUS_PROXY_FLAGS_NONE,
-                                                   NULL,
-                                                   "org.freedesktop.ConsoleKit",
-                                                   "/org/freedesktop/ConsoleKit/Manager",
-                                                   "org.freedesktop.ConsoleKit.Manager",
-                                                   NULL,
-                                                   error);
-         if (!ck_proxy)
-             return FALSE;
-     }
-
-     r = g_dbus_proxy_call_sync (ck_proxy,
-                                 function,
-                                 NULL,
-                                 G_DBUS_CALL_FLAGS_NONE,
-                                 -1,
-                                 NULL,
-                                 error);
-
-     return r;
- }
 
  /**
   * lightdm_get_can_restart:
--- 219,224 ----
***************
*** 260,266 ****
      }
      else
      {
!         r = ck_call_function ("CanRestart", NULL);
          if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
              g_variant_get (r, "(b)", &can_restart);
      }
--- 245,251 ----
      }
      else
      {
!         r = ck_call_function ("CanRestart", NULL, NULL);
          if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
              g_variant_get (r, "(b)", &can_restart);
      }
***************
*** 288,294 ****
      if (!r)
      {
          g_clear_error (error);
!         r = ck_call_function ("Restart", error);
      }
      restarted = r != NULL;
      if (r)
--- 273,279 ----
      if (!r)
      {
          g_clear_error (error);
!         r = ck_call_function ("Restart", NULL, error);
      }
      restarted = r != NULL;
      if (r)
***************
*** 322,328 ****
      }
      else
      {
!         r = ck_call_function ("CanStop", NULL);
          if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
              g_variant_get (r, "(b)", &can_shutdown);
      }
--- 307,313 ----
      }
      else
      {
!         r = ck_call_function ("CanStop", NULL, NULL);
          if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
              g_variant_get (r, "(b)", &can_shutdown);
      }
***************
*** 350,356 ****
      if (!r)
      {
          g_clear_error (error);
!         r = ck_call_function ("Stop", error);
      }
      shutdown = r != NULL;
      if (r)
--- 335,341 ----
      if (!r)
      {
          g_clear_error (error);
!         r = ck_call_function ("Stop", NULL, error);
      }
      shutdown = r != NULL;
      if (r)


However, I subsequently discovered that the LightDM KDE Greeter (x11-misc/lightdm-kde-0.3.2.1-r1) also still assumes UPower provides Suspend and Hibernate: https://cgit.kde.org/lightdm.git/

So the Greeter is broken too. Arghhh! :x

Anyway, I've wasted too much time on this already and I'm not going to waste more time trying to modify the KDE Greeter's code. Therefore, to stop it annoying me, I have removed the greyed-out Suspend button from the Greeter's login screen by changing the following entry in /usr/share/apps/lightdm-kde-greeter/themes/classic/main.qml from:

Code:
PlasmaWidgets.IconWidget {
                text: i18n("Suspend")
                icon: QIcon("system-suspend")
                enabled: power.canSuspend;
                onClicked: {power.suspend();
}

to:

Code:
PlasmaWidgets.IconWidget {
                text: i18n("Suspend")
                icon: QIcon("system-suspend")
                visible: power.canSuspend;
                onClicked: {power.suspend();
}


By the way, the reason the KDE Greeter doesn't display a Hibernate button is because it is hidden by default in /usr/share/apps/lightdm-kde-greeter/themes/classic/main.qml:

Code:
PlasmaWidgets.IconWidget {
                text: i18n("Hibernate")
                icon: QIcon("system-suspend-hibernate")
                //Hibernate is a special case, lots of distros disable it, so if it's not enabled don't show it
                visible: power.canHibernate;
                onClicked: {power.hibernate();
}


Why oh why did freedesktop.org have to move the Suspend and Hibernate functionality out of UPower into systemd-logind. As a result it's a major PITA to try to get some applications to work properly if you don't use systemd. :x
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Wed Jan 11, 2017 5:25 am    Post subject: Reply with quote

Cracked it. \o/

I can now confirm that the patch to LightDM 1.18.3 given in my previous post functions as intended. It works when using the LightDM GTK Greeter, so forget the LightDM KDE Greeter as the code for Suspend and Hibernate from the login screen in the KDE Greeter is broken.

In brief, this is what I did:

1. Created the following ebuild in a local overlay:

Code:
# cat /usr/local/portage/x11-misc/lightdm/lightdm-1.18.3.ebuild
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6
inherit autotools eutils flag-o-matic pam qmake-utils readme.gentoo-r1 systemd versionator xdg-utils

TRUNK_VERSION="$(get_version_component_range 1-2)"
DESCRIPTION="A lightweight display manager"
HOMEPAGE="https://www.freedesktop.org/wiki/Software/LightDM"
SRC_URI="https://launchpad.net/${PN}/${TRUNK_VERSION}/${PV}/+download/${P}.tar.xz
        mirror://gentoo/introspection-20110205.m4.tar.bz2"

LICENSE="GPL-3 LGPL-3"
SLOT="0"
KEYWORDS="amd64 arm ~arm64 ~ppc ~ppc64 ~x86"
IUSE="audit +gtk +introspection kde qt4 qt5 +gnome"
REQUIRED_USE="|| ( gtk kde )"

COMMON_DEPEND="audit? ( sys-process/audit )
        >=dev-libs/glib-2.32.3:2
        dev-libs/libxml2
        gnome? ( sys-apps/accountsservice )
        virtual/pam
        x11-libs/libX11
        >=x11-libs/libxklavier-5
        introspection? ( >=dev-libs/gobject-introspection-1 )
        qt4? (
                dev-qt/qtcore:4
                dev-qt/qtdbus:4
                dev-qt/qtgui:4
                )
        qt5? (
                dev-qt/qtcore:5
                dev-qt/qtdbus:5
                dev-qt/qtgui:5
                )"
RDEPEND="${COMMON_DEPEND}
        >=sys-auth/pambase-20101024-r2"
DEPEND="${COMMON_DEPEND}
        dev-util/gtk-doc-am
        dev-util/intltool
        gnome? ( gnome-base/gnome-common )
        sys-devel/gettext
        virtual/pkgconfig"
PDEPEND="gtk? ( x11-misc/lightdm-gtk-greeter )
        kde? ( x11-misc/lightdm-kde )"

DOCS=( NEWS )
RESTRICT="test"

src_prepare() {
        xdg_environment_reset

        epatch "${FILESDIR}/${PV}-upower-fix.patch"

        sed -i -e 's:getgroups:lightdm_&:' tests/src/libsystem.c || die #412369
        sed -i -e '/minimum-uid/s:500:1000:' data/users.conf || die

        einfo "Fixing the session-wrapper variable in lightdm.conf"
        sed -i -e \
                "/session-wrapper/s@^.*@session-wrapper=/etc/${PN}/Xsession@" \
                data/lightdm.conf || die "Failed to fix lightdm.conf"

        # use correct version of qmake. bug #566950
        sed -i -e "/AC_CHECK_TOOLS(MOC4/a AC_SUBST(MOC4,$(qt4_get_bindir)/moc)" configure.ac || die
        sed -i -e "/AC_CHECK_TOOLS(MOC5/a AC_SUBST(MOC5,$(qt5_get_bindir)/moc)" configure.ac || die

        default

        # Remove bogus Makefile statement. This needs to go upstream
        sed -i /"@YELP_HELP_RULES@"/d help/Makefile.am || die
        if has_version dev-libs/gobject-introspection; then
                eautoreconf
        else
                AT_M4DIR=${WORKDIR} eautoreconf
        fi
}

src_configure() {
        # Set default values if global vars unset
        local _greeter _session _user
        _greeter=${LIGHTDM_GREETER:=lightdm-gtk-greeter}
        _session=${LIGHTDM_SESSION:=gnome}
        _user=${LIGHTDM_USER:=root}
        # Let user know how lightdm is configured
        einfo "Gentoo configuration"
        einfo "Default greeter: ${_greeter}"
        einfo "Default session: ${_session}"
        einfo "Greeter user: ${_user}"

        use qt5 && append-cxxflags -std=c++11

        # also disable tests because libsystem.c does not build. Tests are
        # restricted so it does not matter anyway.
        econf \
                --localstatedir=/var \
                --disable-static \
                --disable-tests \
                $(use_enable audit libaudit) \
                $(use_enable introspection) \
                $(use_enable qt4 liblightdm-qt) \
                $(use_enable qt5 liblightdm-qt5) \
                --with-user-session=${_session} \
                --with-greeter-session=${_greeter} \
                --with-greeter-user=${_user} \
                --with-html-dir="${EPREFIX}"/usr/share/doc/${PF}/html
}

src_install() {
        default

        # Delete apparmor profiles because they only work with Ubuntu's
        # apparmor package. Bug #494426
        if [[ -d ${D}/etc/apparmor.d ]]; then
                rm -r "${D}/etc/apparmor.d" || die \
                        "Failed to remove apparmor profiles"
        fi

        insinto /etc/${PN}
        doins data/{${PN},keys}.conf
        doins "${FILESDIR}"/Xsession
        fperms +x /etc/${PN}/Xsession
        # /var/lib/lightdm-data could be useful. Bug #522228
        dodir /var/lib/lightdm-data

        prune_libtool_files --all
        rm -rf "${ED}"/etc/init

        # Remove existing pam file. We will build a new one. Bug #524792
        rm -rf "${ED}"/etc/pam.d/${PN}{,-greeter}
        pamd_mimic system-local-login ${PN} auth account password session #372229
        pamd_mimic system-local-login ${PN}-greeter auth account password session #372229
        dopamd "${FILESDIR}"/${PN}-autologin #390863, #423163

        readme.gentoo_create_doc

        systemd_dounit "${FILESDIR}/${PN}.service"
}

2. Copied the files from /usr/portage/x11-misc/lightdm/files/ to /usr/local/portage/x11-misc/lightdm/files/ and created the patch file with the contents given in my previous post:

Code:
# ls /usr/local/portage/x11-misc/lightdm/files/
1.18.3-upower-fix.patch  README.gentoo  Xsession  lightdm  lightdm-autologin  lightdm.service


3. Declared the LightDM environment variables in /etc/portage/make.conf:

Code:
# grep -i lightdm /etc/portage/make.conf
LIGHTDM_GREETER="lightdm-gtk-greeter"
LIGHTDM_SESSION="plasma"
LIGHTDM_USER="root"


4. Generated the manifest and merged the package. Then merged the package lightdm-gtk-greeter. The specified USE flags can be seen in the eix output below (I used qt4 in lightdm initially because the lightdm-kde ebuild does not yet support qt5):

Code:
# eix -I lightdm
[I] x11-misc/lightdm
     Available versions:  1.16.7^t 1.18.3^t 1.18.3^t[1] ~1.20.0^t ~1.21.3^t {audit +gnome +gtk +introspection kde qt4 qt5}
     Installed versions:  1.18.3^t[1](03:58:21 11/01/17)(introspection kde qt4 -audit -gnome -gtk -qt5)
     Homepage:            https://www.freedesktop.org/wiki/Software/LightDM
     Description:         A lightweight display manager

[I] x11-misc/lightdm-gtk-greeter
     Available versions:  2.0.1-r1 ~2.0.2 {ayatana branding}
     Installed versions:  2.0.1-r1(03:25:00 11/01/17)(-ayatana -branding)
     Homepage:            https://launchpad.net/lightdm-gtk-greeter
     Description:         LightDM GTK+ Greeter

[I] x11-misc/lightdm-kde
     Available versions:  (4) 0.3.2.1-r1
       {aqua debug L10N="bs cs da de el es et fi fr ga gl hu it ja km lt mr nds nl pl pt pt-BR ro ru sk sl sv tr uk"}
     Installed versions:  0.3.2.1-r1(4)(01:13:13 12/07/16)(-aqua -debug L10N="pt-BR -bs -cs -da -de -el -es -et -fi -fr -ga -gl -hu -it -ja -km -lt -mr -nds -nl -pl -pt -ro -ru -sk -sl -sv -tr -uk")
     Homepage:            https://projects.kde.org/projects/playground/base/lightdm
     Description:         LightDM KDE greeter

[1] "local_overlay" /usr/local/portage

Found 3 matches


5. Edited lightdm.conf and lightdm-gtk-greeter.conf (I specified a nice background image file for the login screen):

Code:
# grep -v ^# /etc/lightdm/lightdm.conf
[LightDM]

session-wrapper=/etc/lightdm/Xsession
[Seat:*]
greeter-session=lightdm-gtk-greeter
session-wrapper=/etc/lightdm/Xsession
display-setup-script=/etc/X11/Sessions/plasma

[XDMCPServer]

[VNCServer]

Code:
# grep -v ^# /etc/lightdm/lightdm-gtk-greeter.conf
[greeter]
background=/usr/share/wallpapers/larry-the-cow/gentoo-cow-gdm-remake-1920x1080.png
indicators=~language;~power


The only reason I had to create and specify the file /etc/X11/Sessions/plasma is because my laptop has an NVIDIA GPU (Optimus hardware):

Code:
# cat /etc/X11/Sessions/plasma
#!/bin/bash
GPU=`eselect opengl list | grep \* | awk '{ print $2 }'`
if [ "$GPU" = "nvidia" ]; then
    xrandr --setprovideroutputsource modesetting NVIDIA-0
    xrandr --auto
fi


By specifying "~power" as one of the indicators, a pull-down Power menu is displayed on the GTK Greeter screen with the options: Suspend; Hibernate; Restart; Shutdown. They all work. If I reinstall lightdm-1.18.3 from the main Portage tree (i.e. without my patch applied) then Suspend and Hibernate are greyed out. With my patch applied, they are not greyed-out, and I can suspend and hibernate the laptop.

By the way, I did not have to add or change any files in any of the /etc/polkit-1/ sub-directories:

Code:
# ls -1 /etc/polkit-1/localauthority/*
/etc/polkit-1/localauthority/10-vendor.d:
10-org.freedesktop.upower.pkla
20-org.freedesktop.consolekit.system.stop-multiple-users.pkla
30-org.freedesktop.consolekit.system.restart-multiple-users.pkla
40-org.freedesktop.consolekit.system.suspend-multiple-users.pkla
50-org.freedesktop.consolekit.system.hibernate-multiple-users.pkla

/etc/polkit-1/localauthority/20-org.d:

/etc/polkit-1/localauthority/30-site.d:

/etc/polkit-1/localauthority/50-local.d:

/etc/polkit-1/localauthority/90-mandatory.d:
# ls -1 /etc/polkit-1/rules.d/
49-polkit-pkla-compat.rules
50-default.rules


So, there you have it. A patched lightdm-1.18.3 plus lightdm-gtk-greeter-2.0.1-r1 allow you to suspend, hibernate, restart and shutdown from the LightDM login screen.

Of course, the LightDM KDE Greeter is still fine to use if you are not bothered about being able to suspend and hibernate from the login screen. If you don't like the greyed-out Suspend button then you can edit /usr/share/apps/lightdm-kde-greeter/themes/classic/main.qml to hide it, as explained in my previous post.

EDIT: I have now filed a bug report regarding this fix for LightDM: Gentoo Bug Report No. 605370 - >=x11-misc/lightdm-1.18.3: Suspend/Hibernate not available on login screen of non-systemd installations.
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum