Q:

Can't log in to Ubuntu 12.04 "checking battery" flashes up then goes back to login screen

I am unable to log into my desktop even though I am using the correct password.  When I type it in and hit enter the screen goes black and was saying something like "checking battery".
I have searched this problem but either I am misunderstanding some of the terminology or it doesn't work. Some threads I have read suggest that lighdm is the problem. I undestand lightdm relates some way to the desktop? 
I have logged in via the terminal by pressing ctrl+alt+f1 but am a bit stuck on what to do from here. I am a relatively new user to Ubuntu and so I am afraid my knowledge of the terminal is poor.
I am not sure what I have done for this error to occur. I was enjoying using Ubuntu instead of windows but this has rather soured the experience.
Any help would be much appreciated. 
Rich
I tried startx using ctrl+alt+f1 and the following happened: 
xauth: error in locking authority file /home/richard/.Xauthority 
xauth: error in locking authority file /home/richard/.Xauthority 

Fatal server error: 
Server is already active for display 0 
If this server is no longer running, remove /tmp/.X0-lock and start again.

Please consult the X.org foundation support
at http://wiki.x.org for help

ddxSigGiveUp: closing log
No protocol specified
No protocol specified
xlinit: giving up
xlinit: unable to connect to X server: resource temporarily unavailable
xlimit: server error
xauth: error in locking authority file /home/richard/.Xauthority

I have had a gander at this website http://wiki.x.org but I don't really understand its relation to me trying to login. Apologies if I'm being dull.

A:

Try these solutions:
From your tty remove the .Xauthority file and also need to remove the .xsession-errors files.
sudo rm .Xauthority
sudo rm .xsession-errors*

Check the home directory:
ls -l /home

you may have to give ownership back to your account using chown
sudo chown -R username:group /home/username

