4

I am working with Ubuntu MATE (16.04) on a Raspberry Pi 3. I disabled LightDM with

sudo systemctl disable lightdm

On the next boot LightDM did not show up again and instead I just got a terminal asking me for my credentials, what was exactly what I wanted. When I am log in and type

startx

the grapical sessions shows up, so far so good.

Now I want to get LightDM back after boot and so I tried reenabling it with

sudo systemctl enable lightdm

The output is:

Synchronizing state of lightdm.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable lightdm

But when I now reboot my system, LightDM does not show up again. What went wrong?

In addition to that, when I just log in in terminal and type

sudo systemctl start lightdm

LightDM is started normally, i.e. the graphical session is started and the login screen is shown. How can I get LightDM started automatically after boot again?

  • You could write the command that works in a script and have it auto run on start. – Owen Hines Oct 6 '16 at 22:17
  • Thanks for your fast answer. That should work, but I find this solution kind of nasty. And I want to know why ''sudo systemctl enable lightdm' does not do the job... – NewOne Oct 6 '16 at 22:21
5

An enabled service should have a symlink to the unit file in /lib/systemd/system in /etc/systemd/system. The systemctl enable command should create that symlink, but in this case it fails for some reason. The correct symlink is:

$ ll /etc/systemd/system/display-manager.service
lrwxrwxrwx 1 root root 35 okt  7 00:20 /etc/systemd/system/display-manager.service -> /lib/systemd/system/lightdm.service

You can fix it by recreating the symlink yourself:

sudo ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service

Tested in Ubuntu MATE 16.04.

  • Thanks for sharing that, @Zanna. Please feel free to edit the answer. – Gunnar Hjalmarsson Oct 7 '16 at 17:19
  • Thanks, this solved the problem. When creating the symlink as you described, LightDM is automatically started after boot again. Is it a bug that systemctl enable does not create the symlink ? – NewOne Oct 7 '16 at 18:26
  • @NewOne: Don't know if it's a bug. From "man systemctl" about "enable": "This command expects either valid unit names (in which case various unit file directories are automatically searched for unit files with appropriate names), or absolute paths to unit files (in which case these files are read directly). If a specified unit file is located outside of the usual unit file directories, an additional symlink is created, linking it into the unit configuration path, thus ensuring it is found when requested by commands such as start." – Gunnar Hjalmarsson Oct 7 '16 at 18:36
1

Reconfiguring LightDM worked for me (xubuntu 18.04):

sudo dpkg-reconfigure lightdm
  • Works for Ubuntu MATE 18.04. – Berkant Jul 18 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.