Ubuntu 14.04 Hangs After Log In

After logging in to Ubuntu 14.04 with the Unity desktop, Jennings, a Lenovo K450E with an NVidia GTX 750 graphics card, would sometimes hang. The computer wasn’t locked up, just the desktop: the mouse would move and the TTYs were still fully functional, but the desktop would be blank. This has happened twice. Once it happens, it won’t work again.

The first time this happened, I reinstalled Ubuntu. I’ve since found a less expensive fix, which is outlined below (see Installing Ubuntu 14.04 on Jennings for the NVidia driver in the penultimate step):

sudo apt-get update
sudo apt-get install --reinstall ubuntu-desktop
sudo apt-get install --reinstall unity
sudo apt-get remove --purge 'nvidia*'
sudo service lightdm stop
sudo sh ./NVIDIA-Linux-x86_64-340.24.run
sudo reboot