Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a remote machine running Debian 8 (Jessie) with lightdm installed. I want it to start in no-GUI mode, but I don't want to remove all X-related stuff to still be able to run it though SSH with the -X parameter. So how to disable X server autostart without removing it?

I tried systemctl stop lightdm, it stops the lightdm, but it runs again after reboot. I also tried systemctl disable lightdm, but it basically does nothing. It renames lightdm's scripts in /etc/rc*.d directories, but it still starts after reboot, so what am I doing wrong? And I can't just update-rc.d lightdm stop, because it's deprecated and doesn't work.

share|improve this question
systemd is fairly new in debian, and if it is not working as expected I suggest you file a bug report. – bodhi.zazen Feb 19 at 16:49
Running X stuff through ssh doesn't require an X server installed on the machine. (It just requires the X client libraries). Do you really want an X server installed? [AFAIK, you've found a bug—the disable should have worked. Of course that's hardly an answer...] – derobert Feb 19 at 16:53
@bodhi.zazen The problem is I don't know if it works as expected or not, because I don't know if I'm doing it right. I'm new to the systemd too. – kurogetsusai Feb 19 at 17:02
@derobert Oh, so... I think I don't need the X server in that case. It's still more of a workaround than a solution, but thanks. Can I safely remove the lightdm and all xorg-server-* packages or should I keep something, e.g. xorg-server-input-* or video drivers? – kurogetsusai Feb 19 at 17:02
up vote 8 down vote accepted

The disable didn't work because the Debian /etc/X11/default-display-manager logic is winding up overriding it.

In order to make text boot the default under systemd (regardless of which distro, really):

systemctl set-default multi-user.target

To change back to booting to the GUI,

systemctl set-default graphical.target

I confirmed those work on my Jessie VM.

PS: You don't actually need the X server on your machine to run X clients over ssh. The X server is only needed where the display (monitor) is.

share|improve this answer
+1 . Major effort "beyond the call of duty". – Faheem Mitha Feb 19 at 23:06

I don't know much about Debian, but on my Ubuntu 14.04 laptop, here is the standard procedure I use when I want to disable X and boot to command prompt for troubleshooting:

  1. Edit the file /etc/default/grub in superuser mode and set GRUB_CMDLINE_LINUX_DEFAULT="text"

Optionally, also uncomment this line: #GRUB_TERMINAL=console and then do sudo update-grub. The machine will boot in text mode.

  1. To start the graphical interface from there, you then do sudo service lightdm start #could be gdm or startx in some situations

Source: http://askubuntu.com/questions/52089/how-do-i-boot-to-a-command-line-interface-instead-of-a-gui

share|improve this answer

Try the following command:

echo  "manual" | sudo tee -a /etc/init/lightdm.override
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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