I run VNC through raspi-config. Turns on. I run sudo vncserver. Works. I reboot. Everything is shut down/disabled and i have to redo it. How can i permanently enable vnc? (raspbian, over ssh)

error i get is connection refused. If i run sudo vncserver and not enable vnc in config it gets stuck in console of ssh. Im pretty sure by now it does not save the changes. Each time i get the same display output raspberry:1.

SD card is new and fine. Everything else gets saved.

Tried: purging and reinstalling.

  • 1
    The raspi-config enables and starts the VNC sevice by running systemctl enable vncserver-x11-serviced.service && systemctl start vncserver-x11-serviced.service. You can check the status of the service after boot with systemctl status vncserver-x11-serviced.service. Try it to check if the problem is somewhere else.
    – GramThanos
    Mar 18, 2019 at 17:29
  • Which Pi? Which VNC server software? I had a strange situation... the same microSD card worked on Pi 3 B+, but not on Pi 3 A+ using the default VNC (RealVNC in Raspbian Stretch). On the A+, I could see the process running, but no listener port (5900). (I could force-start it manually but it would not start automatically). This fixed it: help.realvnc.com/hc/en-us/articles/… Mar 18, 2019 at 19:25
  • it is running in service mode.
    – Sci00213
    Mar 19, 2019 at 13:43
  • The OP indicated in a Comment that this was resolved but failed to accept or post an answer.
    – Milliways
    Mar 4 at 5:06

3 Answers 3


The vncserver command starts a vnc virtual desktop, whereas enabling vnc in raspi-config starts the vnc service mode server (which provides access to the console desktop). The service mode server usually runs on display :0 and virtual mode on :1 and above.

  • I am at a point where it runs but i get connection refused every time. Vncserver stops after OS:RASPBIAN line. I cut it out with ctrl+c.
    – Sci00213
    Mar 19, 2019 at 13:45
  • The vncserver command does not execute when typed anymore. It just stops at OS:raspberry line. No key generation.
    – Sci00213
    Mar 19, 2019 at 14:20
  • Reinstalled. Works.
    – Sci00213
    Mar 19, 2019 at 15:19

I know that a lot of people like to use realvnc, since it comes pre-installed on Raspbian. My feeling is that it's a bit heavyweight, so I've invested in sorting out what a lightweight and "systemd-proper" VNC install looks like. In this method, VNC uses literally no memory if it's not running. systemd starts the VNC servers on demand as needed.

You can find the documentation on this at How to Install Efficient VNC on Raspbian


I had the same problem on a Raspberry Pi 4. I couldn't make the changes to the VNC config persistent.

For me, installing the library 'haveged' with sudo apt install haveged solved the problem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.