As I started my machine today I found myself unable to login to Ubuntu using the normal graphical login screen (lightdm). I tried looking through the logs in /var/log/lightdm for clues but did not seem to find anything.
Looking in ~/.xsession-errors however, I found
/usr/sbin/lightdm-session: 28: /home/jmn/.profile: Syntax error: end of file unexpected (expecting "fi")
Turns out I had accidentally broken the syntax of the .profile and this caused login to break silently.
Simply fixing the .profile (or moving it temporarily) will solve the issue.
In case you didn't know, you can open a console in Ubuntu by pressing Ctrl+Alt+F1 and then logging in. To move the .profile you can do
mv ~/.profile ~/.profile-old
Here's a relevant thread on Ask Ubuntu.