Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] systemd, masked services, and disabling lightdm

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

[SOLVED] systemd, masked services, and disabling lightdm

#1 Post by MartinK »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: systemd, masked services, and disabling lightdm

#2 Post by Head_on_a_Stick »

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...
deadbang

MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: systemd, masked services, and disabling lightdm

#3 Post by MartinK »

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")

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 47 times

Re: systemd, masked services, and disabling lightdm

#4 Post by reinob »

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)

MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: systemd, masked services, and disabling lightdm

#5 Post by MartinK »

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.

Bulkley
Posts: 6383
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: systemd, masked services, and disabling lightdm

#6 Post by Bulkley »

The above seems awfully complicated. Couldn't you simply remove Lightdm? I haven't used a DM for years.

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 47 times

Re: systemd, masked services, and disabling lightdm

#7 Post by reinob »

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 :)

MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: systemd, masked services, and disabling lightdm

#8 Post by MartinK »

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.

Bulkley
Posts: 6383
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: systemd, masked services, and disabling lightdm

#9 Post by Bulkley »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: systemd, masked services, and disabling lightdm

#10 Post by Head_on_a_Stick »

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.
deadbang

Post Reply