Mike Kasberg

Husband. Father. Software engineer. Ubuntu Linux user.

Image for Can You VNC to a Desktop on a Headless Raspberry Pi?

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:

  1. Set up SSH access on the Pi (as I describe here) and connect via SSH.
  2. Setting up a VNC server on the Pi is easy because the OS comes with one installed. On the Pi, run sudo raspi-config.
    1. Select Interfacing Options.
    2. Enable VNC.
    3. We’re done with config. Exit raspi-config.
  3. On the computer you’re going to connect from, you’ll need to install a VNC Viewer. Download and install RealVNC Viewer.
  4. 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.

VNC Viewer showing Pi Desktop

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.

About the Author

Mike Kasberg

👋 Hi, I'm Mike! I'm a husband, I'm a father, and I'm a senior software engineer at Strava. I use Ubuntu Linux daily at work and at home. And I enjoy writing about Linux, open source, programming, 3D printing, tech, and other random topics.

Share!

Sharing my blog posts is a great way to support me and help my blog grow!

I run this blog in my spare time, without any ads. There's no need to pay to access any of the content on this site, but if you find my content useful and would like to show your support, this is a small gesture to let me know what you like and encourage me to write more great content!