Bug#754314: systemd support for kdm
Source: kde-workspace
Severity: wishlist
Tags: patch
Hi KDE maintainers,
the attached patch adds systemd support to KDM. It's working well for
me, but some things are still up for discussion/need work.
Some notes:
consolekit:
-----------
This patch disables consolekit support (this part of the change
can be avoid by removing the hunks which remove the dep on
consolekit and the build-dep on libck-connector-dev. I'm not
sure on the usability of KDE on kfreebsd/hurd. These deps should
likely be kept for kfreebsd-any and hurd. There was a discussion
on debian-devel which stated that the systemd maintainers have
come up with a plan to ensure systemd is pid 1 for updated
and newly installed Linux systems. Unless that comes up it
additionally
needs a dependency on systemd-sysv.
Why did I disable consolekit? First of all, kdm with systemd/pid1
as currently in the archive has been quite unrealiable for me
with the KDM login failing with error messages like
service 'org.freedesktop.ConsoleKit': timed out
Jun 27 18:26:59 chartreuse kdm: :0[1362]: Cannot open ConsoleKit
session: Unable to open session: 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.
Or the following error messages from the consolekit service:
console-kit-daemon.service - Console Manager
Loaded: loaded (/lib/systemd/system/console-kit-daemon.service;
enabled)
Active: failed (Result: timeout) since Di 2014-06-10 18:01:25
CEST;
2min 44s ago
Main PID: 792
CGroup: name=systemd:/system/console-kit-daemon.service
Jun 10 18:00:30 chartreuse console-kit-daemon[792]: (process:995):
GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0'
failed
Jun 10 18:00:30 chartreuse console-kit-daemon[792]: missing action
Jun 10 18:00:54 chartreuse console-kit-daemon[792]: WARNING:
polkit_authority_get: Error getting authority: Error initializing
authority: Error calling StartServiceByName for
org.freedesktop.PolicyKit1:
GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Activation of
org.freedesktop.PolicyKit1 timed out
Jun 10 18:00:54 chartreuse console-kit-daemon[792]:
console-kit-daemon[792]: WARNING: polkit_authority_get: Error
getting
authority: Error initializing authority: Error calling
StartServiceByName for org.freedesktop.PolicyKit1:
GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Activation of
org.freedesktop.PolicyKit1 timed out
Jun 10 18:01:25 chartreuse systemd[1]: console-kit-daemon.service
operation timed out. Terminating.
Jun 10 18:01:25 chartreuse systemd[1]: Failed to start Console
Manager.
Jun 10 18:01:25 chartreuse systemd[1]: Unit
console-kit-daemon.service
entered failed state.
Without consolekit enabled everything works fine for me.
I found an upstream discussion started by one of the Kubuntu people (who
have also disabled consolekit) which also recommends to disable it:
http://article.gmane.org/gmane.comp.kde.devel.core/82597
http://article.gmane.org/gmane.comp.kde.devel.core/82598
http://article.gmane.org/gmane.comp.kde.devel.core/82601
http://article.gmane.org/gmane.comp.kde.devel.core/82610
https://bugs.launchpad.net/ubuntu/+source/kde-workspace/+bug/1281036
KDM conffile customisation
----------------------
The sysvinit script has customisation code which generates the
kdmrc at runtime based on /etc/kde4/kdm/kdmrc. I've moved this
code to a separate script, the init.d script should be adapted
to share the same script.
activation of the service
-------------------------
After installation of the updated package the service isn't enabled
by default. You'll need to run "systemctl enable kdm.service" for
that. I'm not sure how the default display manager is handled if
several systemd units are installed, so it's probably for the best
right now.
Cheers,
Moritz
diff -Naur kde-workspace-4.11.9.orig/debian/control kde-workspace-4.11.9/debian/control
--- kde-workspace-4.11.9.orig/debian/control 2014-05-14 19:17:33.000000000 +0200
+++ kde-workspace-4.11.9/debian/control 2014-07-07 18:57:44.128546659 +0200
@@ -16,7 +16,6 @@
kdepimlibs5-dev (>= 4:4.11),
libakonadi-dev (>= 1.1.95),
libboost-dev (>= 1.34),
- libck-connector-dev,
libdbus-1-dev,
libdbusmenu-qt-dev (>= 0.6.0),
libdevstat-dev [kfreebsd-any],
@@ -27,6 +26,7 @@
libglu1-mesa-dev,
libgps-dev (>= 2.90),
libjpeg-dev,
+ dh-systemd,
libkactivities-dev (>= 4:4.11),
libnm-util-dev (>= 0.9) [linux-any],
libpam0g-dev,
@@ -349,7 +349,6 @@
Section: x11
Architecture: any
Depends: adduser,
- consolekit,
debconf | debconf-2.0,
kde-wallpapers-default,
kde-workspace-kgreet-plugins (= ${binary:Version}),
diff -Naur kde-workspace-4.11.9.orig/debian/kdm-debian-setup-config kde-workspace-4.11.9/debian/kdm-debian-setup-config
--- kde-workspace-4.11.9.orig/debian/kdm-debian-setup-config 1970-01-01 01:00:00.000000000 +0100
+++ kde-workspace-4.11.9/debian/kdm-debian-setup-config 2014-07-07 19:12:08.856834615 +0200
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+# parameters to support kdm customization
+KDMRC=/etc/kde4/kdm/kdmrc
+BACKGROUNDRC=/etc/kde4/kdm/backgroundrc
+
+# if configuration is changed by kdmtheme or other tools, don't do magick
+if grep -q "^[[:space:]]*Theme=@@@ToBeReplacedByDesktopBase@@@" ${KDMRC}; then
+
+ KDMOVERRIDEDIR=/etc/default/kdm.d
+ KDMCFGDIR=/var/run/kdm
+ KDMCFG=$KDMCFGDIR/kdmrc
+ BACKGROUNDCFG=$KDMCFGDIR/backgroundrc
+ DEFAULT_KDM_THEME=/usr/share/kde4/apps/kdm/themes/elarun
+
+ # we use an alternative kdm master configuration file
+ ARG="$ARG -config $KDMCFG"
+
+ # we generate kdm configuration files
+ genkdmconf --in $KDMCFGDIR 1> /dev/null
+
+ # we source overrides. run-parts sorts the list in a predictable order
+ if [ -d "$KDMOVERRIDEDIR" ]; then
+ for part in $(run-parts --list "$KDMOVERRIDEDIR" 2>/dev/null || true); do
+ . "$part"
+ done
+ fi
+
+ # we update kdm configuration files (only overridden values)
+ [ -n "$USEBACKGROUND" ] && sed -i "s|^#\?UseBackground=.*|UseBackground=$USEBACKGROUND|" $KDMCFG
+ [ -n "$BACKGROUNDCFG" ] && sed -i "s|^#\?BackgroundCfg=.*|BackgroundCfg=$BACKGROUNDCFG|" $KDMCFG
+ [ -n "$USETHEME" ] && sed -i "s|^#\?UseTheme=.*|UseTheme=$USETHEME|" $KDMCFG
+ [ -n "$THEME" ] && [ -e "$THEME" ] && sed -i "s|^#\?Theme=.*|Theme=$THEME|" $KDMCFG
+ [ -n "$LANGUAGE" ] && sed -i "s|^#\?Language=.*|Language=$LANGUAGE|" $KDMCFG
+
+ if grep -q "^[[:space:]]*Wallpaper=stripes.png" ${BACKGROUNDRC}; then
+ [ -n "$WALLPAPER" ] && [ -e "$WALLPAPER" ] && sed -i "s|^#\?Wallpaper=.*|Wallpaper=`readlink -f $WALLPAPER`|" $BACKGROUNDCFG
+ fi
+
+ # usetheme is now on "by default" so we need to be sure Theme is not invalid ...
+ sed -i "s|@@@ToBeReplacedByDesktopBase@@@|$DEFAULT_KDM_THEME|" ${KDMCFG}
+
+ # autologin overrides are useful for live debian environment
+ if [ -n "$AUTOLOGINUSER" ]; then
+ sed -i "s|^#\?AutoLoginEnable=.*|AutoLoginEnable=true|" $KDMCFG
+ sed -i "s|^#\?AutoLoginUser=.*|AutoLoginUser=$AUTOLOGINUSER|" $KDMCFG
+ fi
+ [ -n "$AUTOLOGINDELAY" ] && sed -i "s|^#\?AutoLoginDelay=.*|AutoLoginDelay=$AUTOLOGINDELAY|" $KDMCFG
+ [ -n "$AUTOLOGINAGAIN" ] && sed -i "s|^#\?AutoLoginAgain=.*|AutoLoginAgain=$AUTOLOGINAGAIN|" $KDMCFG
+ [ -n "$AUTOLOGINLOCKED" ] && sed -i "s|^#\?AutoLoginLocked=.*|AutoLoginLocked=$AUTOLOGINLOCKED|" $KDMCFG
+fi
+
+exit 0
diff -Naur kde-workspace-4.11.9.orig/debian/kdm.install kde-workspace-4.11.9/debian/kdm.install
--- kde-workspace-4.11.9.orig/debian/kdm.install 2014-05-14 19:17:33.000000000 +0200
+++ kde-workspace-4.11.9/debian/kdm.install 2014-07-07 19:13:28.365228876 +0200
@@ -171,3 +171,4 @@
usr/share/kde4/config/kdm.knsrc
usr/share/kde4/services/kdm.desktop
usr/share/polkit-1/actions/org.kde.kcontrol.kcmkdm.policy
+debian/kdm-debian-setup-config /usr/sbin
\ Kein Zeilenumbruch am Dateiende.
diff -Naur kde-workspace-4.11.9.orig/debian/kdm.service kde-workspace-4.11.9/debian/kdm.service
--- kde-workspace-4.11.9.orig/debian/kdm.service 1970-01-01 01:00:00.000000000 +0100
+++ kde-workspace-4.11.9/debian/kdm.service 2014-07-07 18:58:25.216750405 +0200
@@ -0,0 +1,13 @@
+[Unit]
+Description=KDM Display Manager
+Conflicts=getty@tty1.service
+After=systemd-user-sessions.service getty@tty1.service plymouth-quit.service
+
+[Service]
+ExecStartPre=/usr/sbin/kdm-debian-setup-config
+ExecStart=/usr/bin/kdm -nodaemon -config /var/run/kdm/kdmrc
+Restart=always
+IgnoreSIGPIPE=no
+
+[Install]
+Alias=display-manager.service
diff -Naur kde-workspace-4.11.9.orig/debian/rules kde-workspace-4.11.9/debian/rules
--- kde-workspace-4.11.9.orig/debian/rules 2014-05-14 19:17:33.000000000 +0200
+++ kde-workspace-4.11.9/debian/rules 2014-07-07 18:57:44.136546699 +0200
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
-dh = --with=python2
+dh = --with=python2,systemd
include /usr/share/pkg-kde-tools/qt-kde-team/2/debian-qt-kde.mk
libpkgs_addsubst_allLibraries = kde-workspace-dev
Reply to: