Can You VNC to a Desktop on a Headless Raspberry Pi?22 Jun 2020
No keyboard, mouse, or monitor required!
In my last blog post, I figured out how to enable SSH access to a Pi Zero W without attaching a mouse, keyboard, or monitor. This us useful because it means you don’t need a micro-HDMI or micro-USB OTG cable to attach a monitor, keyboard, or mouse. But can we take it a step further? I wanted to find out if I could get a GUI desktop environment running without attaching a monitor to the Pi. And I did it!
After gaining SSH access to the Pi, it was fairly simple to set up VNC and get to a desktop environment on the Pi without ever connecting a monitor. Here’s what I did:
- Set up SSH access on the Pi (as I describe here) and connect via SSH.
- Setting up a VNC server on the Pi is easy because the OS comes with
installed. On the Pi, run
- We’re done with config. Exit raspi-config.
- On the computer you’re going to connect from, you’ll need to install a VNC Viewer. Download and install RealVNC Viewer.
- Open VNC Viewer and connect to your Pi (using the same IP address you use to ssh). Log in with the same credentials you use to SSH.
Is This Actually Usable?
Kind of. I tested a VNC connection to a Raspberry Pi Zero W desktop. The Pi Zero has a 1GHz single-core CPU and only 512MB RAM – not much to work with! I was able to log in to the default LXDE desktop environment, and the UI was responsive enough to use. Simple applications ran a little slow, but were usable. It took about 4 seconds for the terminal app to open, and about 5 seconds for the text editor to open. Once they were open, they were pretty responsive. There wasn’t a noticeable delay when typing. Bigger apps, however, weren’t really usable. Chromium took a whopping 35 seconds to open, and was very slow to open a new tab. It felt like running Windows XP on an underpowered computer. I think the slowness was primarily due to the limitations of the Pi itself rather than the VNC setup.
So overall, the VNC user interface would work well enough for doing some simple setup, or installing whatever software you want to run on the Pi. But more intensive things like web browsing are too slow to be really useful. And that makes sense. If you want to use the Pi as a simple desktop computer for things like web browsing, you’ll want to get a better version than the Pi Zero anyway. I’d say the Pi Zero is not usable for even simple desktop work. But if you’re using it for a simple project or home server and you need a GUI to set it up, VNC could be really helpful! Honestly though, if you’re comfortable enough at the terminal, I’d probably just stick to SSH.
This is part 3 of a 3-part series exploring the Raspberry-Pi Zero.
- Part 1: Headless Setup for a Raspberry Pi Zero-W
- Part 2: Can You VNC to a Desktop on a Headless Raspberry Pi?