59

The command sudo service gdm stop would successfully disable the X server in Ubuntu 11.04 temporarily.

However, this same command no longer works in Ubuntu 11.10, because "gdm" is an "unrecognized service" according to Terminal. How, then, do I disable the X server in Ubuntu 11.10?

fossfreedom
  • 174,526

7 Answers7

70

GDM was switched out for LightDM, so:

sudo stop lightdm

Or in your service parlance:

sudo service lightdm stop

For future reference, all these upstart services (that can be run with initctl's service command and shortcuts) are .conf files in /etc/init/

Oli
  • 299,380
20

The reason that doesn't work is because Ubuntu 11.10 has switched from GDM to LightDM.

Try this command instead:

sudo service lightdm stop
nanofarad
  • 20,906
Nathan Osman
  • 32,495
11

You can also use the keyboard shortcut:

Alt + PrtScn/SysReq + K

A bit of a long winded keyboard shortcut, maybe too many people were pressing Ctrl+Alt+Backspace so they changed it to this.

I can confirm this as working from 10.04 through to 11.10.

parmar84
  • 1,239
7

@Oli pretty much nailed it, but I wanted to note that this probably won't help you out much if you need to do something from the command line without X.

For that, you should press Ctrl+Alt+F1, then log in from the console. Afterwards, you can kill and restart the lightdm service as needed.

Peachy
  • 7,235
  • 10
  • 40
  • 47
Nik Reiman
  • 1,216
6

Technically speaking gdm or lightdm are managing desktop session requests they are not X servers. (an X server is serving events to X application, xorg is an X server :) .

Edit

To stop the X server killall Xorg or sudo killall Xorg if you are not owner of the process.

Of course you must have a terminal to do that.

One way if you cannot open a gnome terminal or an xterm is to start a text console; press simultaneously Ctrl + Alt + F1 keys, then login at the prompt (your password will not be shown, not even as asterisks). (F1 to F5 are ok)

Emmanuel
  • 1,333
3

old post but current question. The command sudo service mdm stop would successfully disable the X server in Linux Mint 17.3 temporarily. After install drivers you can do sudo service mdm start.

Reto
  • 31
1

since this is the primary result that came up with the google search Solus stop X server, I wanted to add this answer because Solus doesn't use service.

for this, you can use sudo systemctl stop lightdm and do whatever you need to do.

Tcll
  • 755
  • 1
  • 8
  • 15