[SOLVED] systemd, masked services, and disabling lightdm

Kernels & Hardware, configuring network, installing services

[SOLVED] systemd, masked services, and disabling lightdm

Postby MartinK » 2015-05-14 22:23

Hello all, my first time here.

Today I upgraded from Wheezy to Jessie. I cannot stop lightdm from loading at system boot.

My Wheezy setup was boot to a console login prompt, login, startx to go to Openbox plus tint2. Under Wheezy I had disabled lightdm and chosen Openbox as my x-session-manager instead of LXDE. After upgrade to Jessie lightdm had been re-enabled.

To disable lightdm I ran;

systemctl disable lightdm.service

which did not stop lightdm loading at boot. A bug report (#769796) suggested I also run;

systemctl disable display-manager.service

which did not stop lightdm loading either. Using "systemctl status" I noticed that these services had a status of "static". A bit of futher reading told me that "static" services cannot be disabled but they can be "masked" to render them impossible to start. I therefore executed;

systemctl mask display-manager.service
systemctl mask lightdm.service

You know what's coming, lightdm still started at system boot. Even more confusing, if I manually stop lightdm from within X, to get myself back to the console, I can still manually start lightdm, even though systemctl says the service is masked, and the systemd documentation I have looked at says a masked service cannot be started.

Can anybody explain the symptoms I am seeing? I simply want to login without a GUI, while the display manager is installed on the system, as I did under Wheezy.

Regards,
Martin.
Last edited by MartinK on 2015-05-15 20:55, edited 1 time in total.
MartinK
 
Posts: 25
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: systemd, masked services, and disabling lightdm

Postby Head_on_a_Stick » 2015-05-15 06:40

What is the output of:
Code: Select all
ls -l /etc/systemd/system/display-manager.service
ls -l /lib/systemd/system/lightdm.service

I have encountered this before with GDM -- I think you just have to symlink /lib/systemd/system/lightdm.service to /dev/null manually (which is what `mask` is supposed to do but doesn't for some reason), but let's see the command output first.

This appears to be a Debian-specific bug (related to Debian's use of /etc/alternatives) rather than a systemd-specific one as my Arch system does not exhibit this behavior with display-manager.service

EDIT: Of course the simplest "solution" is to `apt-get purge lightdm` but that is less than ideal...
Don't break DebianHow to report bugs

SharpBang GNU/Linux — a pre-configured Openbox/Tint2 desktop running on Debian stable
User avatar
Head_on_a_Stick
 
Posts: 10600
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: systemd, masked services, and disabling lightdm

Postby MartinK » 2015-05-15 08:03

Head_on_a_stick, you have saved my sanity.

Yes, I could have removed the lightdm package but I considered that a workaround, not a solution.

The commands you offered revealed;

Code: Select all
lrwxrwxrwx 1 root root 9 May 14 20:41 /etc/systemd/system/display-manager.service -> /dev/null


as expected, but

Code: Select all
-rw-r--r-- 1 root root 412 Sep 15  2014 /lib/systemd/system/lightdm.service


looks like the culprit! For completness I also ran

Code: Select all
ls -l /etc/systemd/system/lightdm.service

lrwxrwxrwx 1 root root 9 May 14 20:49 /etc/systemd/system/lightdm.service -> /dev/null


I have not yet manually created a symlink to /dev/null for lightdm in /lib/systemd/system as I am guessing a future package upgrade will undo my work, so the question remains, what is the "proper way" to disable lightdm?

Martin.
p.s. (So easy under wheezy, just "update-rc.d lightdm disable")
MartinK
 
Posts: 25
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: systemd, masked services, and disabling lightdm

Postby reinob » 2015-05-15 10:44

MartinK wrote:Head_on_a_stick, you have saved my sanity.

Yes, I could have removed the lightdm package but I considered that a workaround, not a solution.

The commands you offered revealed;

Code: Select all
lrwxrwxrwx 1 root root 9 May 14 20:41 /etc/systemd/system/display-manager.service -> /dev/null


as expected, but

Code: Select all
-rw-r--r-- 1 root root 412 Sep 15  2014 /lib/systemd/system/lightdm.service


looks like the culprit! For completness I also ran

Code: Select all
ls -l /etc/systemd/system/lightdm.service

lrwxrwxrwx 1 root root 9 May 14 20:49 /etc/systemd/system/lightdm.service -> /dev/null


I have not yet manually created a symlink to /dev/null for lightdm in /lib/systemd/system as I am guessing a future package upgrade will undo my work, so the question remains, what is the "proper way" to disable lightdm?

Martin.
p.s. (So easy under wheezy, just "update-rc.d lightdm disable")


You probably have the graphical target as default. If you don't want that, the "normal" thing to do would be to choose another default ("runlevel" in sysvinit-speak).

# systemctl set-default multi-user.target

This will (if things are properly configured) leave you at the console without a display manager.
(This is what I use as well, but I also don't have any display manager installed -- use startx -- so it might be that it also doesn't work)
reinob
 
Posts: 738
Joined: 2014-06-30 11:42

Re: systemd, masked services, and disabling lightdm

Postby MartinK » 2015-05-15 14:46

Reinob,

You have hit the winning runs!

Code: Select all
systemctl get-default


showed I was setup for the graphical target, as you assumed. I changed that to multi-user.target, re-booted and there I was at the login prompt, no GUI. After login startx took me to Openbox. That was all done with display-manager and lightdm services still masked.

I then unmasked display-manager and lightdm, re-booted, and everything still worked as I wanted. systemctl shows those services as "static", as originally, but "inactive".

It seems my mistake was to attempt what I did in system V init style boot, i.e. to disable the lightdm service.

The answer to how to disable lightdm in Jessie is actually - change the default target (run level). For clarity, that is;

Code: Select all
systemctl set-default multi-user.target


Having searched on-line I know countless others are making the same mistake.

Thanks all,
Martin.
MartinK
 
Posts: 25
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: systemd, masked services, and disabling lightdm

Postby Bulkley » 2015-05-15 16:08

The above seems awfully complicated. Couldn't you simply remove Lightdm? I haven't used a DM for years.
Bulkley
 
Posts: 5844
Joined: 2006-02-11 18:35

Re: systemd, masked services, and disabling lightdm

Postby reinob » 2015-05-15 16:16

MartinK wrote:It seems my mistake was to attempt what I did in system V init style boot, i.e. to disable the lightdm service.


Actually, the classical System V way would have been to define/select a suitable runlevel. It's just Debian & co. which made it unnecessarily complicated. In a way (and I'll be flamed), systemd brings back the logic in it :)
reinob
 
Posts: 738
Joined: 2014-06-30 11:42

Re: systemd, masked services, and disabling lightdm

Postby MartinK » 2015-05-15 17:42

Bulkley wrote:Couldn't you simply remove Lightdm?


Although I'm happily using Openbox without a full blown desktop environment I do sometimes run something like LXDE, for comparison.
MartinK
 
Posts: 25
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: systemd, masked services, and disabling lightdm

Postby Bulkley » 2015-05-15 18:05

MartinK wrote:Although I'm happily using Openbox without a full blown desktop environment . . .


Me too.

. . . I do sometimes run something like LXDE, for comparison.


Ah. There is a CLI method to switch WMs. Sorry, I have forgotten how.
Bulkley
 
Posts: 5844
Joined: 2006-02-11 18:35

Re: systemd, masked services, and disabling lightdm

Postby Head_on_a_Stick » 2015-05-15 18:32

Bulkley wrote:There is a CLI method to switch WMs. Sorry, I have forgotten how.

Code: Select all
# update-alternatives --config x-window-manager
# update-alternatives --config x-session-manager

;)

@OP: Please add "[SOLVED]" to the thread title for the benefit of others.
Don't break DebianHow to report bugs

SharpBang GNU/Linux — a pre-configured Openbox/Tint2 desktop running on Debian stable
User avatar
Head_on_a_Stick
 
Posts: 10600
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to System configuration

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable