How to disable GUI in Ubuntu Server 11.10

3

I have installed Ubuntu Server 11.10 on my machine. Next I used sudo apt-get install ubuntu-desktop to install GUI.

Is it possible to disable it and re-enable it anytime I want?

If yes, what commands do I use?

Booyaches

Posted 2011-11-26T19:23:54.227

Reputation: 133

Answers

1

running the following command:

initctl list

will give you a list of all your upstart jobs, if it's not gdm it will be something similar.

Assuming it is in fact gdm the following will show you under what conditions the gnome display manager will automatically start:

initctl show-config -e gdm 

At this point you can do one of two things by editing the gdm config file using:

sudo nano /etc/init/gdm.conf

Either add:

DISABLED=1

on a line by itself somewhere near the top of the file BEFORE the line that begins with:

start on

This will essentially prevent gdm from ever running by itself, however you can still start XWindows manually by logging in and running: startx

Your other option would be to comment out (add a # before any text on the line :) the line beginning with:

start on

and every subsequent line until (but not including) the line that begins with:

stop on

This will prevent gdm from running at startup but will still allow you to start it as a service if for instance you wanted to leave a graphical login screen up instead of a black console. You can check to make sure your changes were correct by running:

initctl show-config -e gdm

once more to make sure all of the start ons are gone. Hopefully this helps, I find half the joy of using Linux to be unraveling it's inner workings till I understand them so I tried to give you as much info as you will need but still leave a few things for you to discover on your own ( man initctl )...

Justin Buser

Posted 2011-11-26T19:23:54.227

Reputation: 1 147

0

The fastest method would be to log in to 1 of the 6 TTY's using CTRL+ALT+F1 through CTRL+ALT+F6.

To get back to the desktop/GUI, simply press CTRL+ALT+F7.

iglvzx

Posted 2011-11-26T19:23:54.227

Reputation: 21 611

He asked how to disable the GUI so I'm assuming he's actually more interested in freeing up the memory/resources used by X11 than simply logging in again through another tty... – Justin Buser – 2012-04-29T14:39:48.097

0

sudo service gdm stop

Should stop the gui... though it might be a different service name these days...

The benefit of this over iglvzx's answer is that the gui stops running, freeing resources, rather than simply hiding it.

Pricey

Posted 2011-11-26T19:23:54.227

Reputation: 4 262

You may need superuser privilege to stop gdm. – iglvzx – 2011-11-27T03:20:22.757

1You will need superuser privilege to stop gdm – Justin Buser – 2012-04-29T14:40:35.117