I just started having this problem on 17.04. As I try to login on Ubuntu the screen just goes black for a second, and then I end up back on the login screen. I have tried reinstalling lightdm, that didn't work. I tried using gdm, that didn't work. I tried the following command sudo rm -v .Xauthority, didn't work.
The only thing that made it possible to log in was by creating a new user, but then I can't access my files. How do I solve this problem?