When I start Ubuntu it enters tty[1-6] instead of my desktop. Normally I could get back to the desktop by pressing CTRL + ALT + F7 but that doesn't work.

I tried sudo apt-get install ubuntu-desktop but it fails.
I tried startx which started the x-server or x-window (not sure what it's called) but it just brought up a black screen with my mouse cursor. If I pressed printscreen, a dialog box would open up.

I can't get back to my desktop. Any ideas how I can?

EDIT

Edited for more info. This was a fresh install of the latest version. It's dual booting with Win7 - but I doubt that matters. Before this happened, I installed lamp-server but realized it wasn't what I wanted. I then installed xampp and uninstalled lamp-server with "sudo tasksel remove lamp-server". I restarted with "sudo shutdown -r now" because it would not shut down using the graphical interface.

was this a fresh install of the latest ubuntu or did you upgrade from an earlier version?
–
quack quixoteNov 3 '09 at 19:18

If you know what happened right before it starting doing this, that would also be helpful to know.
–
emgeeNov 3 '09 at 19:21

Fresh install of the latest version. Before this happened, I installed lamp-server, xampp then uninstalled lamp-server with "sudo tasksel remove lamp-server". I forgot to add that to the original question. I will edit it in now.
–
BuaNov 3 '09 at 20:26

When you say "it fails," it helps if you can provide a specific error. There are many ways for apt to fail.
–
Ryan ThompsonNov 3 '09 at 21:37

Purged unity-greeter which was the default lightdm greeter for my unity desktop

$ sudo apt-get remove --purge unity-greeter

Then I installed lightdm-gtk-greeter

$ sudo apt-get -y install lightdm-gtk-greeter

Restarted Ubuntu

Logged in to my desktop

Removed lightdm-gtk-greeter

$ sudo apt-get remove --purge lightdm-gtk-greeter

Installed unity-greeter

$ sudo apt-get -y install unity-greeter

Then restarted again and it worked

P.S. In case you cannot connect to internet to download and install required packages using apt-get, I suggest you manually download it from Ubuntu package archives from a working computer, save it in a usb drive, mount it from tty1, and then use dpkg to install it. Please use Google to find out how.

If lightdm-gtk-greeter works for you and you are satisfied with it, you can stop there. However in my experience, it uses slightly more memory than unity-greeter and not as aesthetically good looking as well.