Setting up a "headless" VNC server on Raspberry Pi
October 13, 2022
This is our procedure for setting up a VNC server on a Raspberry Pi running Raspbian 11 that has no monitor, keyboard, or mouse. Before the exit line in /etc/rc.local, add this:
su pi -c 'vncserver -randr=1870x980'You can adjust the resolution to your specifications. Note that with this technique, you will connect to Display 1. If your Pi's IP address is 192.168.0.23, connect to 192.168.0.23:1. We used RealVNC's VNC Viewer for this purpose. trlaing on the Raspberry Pi Forums gave us a tip about correcting window display:
sudo nano /etc/xdg/lxsession/LXDE-pi/desktop.confChange window_manager to the following:
window_manager=openbox-lxde-piOur friends at Griffon's IT Library know how to fix the "Authentication required to refresh system repositories" popup.
sudo echo -e ""\ "[Allow Package Management all Users]\n"\ "Identity=unix-user:*\n"\ "Action=org.freedesktop.packagekit.system-sources-refresh\n"\ "ResultAny=yes\n"\ "ResultInactive=yes\n"\ "ResultActive=yes"\ > 46-allow-update-repo.pkla sudo mkdir -p /etc/polkit-1/localauthority/50-local.d/ sudo mv 46-allow-update-repo.pkla /etc/polkit-1/localauthority/50-local.d/