What's wrong
I just reinstalled the bookworm version of Raspberry OS for my 4B model. After enabled the VNC server, I can not connect to the Pi due to this error:
unknown authentication scheme from vnc server 13, 5
How to fix
I'd recommend using RealVNC's VNC Viewer - it's free to use and guaranteed to work with the RealVNC VNC Server.
You can download it here: https://www.realvnc.com/en/connect/download/viewer/.
However, after doing a bit of digging, what has probably happened here is that in VNC Server 6.11.0, RealVNC upgraded the security of how VNC passwords were stored: https://help.realvnc.com/hc/en-us/articles/6661259023389.
Since the Raspberry Pi repository had version 6.10.0 previously and has now jumped to 7.x, this change is only just kicking in.
To add to the above, version 7.0.0 also changed the default encryption level of connections on Raspberry Pi from PreferOn
to AlwaysOn
, to match the default for VNC Server on other platforms.
This means that after installing 7.x VNC Server and restarting it, the password is upgraded to the new format, stopping connectivity from non-RealVNC VNC Viewers.
To correct this, you will need to change VNC Server's Encryption from AlwaysOn
to the previous PreferOn
(though if you aren't using a RealVNC VNC Viewer you won't benefit from any encryption anyway), and then reset your VNC Password.
Theres' 2 ways to do this:
GUI way
- Using the GUI. Open VNC Server's
Options
, and change theEncryption
dropdown toPrefer On
orPrefer Off
, and click Apply. - Next, go to
Users & Permissions
and click thePassword
button on the right. Enter your password and make sure to check the "Allow connections from legacy VNC Viewers" checkbox.
CLI way
Using SSH/command line. Run the below commands:
echo 'Encryption=PreferOn' | sudo tee -a /root/.vnc/config.d/vncserver-x11
sudo vncpasswd -legacy -service
sudo systemctl restart vncserver-x11-serviced