Desktop login fails, terminal works

Solution 1:

Removing ~/.Xauthority worked for me

Solution 2:

I had this same issue. It turned out that my problem was that ~/.Xauthority was updated as root, and from then on only root could read it. It stopped me from starting any X session from my username. I had to sudo rm ./.Xauthority and it worked fine after that.

Solution 3:

I finally gave up and reinstalled the system. This was not a problem, since the system was quite fresh, and most personal data was not yet migrated to it. I can't tell for sure the problem was not caused by a non-standard package, so ...

So I started anew, and I took precautions to be better off next time. After installation, I updated the system, installed some crucial packages and pinned an eye to the configuration:

sudo bash
apt-get upgrade
apt-get install ssh mercurial vim
cd /etc/
vim mercurial/hgrc
hg init .
hg add *
hg commit

Thus, whenever a new problem occurs, I should stand a better chance to know what might have gone wrong.