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.


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.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 09/7/07

Comments (8)

  1. Paddy Devine

    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

  2. Bernhard

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

  3. John Gerstmann

    Bernhard is right: S30gdm K70gdm work perfectly using bum boot-up manager.

  4. Dan

    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.

  5. Josh

    Yeah, this doesn’t work with Ubuntu 9.10.
    Well at least not for me… :)

  6. mark henrick

    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

  7. jas

    doesnt work with ubuntu 10.x

  8. Jonathan

    doesn’t seem to work with Ubuntu desktop 11.04.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!