Ubuntu Linux stop / disable GNOME GUI ~ X.org

by on September 7, 2007 · 20 comments· LAST UPDATED September 7, 2007

in

Q. I don’t need GUI as I’m developing CLI based applications. By default Ubuntu Loads Gnome GUI. How do I disable X.org / Gnome under Linux so that I get text only login?

A. You can use GUI tools or command line tools to disable GDM (Gnome Display Manager) service (/etc/init.d/gdm).

Disable GDM using GUI tools

The Services Administration Tool allows you to specify which services will be started during the system boot process. You can type the command:
services-admin &

Or just click on System > Administration > Services

Now you will be prompted for the administrator password, this is necessary because the changes done with this tool will affect the whole system. After entering the administrator password, the following window is displayed:

Ubuntu Linux stop / disable GNOME GUI (X.org)

Make sure you remove GDM (Gnome login manager) by disabling the the checkbox and close the window.

Enable GDM using Command Line (CLI) tools

Ubuntu comes with rcconf and update-rc.d command. rcconf allows you to control which services are started when the system boots up or reboots. It displays a menu of all the services which could be started at boot. The ones that are configured to do so are marked and you can toggle individual services on and off.

Install rcconf

Use apt-get command:
sudo apt-get install rcconf
Now start rcconf:
sudo rcconf
Again you will be prompted for the administrator password, this is necessary because the changes done with this tool will affect the whole system. After entering the administrator password, the following text based window is displayed on screen:
Ubuntu / Debian Runlevel configuration tool

Next enable GDM service by pressing space bar (check the checkbox) > Click OK to save the changes.

update-rc.d command

This is 3rd and old method. You can enable or disable any service using update-rc.d command.

Task: Disable X.org GUI

Just enter command:
sudo update-rc.d -f gdm remove

Task: Enable X.org GUI

Just enter command:
sudo update-rc.d -f gdm defaults

You can always start GUI from a shell prompt by typing startx command:
startx &

Please note that you can use above tools to enable or disable any services under Debian / Ubuntu Linux.

See also:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 20 comments… read them below or add one }

1 Bryce Harrington March 31, 2008 at 11:11 pm

This command should not be used by users to disable gdm:

sudo update-rc.d -f gdm remove

While it may seem to work, that’s just a side effect. This is a packager’s tool, not an administration tool.

A better approach (recommended to me by slangasek, the Ubuntu release manager) is:

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

Reply

2 erkko January 12, 2009 at 5:27 pm

I shall second to Bryce. And to add insult to injury: when trying to temporarily suspend some services this way, on might end up with pretty screwed system.
sudo update-rc.d -f gdm remove — this removes all links to /etc/init.d/gdm and if you did not pay attention to their original sequence numbers… try to remove gdm this way and restore it afterwards. default restore method, you suggested, will use sequence number 20 for start and kill, original for ubuntu gdm is btw 30 for start and 01 for kill.

And because disabling gdm by itself really is not enough, one has to disable usplash also. When you use this same-old default remove -command and later on wanna restore gdm & usplash, you’ll end up with both of them started at the same sequence and this also means no mouse/keyboard while sitting at gdmgreeter login…

Nice enough?

commands for restoring such systems original condition would be:

update-rc.d -f gdm remove
update-rc.d -f usplash remove
update-rc.d -f gdm defaults 30 01
update-rc.d -f usplash defaults 98 02

use sudo, if need be.

Reply

3 rkaneknight March 2, 2009 at 6:13 pm

I’ve had a horrible time removing the GUI from Ubuntu 8 Maybe I have the wrong version, but I finally ran into this site, and installed and ran rcconf and removed gdm and a few other things related to X and some other stuff I didn’t think I needed. I’m running this as a VM so the last thing I need is a bulky GUI slowing things down. waiting for reboot… Woot, finally a regular login prompt. A couple errors came on the screen, but I don’t care, as long as I don’t have a GUI taking away my ram.

Reply

4 SaltwaterC April 21, 2009 at 9:13 am

sudo apt-get install sysv-rc-conf ; sudo sysv-rc-conf

rcconf looks like an unfinished product besides sysv-rc-conf.

Reply

5 ASaavedra November 11, 2009 at 10:18 pm

SaltwaterC: sysv-rc-conf is such a great tool, thanks for the tip! A. Saavedra

Reply

6 Junaid October 18, 2010 at 2:56 pm

Hi… Is there anyway I can just access a command prompt line like in Windows? And still be on the gui/gdm?

Reply

7 ASaavedra October 18, 2010 at 4:03 pm

Junaid, you mean a console terminal? If using GNome simply go to Applications > Accesories > Terminal

Reply

8 Junaid October 19, 2010 at 12:35 pm

Thanks… You’re a real blessing. I’m new to this stuff.

Reply

9 phil February 12, 2011 at 10:09 pm

lol linux people pwned with terminals long before Windows people did.

Reply

10 mate May 19, 2011 at 10:40 pm

I have used the command as stated above (update-rc.d -f remove/defaults) with great success. I have not used it in Ubuntu 11.4 yet?
Sometimes people have problem with display drivers or what have you and need Not to get on the GUI until they’ve solved the problem. So this is a great tool in fact once I made a little script out of it.

Reply

11 Zaid August 10, 2011 at 7:31 am

Rename gdm.conf to gdm.disabled

file location: etc/init

Reply

12 HansBKK August 29, 2011 at 6:52 am

Zaid is DA MAN!!

only thing that worked on Natty 11.04

hope I didn’t screw up my system trying all the other stuff I found.

startx gets you in manually once you’ve logged in to that beautiful black and white console

Reply

13 adam November 25, 2011 at 1:35 pm

Thanks, that i was looking for too. Only this working in 11.10

Reply

14 Aditya February 13, 2012 at 6:08 pm

The thing that worked for me. Running Ubuntu 10.10.

Reply

15 todd February 14, 2012 at 1:47 pm

Ah, but if you receive updates to your system, then updates to GDM may very well install a new gdm.conf, causing your system to boot into X Windows again.

On the other hand, if you create a gdm.override file and put the word manual in it, then it won’t matter if gdm.conf is ever updated, or recreated, the override will still be effective in preventing X from starting.

Reply

16 kurinchilion October 29, 2011 at 10:17 pm

good & detailed post

Reply

17 johnv474 December 15, 2011 at 10:09 pm

Is it just me, or does this page display with a huge ad (usually for Cisco) covering much of the content? So far as I see, there is no way to close the ad.

… among the most annoying website traits, just after sites with talking ads.

Reply

18 todd January 13, 2012 at 1:29 pm

I realize this post is a couple years old, but it still shows up at the top of the search results in Google, so I suppose it’s worth having accurate information.

In the current release of Ubuntu upstart is used in place of init, so one should edit the files in /etc/init and not modify any rc scripts (i.e. sysv-rc-conf, rcconf, update-rc are all no-no’s). I can’t speak to previous releases of Ubuntu, so I don’t mean to suggest the original article is incorrect.

Rather than renaming /etc/init/lightdm.conf (or gdm.conf, kdm.conf, etc, as the case may be) you should create /etc/init/lightdm.override and put in it one line with just the word

manual

(without the quotes) – this will prevent upstart from starting the job automatically, and will allow it only to be started manually (hence the “manual” keyword). You should also remove the

quiet

,

splash

and

vt.handoff=7

kernel parameters from your GRUB configuration – to do so, edit /etc/default/grub, change

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT=""

and run /usr/sbin/update-grub.

Ubuntu boots into runlevel 2 by default, so in my system I’ve got it setup so that X does not start in runlevel 2, but will in runlevel 3, 4 and 5 (which used to be the case in the days of old) – if you want to take that approach, change your /etc/init/lightdm.override file to:

start on (filesystem
and runlevel [!026]
and started dbus
and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
or stopped udev-fallback-graphics)

stop on runlevel [0126]

Reply

19 todd January 13, 2012 at 1:32 pm

Let me fix some formatting…

In the current release of Ubuntu upstart is used in place of init, so one should edit the files in /etc/init and not modify any rc scripts (i.e. sysv-rc-conf, rcconf, update-rc are all no-no’s). I can’t speak to previous releases of Ubuntu, so I don’t mean to suggest the original article is incorrect.

Rather than renaming /etc/init/lightdm.conf (or gdm.conf, kdm.conf, etc, as the case may be) you should create /etc/init/lightdm.override and put in it one line with just the word manual – this will prevent upstart from starting the job automatically, and will allow it only to be started manually (hence the “manual” keyword). You should also remove the quiet, splash and vt.handoff=7 kernel parameters from your GRUB configuration – to do so, edit /etc/default/grub, change GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” to GRUB_CMDLINE_LINUX_DEFAULT=”" and run /usr/sbin/update-grub.

Ubuntu boots into runlevel 2 by default, so in my system I’ve got it setup so that X does not start in runlevel 2, but will in runlevel 3, 4 and 5 (which used to be the case in the days of old) – if you want to take that approach, change your /etc/init/lightdm.override file to:

start on (filesystem
              and runlevel [!026]
              and started dbus
              and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
                      or stopped udev-fallback-graphics)
stop on runlevel [0126]

Reply

20 luis June 3, 2012 at 10:44 pm

Thank you very much todd. Your solution works on Ubuntu Server 12.04.

Reply

Leave a Comment

Tagged as: , , , , , , , , , ,

Previous Faq:

Next Faq: