Can't login to Ubuntu GUI with correct password

Solution 1:

I see 2 possible problems.

Wrong permissions on .Xauthority file.

Run chown username:username .Xauthority on a terminal in your home directory. Replace username with your actual username.

The .Xauthority-file can be found in each user home directory and is used to store credentials in cookies. You can find more info on X authentication and X authority in the xauth man pages (type man xauth in a terminal). If you are not the owner of this file you can't login since you can't store your credentials there.

Broken packages and dependencies.

Start Ubuntu in recovery mode from grub, select dpkg wait until it finishes and you are done.