raspberry-pivncraspberry-pi4vnc-server

Starting VNC server on startup on RaspberryPi


I would like the VNC server of my RPi 4 to start automatically on startup (for both local and internet connection). I followed the guidelines of the RealVNC website. Hence I used the command :

sudo systemctl enable vncserver-x11-serviced.service

But it doesn't work (for both connection type), I got a timeout. Then I tried this solution with a autostart file like that:

[Desktop Entry]
Type=Application
Name=TightVNC
Exec=vncserver :1
StartupNotify=false

But same, the VNC server doesn't start automatically after a reboot. The SSH connection works fine, so, at least the local VNC should work. Even when I use the command to start the VNC server, I cannot connect.

What can be the issue? I don't know if you need more informations? I'm trying to connect to the VNC server via the Viewer on Windows. It was working when I launched the server the first time with the GUI (now I'm using the Pi without screen).

Thanks in advance for your help.


Solution

  • Since few years now, there is an integrated tool to enable/disable many stuff including vnc and ssh.

    Maybe just remove the changes you've done manually before.

    Then run: sudo raspi-config

    This is a "graphical" (curses style, in console) app to changes many basic raspberry options. You should be able to enable VNC server at boot in menu "Interfacing Options".

    More information on this tool here: https://www.raspberrypi.org/documentation/configuration/raspi-config.md