[systemd-devel] GDM service file for Debian (was: systemd unit files for Debian based systems)

Paul Menzel paulepanter at users.sourceforge.net
Sat Jun 23 05:43:38 PDT 2012


Am Freitag, den 22.06.2012, 15:35 +0100 schrieb Léo Gillot-Lamure:
> Simple suggestion : GDM takes a name on the bus, so you can reliably
> know when the service has finished to start. The service file used in
> Gentoo adds a line "BusName=org.gnome.DisplayManager" in the [Service]
> section to achieve that.

Thanks. Gentoo’s service file looks like this [1]

1       [Unit]
2       Description=GNOME Display Manager
3       After=systemd-user-sessions.service
4       
5       [Service]
6       ExecStart=/usr/bin/gdm --nodaemon
7       Type=dbus
8       BusName=org.gnome.DisplayManager
9       
10      [Install]
11      WantedBy=graphical.target

and here again Arch Linux’ for comparison.

    $ more service/gdm.service 
    [Unit]
    Description=Gnome Display Manager
    After=systemd-user-sessions.service

    [Service]
    ExecStart=/usr/sbin/gdm -nodaemon

    [Install]
    WantedBy=graphical.target

So Lennart, which one would you prefer?

Adapting the path to `/usr/sbin/gdm3` in Gentoo’s one and saving it
under `/lib/systemd/service/gdm3.service` it works under Debian after
`sudo systemctl enable gdm3.service`.

Although reading Jordi’s post [2],

        As we get many questions regarding the status of GDM in Debian,
        let's add a short note on this. Packaging GDM, at least in its
        current upstream form, is not a matter of unpacking a new
        tarball and editing debian/changelog. When Joss works on a new
        major version, the amount of tweaking to break away from stuff
        that works on other distros but is not so simple in Debian is
        outstanding (see, for example, the current unfinished work for
        GDM 3.2 in our SVN repo). In our case, to handle our GDM
        defaults, we even need changes to the underlying configuration
        system, dconf. This evidently takes some effort to do, and
        unfortunately our GDM expert has had little time for Debian
        lately, but we're confident we'll end up with a GDM in wheezy
        that is on par with Debian standards.

and looking at Debian’s GDM init.d script [2]

1	#! /bin/sh
2	### BEGIN INIT INFO
3	# Provides:          gdm3
4	# Should-Start:      console-screen dbus network-manager
5	# Required-Start:    $local_fs $remote_fs
6	# Required-Stop:     $local_fs $remote_fs
7	# Default-Start:     2 3 4 5
8	# Default-Stop:      0 1 6
9	# Short-Description: GNOME Display Manager
10	# Description:       Debian init script for the GNOME Display Manager
11	### END INIT INFO
12	#
13	# Author:       Ryan Murray <rmurray at debian.org>
14	#
15	set -e
16	
17	PATH=/sbin:/bin:/usr/sbin:/usr/bin
18	DAEMON=/usr/sbin/gdm3
19	
20	test -x $DAEMON || exit 0
21	
22	if [ -r /etc/default/locale ]; then
23	  . /etc/default/locale
24	  export LANG LANGUAGE
25	fi
26	
27	. /lib/lsb/init-functions
28	
29	# To start gdm even if it is not the default display manager, change
30	# HEED_DEFAULT_DISPLAY_MANAGER to "false."
31	HEED_DEFAULT_DISPLAY_MANAGER=true
32	DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
33	
34	gen_config() {
35	  # GSettings configuration uses dconf update to generate a gdm profile
36	  if [ -d /var/lib/gdm3 ]; then
37	    needed=no
38	    if [ -f /var/lib/gdm3/dconf/db/gdm ]; then
39	      for f in \
40	          /usr/share/gdm/dconf /usr/share/gdm/dconf/*-settings \
41	          /usr/share/gdm/dconf/locks /usr/share/gdm/dconf/locks/*-locks \
42	          /etc/gdm3/greeter.gsettings; do
43	        if [ "$f" -nt /var/lib/gdm3/dconf/db/gdm ]; then
44	          needed=yes
45	          break
46	        fi
47	      done
48	    else
49	      needed=yes
50	    fi
51	    if [ "$needed" = yes ]; then
52	      rm -rf /var/lib/gdm3/dconf
53	      mkdir -p /var/lib/gdm3/dconf/profile /var/lib/gdm3/dconf/db/gdm.d/locks
54	      ln -s /usr/share/gdm/dconf-profile /var/lib/gdm3/dconf/profile/gdm
55	      ln -s /usr/share/gdm/dconf/*-settings /var/lib/gdm3/dconf/db/gdm.d/
56	      ln -s /usr/share/gdm/dconf/locks/*-locks /var/lib/gdm3/dconf/db/gdm.d/locks/
57	      # The configuration file in /etc uses org.gnome.blah gsettings syntax.
58	      # Convert it to org/gnome/blah dconf syntax.
59	      awk '/\[.*\]/ { gsub("\\.","/"); } ! /^#/ { print;}' \
60	        /etc/gdm3/greeter.gsettings > /var/lib/gdm3/dconf/db/gdm.d/90-debian-settings
61	      dconf update /var/lib/gdm3/dconf/db 2> /dev/null
62	    fi
63	  fi
64	}
65	
66	case "$1" in
67	  start)
68	        CONFIGURED_DAEMON=$(basename "$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2> /dev/null)")
69	        if grep -wqs text /proc/cmdline; then
70	            log_warning_msg "Not starting GNOME Display Manager; found 'text' in kernel commandline."
71	        elif [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ] && \
72	           [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] && \
73	           [ "$CONFIGURED_DAEMON" != gdm3 ] ; then
74	                log_action_msg "Not starting GNOME Display Manager; it is not the default display manager"
75	        else
76	                log_daemon_msg "Starting GNOME Display Manager" "gdm3"
77	                gen_config
78	                rm -f /var/lib/gdm/.ICEauthority
79	                start-stop-daemon --start --quiet --pidfile /var/run/gdm3.pid \
80	                        --background --exec $DAEMON || log_end_msg 1
81	                log_end_msg 0
82	        fi
83	  ;;
84	  stop)
85	        log_daemon_msg "Stopping GNOME Display Manager" "gdm3"
86	        set +e
87	        start-stop-daemon --stop --quiet --pidfile /var/run/gdm3.pid \
88	                --name gdm3 --retry 5
89	        set -e
90	        log_end_msg $?
91	  ;;
92	  reload)
93	        log_daemon_msg "Scheduling reload of GNOME Display Manager configuration" "gdm3"
94	        set +e
95	        gen_config
96	        start-stop-daemon --stop --signal USR1 --quiet --pidfile \
97	                /var/run/gdm3.pid --name gdm3
98	        start-stop-daemon --stop --signal HUP --quiet --name dconf-service \
99	                --user Debian-gdm --oknodo
100	        set -e
101	        log_end_msg $?
102	  ;;
103	  status)
104	        status_of_proc -p "$PIDFILE" "$DAEMON" gdm3 && exit 0 || exit $?
105	  ;;
106	  restart|force-reload)
107	        $0 stop
108	        $0 start
109	  ;;
110	  *)
111	        echo "Usage: /etc/init.d/gdm3 {start|stop|restart|reload|force-reload|status}"
112	        exit 1
113	  ;;
114	esac
115	
116	exit 0

there seems to be a chance the above service file might break under
Debian.

As a last note, looking at `systemd-analyze blame` it looks like
starting GDM 3 using the service file takes longer (188 ms) than when
systemd is using the shipped init.d script (90 ms to 120 ms).


Thanks,

Paul


[1] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/gnome-base/gdm/files/3.2.1.1/gdm.service?revision=1.1&view=markup 
[2] http://oskuro.net/blog/freesoftware/gnome-3.4-wheezy-2012-06-03-09-47
[3] http://anonscm.debian.org/viewvc/pkg-gnome/desktop/unstable/gdm3/debian/gdm3.init?revision=35286&view=markup
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20120623/725d6057/attachment.pgp>


More information about the systemd-devel mailing list