Server Fault is a question and answer site for system and network administrators. 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 an Linux (Ubuntu) virtual machine that's been setup as a desktop; it starts X and the full UI. I only need it as a server (will be accessing it via ssh) and am looking to reduce the memory footprint.

What's a good way to prevent X from starting when the machine boots?

Update: ended up going with:

sudo mv /etc/rc2.d/S30gdm /etc/disabled-S30gdm

via the link in Evan Anderson's answer.

share|improve this question
up vote 1 down vote accepted

I don't use Ubuntu (I'm a CentOS / Fedora guy), but typically this is done with runlevels. I'm reading that, at least on Ubuntu "Gutsy", there isn't a runlevel that doesn't start X by default. What a pain!

Have a look at this guy's site-- it should at least give you an idea of where to look.

On RedHat-style distributions this would be easy... >smile<

I dunno about these techniques above to remove GDM, but I'd rather be able to select a different runlevel to get X back than go removing software.

Edit: Here's some potentially better thoughts:

share|improve this answer
Ubuntu's runlevels 2-5 all start with a GUI (IIRC) and they lack the inittab that Redhat/Fedora/CentOS has in favor of upstart – Kevin Kuphal Jun 4 '09 at 17:02
That's what I meant when I said "I'm reading that ... there isnt' a runlevel that doesn't start X by default!" – Evan Anderson Jun 4 '09 at 17:04

You can disable GDM by:

update-rc.d -f gdm remove

Then re-boot and you should have your console window.

share|improve this answer

Go to System -> Administration -> Services and disable GDM

share|improve this answer
Looks like there's no Services option under Administration. There's a "Login Window" option that lets me set the "Default Session" to "Secure remote connection" or "Failsafe Terminal", are either of those what I'm looking for? – Parand Jun 4 '09 at 17:08
You should be seeing configuration options like this: – Kevin Kuphal Jun 4 '09 at 18:34

in ubuntu there is a config file for gdm at


The lines you will want to alter are:

start on runlevel [2345]
stop on runlevel [016]

to be more like:

start on runlevel []
stop on runlevel [0123456] # you can leave some runlevels in the start on line if you know what runlevel you are currently running on.

you can always get the gdm to run once you login using the command startx.

share|improve this answer
Unfortunately 11.04 has changed that. – Douglas Leeder Aug 1 '11 at 9:31

Not sure about Ubuntu, but in RedHat/Fedora/CentOS, you just change the default runlevel in /etc/inittab to 3

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.