8

I have installed ubuntu-12.04.1-server-i386 and on top of that i have installed Ubuntu desktop environment so that i can maintain server easily.

Hear I totally understand that installing Desktop environment will affect my server efficiency but its quit easy to maintain server with GUI so I am wondering that is there any workaround to enable or disable Ubuntu Desktop Environment whenever we need it like we do in Windows for services ? I searched and reffed many sites but did not found anything related to this.

Thanks in advance and sorry for my poor English.

enter image description here

3 Answers 3

6

This is a specific instance of a generic question, "how do I prevent an upstart service from running at boot".

You can use an override:

sudo echo "manual" >> /etc/init/lightdm.override

To start lightdm on command:

sudo start lightdm

To restore your system so that lightdm is always started on boot:

sudo rm /etc/init/lightdm.override

For more information, the upstart cookbook is your friend:

http://upstart.ubuntu.com/cookbook/

SRC : Here

6
  • And how do I shut down the GUI again? May 6, 2014 at 8:17
  • 1
    sudo service lightdm stop May 7, 2014 at 11:44
  • Doesn't sudo refer to echo? Your first sudo echo "manual" >> ... has no permission to write to /etc/init/.
    – Gauthier
    Jun 15, 2015 at 9:46
  • I had that problem as well. >> is not run as root. sudo -i first is a good work around. Oct 13, 2015 at 20:57
  • It's back to gdm so you should create /etc/init/gdm.override with the contents as above, these days (2016)
    – Warren P
    Apr 7, 2016 at 20:41
4

Try to disable GUI, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo update-rc.d -f gdm remove

When you restart your computer, you’ll get text-mode login. To run GUI again:

startx

To enable GUI again:

sudo update-rc.d -f gdm defaults

Source:HTG

7
  • I execute command "sudo update-rc.d -f gdm remove" nothing happens! then i tried "sudo service lightdm stop" but it stops at checking battery stste and "sudo service gdm stop" is unrecognized service Jan 9, 2014 at 9:22
  • I installed 12.04 server yesterday, and followed the steps, and it worked. Did exactly as the source said. Let me know.
    – Mitch
    Jan 9, 2014 at 9:51
  • i have have added image in the question. I guess the command is not executing properly Jan 9, 2014 at 10:48
  • "sudo echo "manual" >> /etc/init/lightdm.override" worked for me Jan 9, 2014 at 11:10
  • I tried that, and it didn't work for me. see image
    – Mitch
    Jan 9, 2014 at 11:27
0

Another way to avoid the permissions issue, is to use 'tee'. Like so:

echo "manual" | sudo tee /etc/init/lightdm.override

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .