Ubuntu – How to disable GDM from being automatically started

gdmserverupstart

After Ubuntu Server 12.04 installation, I installed Xubuntu just to have a minimal GUI:

sudo apt-get install x-window-system-core
sudo apt-get install --no-install-recommends xubuntu-desktop gparted

But now I want to start X just on certain ocasions. Before 12.04, I just issue:

sudo update-rc.d -f gdm remove

But this command does not work anymore.

How can I stop X from init on Ubuntu 12.04 ?
And how can I start it when I need it ?

I have tried both of these questions but I don't have a gdm.conf:

Best Answer

In recent versions of Ubuntu, gdm has been replaced with lightdm - this is why you don't have a gdm.conf. To set lightdm to be started manually, create an 'override' file for its init configuration:

echo 'manual' | sudo dd of=/etc/init/lightdm.override

(this just creates a file, called /etc/init/lightdm.override, containing a single line that says manual)

This way, lightdm will only be started when you invoke:

sudo service lightdm start

and to stop it:

sudo service lightdm stop