Troubleshooting X

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Note: This tutorial should be obsolete, since Ubuntu has now implemented "bulletproof-X," which prevents the graphical interface from dying unexpectedly. Nevertheless, some users who run into that rare panic situation may still find this helpful, so I'm keeping it around.

Sometimes new users, expecting a graphical environment after installing Ubuntu, end up at a black screen with some white text that has a login prompt. When they log in, they see this:

username@ubuntu:~$

I haven't experienced this myself, but I've seen it happen to other new users, either because they accidentally did a server install... or Ubuntu just did something funky.

Do you have a graphical environment installed?
The first step requires you to have a software repository. In most cases, if you're connected to the internet, the commands given will use your internet connection. If you don't have an internet connection but do have the Ubuntu Alternate Installer CD, insert it in your drive and type

sudo apt-cdrom add

This will add the CD as a software package source since you can't get packages from the internet.

To make sure you have a graphical environment installed:

sudo apt-get update
sudo apt-get install ubuntu-desktop

If you didn't already have it installed, you'll notice Ubuntu downloading and installing a whole bunch of packages, either from the internet or from your CD.

If you did have it installed, you'll simply be told ubuntu-desktop is already the newest version.

Run the graphical environment
Now that we have it installed, let's use it:

sudo service gdm start

This should get you to a graphical login screen. If it says it's starting the GNOME Display Manager but after ten seconds or so... it doesn't actually appear to start, try pressing Control-Alt-F7, which should get you to the graphical login screen.

You have a graphical environment, but it won't show the way I want it to
Well, what if you get a graphical environment you can't see? It's a black screen but your monitor's working, or you get that the monitor signal is out of range, or the screen resolution is just too low for your tastes.

Well, then press Control-Alt-F1 and try this:

sudo dpkg-reconfigure xserver-xorg

This will pop up a text-based graphical "wizard" that will ask you questions about your keyboard, your mouse, your graphics card, and your monitor. Answer the questions as best you can. If you don't know the answer to a question, just go with the default and press Enter.

When you're done, press Control-Alt-F7 to get back to graphical mode and then Control-Alt-Backspace to reset the X server (so your changes can take effect).

Next steps
In a lot of cases, these steps will get you all straightened out. If not (for example, if you are still unable to reach your optimum screen resolution), look here for other possible solutions.

If you're still stuck at the command prompt but want to do some research on how to fix the problem, boot up the Desktop CD or install and use the text-only web browser called Links:

sudo apt-get update
sudo apt-get install links
links

It'll launch a seemingly blank screen. Press g and you can go directly to a URL like www.google.com

Other variations
If you're using Kubuntu, it's the same deal—just replace ubuntu-desktop with kubuntu-desktop and replace

sudo service gdm start
with
sudo service kdm start

If you're using Xubuntu, it's the same deal—just replace ubuntu-desktop with xubuntu-desktop.

sudo service gdm start
will stay as is.

If you have suggestions or corrections for these tutorials, please post in this Ubuntu Forums thread or leave a comment on my blog.

I will not give help to people posting in the above places. If you require technical support, start a support thread on the Ubuntu Forums. That is the appropriate place to ask for help.