How-To Geek
Prevent X.Org from Starting in Ubuntu
If you’ve got an Ubuntu machine that you initially installed with Ubuntu Desktop, but would like to run as a server, you can just disable the graphical environment from starting up in order to save resources. This is also useful for doing system maintenance from the command line that needs to be performed outside of the GUI.
The only reason to do this instead of removing the packages would be because you might want to still sometimes use the box through the GUI.
Disable X.Org
In order to disable the graphical environment, we’ll need to disable GDM, the Gnome Display Manager. In order to do this, you’ll need to run the following command at the terminal:
sudo update-rc.d -f gdm remove
When you restart your computer, you’ll be presented with a text-mode login prompt instead of the graphical environment.


Run X.Org While Disabled
If you want to run the graphical environment, all you have to do is type the following command from the prompt, making sure to run it as your normal user account.
startx
The annoying gray screen will go away once Gnome is fully started.
Enable X.Org
If you want to re-enable X11 it’s a simple matter of running this command from the terminal:
sudo update-rc.d -f gdm defaults

When you restart, you’ll be presented with the graphical prompt again.
Got Feedback? Join the discussion at discuss.howtogeek.com
Comments (8)
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 09/7/07




I’m just a novice, but enjoy the info on your site. I’ve done everything in windows since 85 and have really forgotten everything dos…its been so long ago. Really like this unit with Ubuntu and the ability to go to the command line. The commands are new to me, but hopefully I can get up to speed and learn some real computing.
Peace, Paddy
“update-rc.d foo defaults” will not put “foo” back into its previous start-up slot, but puts it at S20 by braindead “default”. Its the oldest surviving bug in UNIX history. For gdm this can cause real grief cause it puts it before processes that should have completed start-up before gdm goes about its merry ways.
Better solutions:
use mv to change the symlink in a particular runlevel to K(100 minus Svalue) e.g. “mv S30gdm K70gdm” and when you want it back in use “mv K70gdm S30gdm”. Better yet, use a dedicated boot-up manager (e.g. “bum” which has a friendly GUI) to edit your runlevels.
update-rc.d is full of inconsistencies and hidden traps.
Bernhard is right: S30gdm K70gdm work perfectly using bum boot-up manager.
I used the first command to prevent xwindow from starting, this prevented my sound from working after a reboot.
So then I used the command posted to restore it back to bring up the regular login and now my mouse and keyboard no longer work, the login screen comes up and I can type nothing and can’t move the mouse around.
I am currently running off the live CD…. anyone know a fix for this so I don’t have to reinstall? Please any help would be appreciated.
Yeah, this doesn’t work with Ubuntu 9.10.
Well at least not for me… :)
i have a PPC mac mini running xubuntu (because ubuntu wouldnt fit on the disk). what xdm does xubuntu use. i have tried removing xdm and gdm. only 1 line of output. i dont know whether it works as it is in my cupboard
doesnt work with ubuntu 10.x
doesn’t seem to work with Ubuntu desktop 11.04.