On Mon, 5 Dec 2022 00:15:01 +0000 Simon McVittie <s...@debian.org> wrote: > On Sat, 03 Dec 2022 at 01:03:38 +0100, Samuel Thibault wrote: > > If gdm happens to manage to start quicker than console-setup, > > console-setup's setupcon call will fail. So we need a dependency between > > the two, to make console-setup start "Before" display managers. This can > > be set with > > > > Before=display-manager.service > > > > since display managers usually set this alias. But gdm3 apparently > > explicitly removes this with the debian/patches/92_systemd_unit.patch > > patch: > > > > * Don't install the display-manager.service alias, which is managed > > jointly by all Debian display managers via a debconf question > > Upstream gdm3.service (or possibly gdm.service, I think we do some renaming > for historical reasons) has > > [Install] > Alias=display-manager.service > > so that `systemctl enable gdm3.service` will create a symlink > /etc/systemd/system/display-manager.service -> /lib/systemd/system/gdm3.service. > This assumes that only one display manager can be enabled at a time, and > preferably only one *installed* at a time: if both gdm3 and lightdm try > to do that, if I understand correctly, the result will be unpredictable. > > In Debian, instead of gdm3.service having that, the debconf question > creates that symlink programmatically if and only if gdm3 is the selected > display manager (in particular, the symlink isn't created if you have > installed both gdm3 and lightdm, and chosen to use lightdm instead).
The same can be achieved by using the Alias mechanism. Simply run 'systemctl enable <selected>.service' instead of creating the symlink manually. The problem with manually creating things in maintainer scripts is that this is not compatible with building image-based systems with usr-only and ephemeral/first-boot etc. With an alias in the unit, the preset runs on first boot and re-creates it if needed, for any unit, for any purpose. Without an alias, a bespoke workaround needs to be added explicitly for this unit. Please consider switching the postinst to use this mechanism instead.