Starting and Stopping GNOME from the Command Line
If you’re having a problem with GNOME, it’s easy to restart it from a terminal. A common issue you can fix is playing a 3D game that crashes and locks the mouse and keyboard.
In Ubuntu and many other distributions you can use this command to restart the GNOME display manager:
sudo /etc/init.d/gdm restart
You can also simply start or stop it:
sudo /etc/init.d/gdm start
sudo /etc/init.d/gdm stop
Stopping GDM causes GNOME and all graphical applications to quit, starting it will take you to the login screen.
If you can’t even get to a terminal, you may be able to over SSH from another computer. I’ve had to do this once or twice when the keyboard was not responding at all, and restarting GDM fixed it.
Archived Comments
Anoop Engineer
It would be easy to hit Ctrl + Alt + Backspace to restart xserver than trying to restart gnome alone.
HeyGabe
Ignore those keyboard shortcut jerkos. This is exactly why your blog is so
awesome, Tom.
These kind of posts rule. I used this twice today to refresh stalled VNC
connections.
Ubuntu-newbie
What keys do we press to get to the terminal if our mouse and keyboard are locked?
….The other people commenting what does ctrl alt backspace do ? And how’s it different from Tom’s suggestion?
Thanks, and great blog.
Vadim P.
Ctrl+alt+backspace restars the X server. Yesterday though in some instructions I was supposed to stop it completely, and “sudo /etc/init.d/gdm stop” did just that. Useful to know!
Tom
Ctrl-Alt-Backspace does the same thing as restarting GDM. The disadvantage is that it only works from inside X. So if you are in a virtual terminal or on SSH it won’t work.
Ubuntu-newbie:
If the mouse and keyboard are locked, your only option is to connect via SSH
from another system.
Joe Smith
I knew about these, but totally forgot. They totally saved me when GNOME froze up on me earlier, thanks a bunch :)
chriscmc26
I have been trying to install vnc on my Ubuntu Server 7.10 (that has gdm installed) so I can remotely manage the server from the Windows PC in my office. When I run realVNC and log in, all I get is a brown-ish (gray if I don’t specify ‘gnome-session &’ in the ~./vnc/xstartup file) and a big X, but I can’t do anything other than move the cursor, and nothing shows up on the desktop.
This server is a blade server with no video port on it, I had to take the case apart and put in a video card to install the server.
So I only have SSH to the server. How can I get my desktop to work? I have already started gdm using the post above.
chriscmc26
Forgot to mention that i have tried both tightvncserver and vnc4server and both have the same effect. i have also tried several other vnc viewers.
Tom
chriscmc26:
Setting up a VNC server to do that can be a bit of work. Here’s some
documentation that could help you:
https://help.ubuntu.com/community/VNC
Anonymous
chriscmc26,
You said “So I only have SSH to the server. How can I get my desktop to work?” Have you tried Webmin? Webmin is a stand-alone web-based *nix administration tool. It installs its own web server with or without SSL and has a modular construction so you can add or remove modules to manage your server.
I have focused on learning to manage from the command line, but webmin works great if you really need a GUI.
Al
Great stuff, but what if gdm stop fails to work? The system returns a message that “Stopping Gnome Manager”, and it appears to have functioned, but Gnome is still running. I’m trying to kill it to install the proper NVIDIA drivers, but it just won’t die. Any suggestions?
Nate
Thanks a lot for this, my GUI froze after disconnecting from an external TV. Had to go into a virtual terminal and type from the command line as root and worked perfect! Thanks again.
jamesey
is sudo /etc/init.d/gdm restart
the same as
ctrl+alt+backspace?