3

At some point, in the past, I must have disabled lightdm service with:

systemctl disable lightdm.service

or something similar on my Debian with Cinnamon desktop.

Unfortunately, I will now need it, but running:

systemctl start lightdm.service

every time the computer boots up does not make me happy, so...

How do I re-enable the lightdm service? Because just running:

systemctl enable lightdm.service

yields to the following error:

Synchronizing state of lightdm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable lightdm
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.

Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

Also tried before:

dpkg-reconfigure lightdm

to no avail.

4 Answers4

4

Enabling the lightdm.service unit does nothing for the reason given in the message that is right in front of you: the service unit has no [Install] information. This is because one is supposed not to enable this service with systemctl enable. Display managers have their own idiosyncratic enable/disable mechanism.

This service is one of the possible stand-ins for display-manager.service, which is a hook for whatever display manager one chooses to run. display-manager.service is a symbolic link that is intended to point to whatever the actual display manager service unit file is, as the systemd user manual states. It is a fixed and hardwired Wants in the graphical.target unit, the idea being that if one starts up with graphical.target as the start point of the service graph, one's chosen display manager is started by dint of that.

This symbolic link is of course an ideal opportunity for employing Debian's "alternatives" system. Switching amongst display managers could be a simple and consistent across all packages matter of running:

update-alternatives --config display-manager.service

This is indeed how it is done on OpenSUSE, albeit that it is not switching a systemd unit around:

update-alternatives --config default-displaymanager

So of course the "alternatives" system is not used here; the switching between the possibilities instead being managed by bespoke code in the package maintainer scripts for the lightdm, gdm3, xdm, and other packages that reads an idiosyncratic /etc/X11/default-display-manager file, and does not quite do the same thing in each package.

Once one has run one of these different pieces of bespoke shell scripting, via dpkg-reconfigure, one also has to ensure that the start point at bootstrap is the graphical.target unit and not the multi-user.target unit, with systemctl set-default.

JdeBP
  • 68,745
3

It looks like your service is masked.


To unmask it, run:

systemctl unmask lightdm.service

and afterwards, run:

systemctl daemon-reload
D'Arcy Nader
  • 1,868
  • On Debian, the right answer deals in the contents of /etc/X11/default-display-manager and the display-manager.service service. – JdeBP Jan 13 '20 at 08:30
  • 1
    @JdeBP cat /etc/X11/default-display-manager = /usr/sbin/lightdm, so I think I'm good here, tried running dpkg-reconfigure lightdm before but with no results, if you mean that... – Vlastimil Burián Jan 13 '20 at 08:33
0

Lightdm manged by sysV init style startup scripts (debian 8 - 11) via symbolic links at /etc/rc*.d/

(systemd just call it via systemd-sysv-generator)

update-rc.d lightdm defaults

0

Try to temporary install an alternative Display Manager like sddm and then switch back to lightdm. Tested on Xubuntu 22.04.3 LTS.

sudo apt install sddm # Select sddm
sudo dpkg-reconfigure sddm # Switch back to lightdm
sudo reboot
sudo systemctl status lightdm.service # After reboot, should be active

Other usefull commands to debug :

ls -rtla /var/log/lightdm # see logs files
less +G /var/log/lightdm/lightdm.log # see from the end
lightdm --test-mode --debug # test
pushStack
  • 101