Headless VNC on RaspberryPi

  1. Download official image RaspberryPi OS 64bit and write to SD card
  2. Do first time setup
  3. Install tigervnc server sudo apt install tigervnc-standalone-server
  4. Create password with command
  5. Override systemd unit file by running this command sudo systemctl edit vncserver-x11-serviced.service
  6. Enter this into file that is edited
    [Unit]
    Description=VNC Server in Service Mode daemon
    After=network.target

    [Service]
    Type=forking
    User=pi
    WorkingDirectory=/home/pi
    Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"

    Environment="XDG_RUNTIME_DIR=/run/user/1000"
    ExecStart=
    ExecStart=bash -c "tigervncserver -localhost no"
    ExecStop=tigervncserver -kill :1
    ExecReload=

    [Install]
    WantedBy=multi-user.target
  7. If user is different than pi then change it in previous step accordingly
  8. Reboot
  9. Connect to VNC server on port 5901