4

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.

0

5 Answers 5

5

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.

1
  • 2
    update-alternatives: error: no alternatives for display-manager.service Commented Dec 9, 2020 at 10:09
4

It looks like your service is masked.


To unmask it, run:

systemctl unmask lightdm.service 

and afterwards, run:

systemctl daemon-reload 
2
  • On Debian, the right answer deals in the contents of /etc/X11/default-display-manager and the display-manager.service service. Commented Jan 13, 2020 at 8: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... Commented Jan 13, 2020 at 8:33
1

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

1

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 
-1

Usually a systemctl set-default graphical.target is sufficient to automagically trigger the display manager start on boot.

2
  • How will this solve the issue if I masked the lightdm service? As pointed out in accepted answer... Commented Sep 24 at 9:26
  • The question doesn't tell anything about a masked service and it is unlikely, that someone actually masks it by hand (if so, it should know, that this has been done). Root cause in most cases is actually, that the default target (graphical.target) got replaced by multi-user.target! Try systemctl set-default multi-user.target and reboot: you'll see, that the answer is correct (may be your ??? system even masks the lightdm again - shouldn't but some distros do strange things ...). Commented Sep 24 at 13:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.