Had this problem too and after some research online found this discussion on the bug. Err, well, it's a bug depending on how you look at it. User Onur Samiloglu points out that it is related to the keyring not being unlocked:
I found a workaround.
It seems the keyring is still locked by the time the
remote-desktop-daemon is started and hence the VNC server is unable to
read the password.
When I opened Seahorse, it was saying it's still locked. My GNOME is
set up to log in automatically, if that makes a difference.
The reason keyring might not be unlocked is that it is not unlocked on login. Or (like me) you are logging in with a user automatically. They continue with their idea on how to correct the problem (which I have pasted below for historical purposes), but I'm not a fan of this approach personally since it would involve saving a copy of what is likely your login password in clear text. I have an alternative but I would not have been even come close to coming up with it were it not for this user, so: thank you very much Onur Samiloglu for your insight!
The solution I am using is to just remove the password requirement from the keyring (I'm using Ubuntu 21.10). To do this:
- Open the "Passwords and Keys" application
- Right click on the "Login" keyring and hit "Change password". Example
- Enter your password (likely your login password unless you've changed it)
- For the new password enter blank -- you should get a warning that the keyring will always be unlocked.
- Reboot and re-enable VNC one more time
- Reboot once more to make sure it's still working.
As a warning to anyone reading this: if you use the Login keyring to store any other sensitive passwords you will probably want to find another solution as this is definitely not secure. For my purposes, this is perfect as the machine is just used to run Plex really.
Keep in mind that it is not possible using the GUI to enable VNC to work prior to a user signing in to Ubuntu on your Pi; A user must be signed into the desktop environment for VNC to work. This may be possible with another VNC server application or with some configuration to Vino/gnome-remote-desktop that Ubuntu uses (depending on your version of Ubuntu), but I do not know it.
It might be a good idea for you to add your experience to this bug here so that a better solution can be built into future versions of ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-remote-desktop/+bug/1928536
Onur Samiloglu's solution:
I'm killing the currently running gnome-keyring-daemon, creating a new
daemon as unlocked and then starting it. Then I restart the
remote-desktop-daemon and voilà! Remote desktop password is
accepted!!!
Commands (executed as the user, not root):
# killall gnome-keyring-daemon
# echo -n "keyringpasswordNOTVNCPASSWORD" | gnome-keyring-daemon -l -d
# gnome-keyring-daemon -s
# systemctl --user restart gnome-remote-desktop
This could be a generic issue with desktop auto login or the keyring
unlock in general. The VNC server rejecting the password might be just
a symptom rather than the actual bug.