#950393 Improve handling of display-manager.service symlink

Package:
xdm
Source:
xdm
Description:
X display manager
Submitter:
Andrei POPESCU
Date:
2026-10-08 19:37:43 UTC
Severity:
normal
#950393#3
Date:
2014-10-09 14:55:18 UTC
From:
To:
Hi,

# systemctl disable lightdm
Synchronizing state for lightdm.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d lightdm defaults
Executing /usr/sbin/update-rc.d lightdm disable
insserv: warning: current start runlevel(s) (empty) of script `lightdm' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `lightdm' overrides LSB defaults (0 1 6).
Removed symlink /etc/systemd/system/display-manager.service.
# systemctl enable lightdm
Synchronizing state for lightdm.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d lightdm defaults
insserv: warning: current start runlevel(s) (empty) of script `lightdm' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `lightdm' overrides LSB defaults (0 1 6).
Executing /usr/sbin/update-rc.d lightdm enable
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).


I have to run 'dpkg-reconfigure lightdm' to have lightdm's postinst
recreate the display-manager.service symlink, which is not obvious.


Kind regards,
Andrei

#950393#6
Date:
2014-10-09 21:10:18 UTC
From:
To:
Actually that wasn't enough to re-enable lightdm, in the end I had to
resorte to 'dpkg --purge --force-depends' and then install again.

Kind regards,
Andrei

#950393#9
Date:
2014-11-22 20:28:32 UTC
From:
To:
Given also the recent lxdm bug I've been giving this issue more thought
and here's what I came up with:

1. Keep the current ExecStartPre= hack until systemd has better support
for this use case[*].

2a. Each display manager must add a WantedBy=graphical.target

2b. Each display manager must add a Conflicts=[all other DMs]

If I'm not mistaken this will ensure that at least one display manager
is started (because of the WantedBy=), and only one can run at any given
time (because of the Conflicts=). Which one would actually start would
still be controlled via /etc/X11/default-display-manager, same as
before.

systemctl/update-rc.d enable/disable should then Just Work(tm).

If you think the above makes sense I can start testing it with all
display managers currently handling the display-manager.service symlink.

[*] See #770633 for a possible implementation of this use case

Kind regards,
Andrei

#950393#14
Date:
2014-11-24 08:23:22 UTC
From:
To:
Le 22/11/2014 21:28, Andrei POPESCU a écrit :

You don't really need to maintain a long list of Conflicts (which will
never be kept up to date). I suggested last wek to the gdm maintainers
that we start using the Alias. That enables to have only one DM enable
at a time, having systemctl creating the symlink and conflicting when
needed. Finally, the postinst maintainer script is easier. Then, you
don't really need WantedBy=graphical.target I guess.


I didn't hear from the gdm3-pkg team yet, let me paste my suggestions:
--------------- We discussed a little bit today with Martin on providing other display managers like xdm with systemd services. I looked at the existing postinst of lightdm and I think we can leverage systemd Alias to keep the exact same functionality, but removing the internal systemd knowledge from the postinst scripts. The end result on disk would be exactly the same than the existing implementation, we just remove the manual handling of symlinks. The idea is to add: [Install] Alias=display-manager.service to the service unit, and then, replacing the existing postinst symlinks dance with only systemctl commands. Here is the commit for lightdm: http://bazaar.launchpad.net/~didrocks/lightdm/systemd-alias/revision/2099, resulting in a simpler postinst: http://bazaar.launchpad.net/~didrocks/lightdm/systemd-alias/view/head:/debian/lightdm.postinst#L72 Martin agrees that this approach is more decouple from systemd internals and I'm here to reach your feedback about it. As the result on disk is the same in the end, we don't have to migrate all DMs at the same time if you agree with that idea. I've prepared in case you are in favor of this change a gdm3 debdiif (attached), I saw that upstream was shipping for gdm the Alias section, so modified the patch + postinst for it.
--------- Does it make sense to you?
#950393#19
Date:
2014-11-24 12:37:59 UTC
From:
To:
Here is an updated version of the patch (ensuring we echo a warning if
systemctl enable fails) after discussing with Laurent.

There seems to be one case failing due to the autogenerated gdm3 service
script from the LSB version which is making systemctl enable --force
gdm3 failing, investigating.

Cheers,
Didier

#950393#24
Date:
2015-09-30 21:45:18 UTC
From:
To:
Right, this is not a bug in systemd, but in the involved display managers.

They should use dh-systemd --no-enable and add the [Install] section
Didier posted.

Anyone up for checking the existing display manager service file and
file bug reports accordingly.?


Michael

#950393#29
Date:
2017-02-20 10:21:48 UTC
From:
To:
¡Hola!

El 2014-11-24 a las 13:37 +0100, Didier Roche escribió:
 if ! systemctl enable --force $SERVICE 2>/dev/null;

As written it should always fail.

Please note that this snippet only works on systems that have a running
systemd, thus it may fail when installing it in using debbootstrap, the
debian installer, using a chroot, etc.

If possible, please tells us what have you tested. I'm also unsure of what
would systemd do if you are replacing a running display-manager.service, we
don't systemd to stop the running display-manager (as that's probably being
used).

I see that the set of strings used by gdm sddm and lightdm are different. We
should also sync those.

Happy hacking,

#950393#34
Date:
2020-02-01 02:21:14 UTC
From:
To:
Control: retitle -1 Improve handling of display-manager.service symlink
Control: clone -1 -2 -3 -4 -5 -6 -7
Control: reassign -1 gdm3
Control: reassign -2 lightdm
Control: reassign -3 sddm
Control: reassign -4 lxdm
Control: reassign -5 xdm
Control: reassign -6 slim
Control: reassign -7 wdm


I think, the proper solution is, that gdm, lightdm etc
drop this bit from their service file (in case they have added this
previously)

ExecStartPre=/bin/sh -c '[ "$(cat /etc/X11/default-display-manager
2>/dev/null)" = "/usr/sbin/lightdm" ]'

This is not longer necessary, as all relevant x-display-managers ship a
.service file nowadays.

They should also add a

[Install]
Alias=display-manager.service

section

to their service file. Which will make sure that if you run
"systemctl enable foo.service", display-manager.service will point at
the desired display manager.

Cloning, reassigning this bug report.

Regards,
Michael

#950393#47
Date:
2026-10-08 19:34:58 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
xdm, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 950393@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Boyuan Yang <byang@debian.org> (supplier of updated xdm package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 08 Oct 2026 15:10:06 -0400
Source: xdm
Architecture: source
Version: 1:1.1.17-4
Distribution: unstable
Urgency: medium
Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
Changed-By: Boyuan Yang <byang@debian.org>
Closes: 655753 869773 909639 924793 948346 950393 1041768 1129528
Changes:
 xdm (1:1.1.17-4) unstable; urgency=medium
 .
   * debian/xdm.postinst.in: Use --pidfile for the running-daemon check.
     (Closes: #1041768, #924793)
   * debian/xdm.init:
     - Handle stop failures without exiting before checking the result;
       keep the pid file on timeout or command errors and return failure.
     - Set HOME=/root for the daemon and X server. (Closes: #1129528)
     - Honour the text kernel command-line option using the C locale for the
       whitespace match. (Closes: #655753)
   * debian/patches/22_systemd_service.diff: Use the display-manager.service
     alias and drop the obsolete default-display-manager pre-start check.
     Only auto-start the selected, unmasked service from postinst and
     postrm abort-upgrade.
     (Closes: #950393)
   * debian/patches/1001-do-not-log-unknown-usernames.patch: Hide login input
     that does not resolve to an account, retaining known usernames in failure
     logs. Adapt Julien Cristau's proposal with a NULL check before getpwnam.
     (Closes: #869773)
   * debian/xdm.logrotate: Use copytruncate instead of signalling xdm during
     startup; keep the log inode used by the daemon and its children.
     (Closes: #948346)
   * debian/xdm.README.Debian: Correct the configuration file descriptions
     and document service selection, text boots, recovery, empty passwords
     and log rotation. (Closes: #909639)
   * debian/control: Actually bump debhelper compat to 14 (the -3 changelog
     claimed this, but the dependency was still 13); drop automatically
     supplied relationship substvars.
   * debian/control, debian/rules: Explicitly require libxpm-dev and enable
     XPM logos instead of relying on an indirect build dependency.
   * debian/xdm.install: Use native debhelper environment substitution;
     remove the dh-exec shebang, executable bit and build dependency.
   * debian/watch: Convert to version 5 format.
Checksums-Sha1:
 debd867d3b95f7eabbe0170c679ae1ab5fa576b1 2632 xdm_1.1.17-4.dsc
 cd79d094a2002659fb2de5e8f94592783b23f391 425804 xdm_1.1.17.orig.tar.xz
 d12e07bca058b05b2e8f9625794ffd9d1098a7a1 60360 xdm_1.1.17-4.debian.tar.xz
 072d6c0b9d8b328dc0383e87fae45b7782885796 7667 xdm_1.1.17-4_amd64.buildinfo
Checksums-Sha256:
 a46495f7dd6a1017a12966a2c97ca4ca01b1a2c98d23a51320ac0f687dba7716 2632 xdm_1.1.17-4.dsc
 9494aef0911a031c53670725b5c8c9bb9d3f7c5ea7318b1f72ddd9dcbbeceb6a 425804 xdm_1.1.17.orig.tar.xz
 6268be57739d0252e68e584a224454fb09d8cafa1cc31c95d88ccf042599089b 60360 xdm_1.1.17-4.debian.tar.xz
 c13e235f92d23421f72c5bd4c2611cf958128e978d7eae02bacabba1ab186395 7667 xdm_1.1.17-4_amd64.buildinfo
Files:
 407d183385f5691e72e2e93dce364610 2632 x11 optional xdm_1.1.17-4.dsc
 e918d273f714098fb409457e37d328ce 425804 x11 optional xdm_1.1.17.orig.tar.xz
 acaa8bc9e321b88f6b1ff5603465ae66 60360 x11 optional xdm_1.1.17-4.debian.tar.xz
 18b305111970537dfe5de869a8532217 7667 x11 optional xdm_1.1.17-4_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfncpR22H1vEdkazLwpPntGGCWs4FAmrH648ACgkQwpPntGGC
Ws7Lrg//fsUKKGjn1/Vq9ZxmDLkBN4zZG7nxkUPDhcOvpPy1y5QLdbD0IdeWm9ee
YJLWF2yK3q23DRDfrB4OhY4k/Mg25Mh4hLGdVtSz0kOf9dKtUQpYdAvW1BCTA3eB
Y51lhaM1bnWwzV+hUJKaNwwcqR8LUSNyyLXWVnqgWQo7Y1tAGhnXR7Wzezw9OXER
1QuITADSp4ekQ27GPjigpDzhfjHKJyCSMwVoSRO/3de7CqVyj9s7tQEZ9dHGssQh
4V3JqeKIveBFP1m0ZEvqM9lT1Vi/EaB7+G2MKhM/mKReE7o+isvAZ5H8Jh8AEvpr
40OGXfba9OJRcySqnj8CcupEFjqv8zCUaJCzWXzDyHSlx2gG/pdUxDK7eU2VouRI
711QrGPuPO/96GQlZg/NLFTrumffi4uC6IwW4jnD03oJo6QfoFkxaKnsrQjMe0Ex
Q6mWr/cznlBmmUL9EvhGuQ5y/ZWFWOqMn5kkRwha7aoz/FgO1JGn5FXFrn67jOC8
KIawrnrqJt3Qo5gIjU8USVe/coT9fy2rtrg18wiOZzKLP+JbrLATihh39mqb3X1o
+ROW85vLaxjXbmSdbYohoZu3mIvwOto4vaBZV6kkgpW9YnxMURdkNAC6y3vKHZAQ
pMXmnQVWuwhHggKVnfZL3J8Snwa2UOdJmJA3WJl7nQbZa3IeXWg=
=yuit
-----END PGP SIGNATURE-----