Pi headless configuration - VNC

I am trying to connect to my Pi4 over my network from another computer running VNC viewer. I have set up VNC viewer and it works fine. That is I can select to the Pi4 from the computer and open it when I have a monitor connected to the Pi4.
But I want to run the Pi4 headless. When I disconnect the Pi4 monitor and reboot the Pi I can no longer VNC to it. It says - “cannot currently show the desktop”. When I plug the monitor back in and reboot the PI I can VNC connect again.
I have tried adjusting the frame buffer in the boot/config.txt file to:
‘framebuffer_width=1920
framebuffer_length=1080’
makes no difference
I have tried setting:
‘hdmi_group=2
hdmi_mode=82’
does not help
I have seen a link saying :slight_smile: Preferences>RaspberyPiConfuguration>Display>HeadlessResolution
But I do not get this headless option when I try this - Headless is not available in the menu.

Please advise

SideNote:
Does anyone know if I can VNC into both windows machines and Pi machines from both the Pi machines and the windows machines? I hope to have one Pi with monitor and one windows with monitor on a network with many other Pi’s and windows machines running headless in an instrumentation / control lab. Do I need to install some VNC server on the windows boxes? Want to be able to VNC into any Pi or windows machine from either the Pi or windows machine with monitor.

2 Likes

Hi Clem,

Thanks for making a topic!

It sounds like you might have screen blanking enabled.
This guide covers a few different methods of disabling it: Screen blanking on Raspberry Pi – How to disable it?

Yeah, you can install both the viewer and server on a range of devices, Windows and Raspberry Pi included(for both). You can configure VNC a couple of ways, locally and through web - it’s worth taking a read through.

PS: Typically the Pi would be your endpoint(running the server) so it might be a bit laggier than if you were remoting in from a PC

Liam

2 Likes

I have turned screen blanking OFF and it does not make any difference still same problem.
I have also added a blank ( no characters empty, no file extension) ssh file to the root directory in the Pi using nano AND also an empty ssh file to the boot directory by taking the SSD drive out and putting it into a windows machine. Still no difference.

Please advise

1 Like

Hi Clem,

Did you restart your Pi after changing screen blacking?
I’ve setup quite a few Pis with VNC by only changing the screen blacking and HDMI config (force_hotplug, mode and group).

Which OS were you using and the specific build? I like to keep things stable with the most recent (stable) build of Buster.

Let us know how you go!
Liam

1 Like

setting
hdmi_safe=1
in the /boot/config.text file has worked!

Still trying to get the screen size to be able to be selected.

1 Like

Hi Clem,

Using the safe HDMI mode overrides all other HDMI output options with some defaults.

See hdmi_safe=1 not as documented? - Raspberry Pi Forums

1 Like

I have now found that I have got it working without setting hdmi_safe=1. What I needed to do was deliberately set the monitor resolution first. If the second machine which VNC into the pi has a screen resolution less than or equal to the pi setting the pi defaults to some different size resolution. It seems that this can only be overridden by actually having the monitor plugged into the pi.

1 Like