Updated my school ubuntu ws from raring to trust and X11 stopped working.

Solution (2014)

sudo apt-get remove --purge xserver-xorg
sudo apt-get remove --purge nvidia*
sudo apt-get autoremove --purge
sudo reboot

#..rebooting..

sudo apt-get install xserver-xorg
sudo dpkg-reconfigure xserver-xorg # NB; nothing will seem to happen
sudo reboot

#..rebooting..

Now reinstall your favourite graphical environmnet

Solution (2021)

sudo apt purge nvidia*
ubuntu-drivers devices

# Manual option (install the one you want, start with "recommended")
sudo apt install nvidia-driver-xxx

# Automatic option
sudo ubuntu-drivers autoinstall

sudo reboot