Ubuntu not accepting correct password [duplicate]
This doesn't always work, but going into the Linux console mentioned by Jay (ctrl+alt+F1), and moving/deleting .Xauthority in your home directory (example: /home/arpan/.Xauthority) may help.
I've had this problem on my own computer, and it fixed it. However, this same problem arose on another computer, and this did not resolve the problem.
It is not so obvious that the wrong password was entered. Today, I had the same problem with Ubuntu 16.04 (on VirtualBox on a Windows 10 host) after the screen was locked automatically. Entering the password in the graphical interface kept giving me the message the password was wrong. Logging in via the console worked just fine, just as well as logging in from the host machine over ssh with the same username. Hence, the password was not the problem.
I solved the problem by restarting the device with the shutdown command from the console (can be done over SSH as well if necessary and if a SSH server is running on your machine).