VNC connection timeout when monitor is detached

I’ve set up many Linux systems that allow VNC without needing the monitor to remain attached once it’s built (i.e. headless). I’ve just set up a Rocky Linux 9 system with RealVNC and gotten that to work with the monitor attached. However, if I pull the monitor off, the VNC client fails to connect with a timeout error. I’ve tried 1) just pulling the HDMI connection, and 2) shutting the system down before detaching the monitor.

For the second method (the shutdown and detach) I see vncserver virtuald, x11-serviced, and x11-core services running once I’ve restarted the server. But the vnc client times out trying to connect.

Any thoughts? I really don’t want to have a monitor attached to this server, I’m using it as a VM host.

The solution was to rebuild the system and use tigervnc instead of realvnc.

Hi, I am a newbie trying to set up tigervnc on Rocky Linux 9, can you share the details of how to configure (securely)? To be specific, I have done the following:
# dnf install tigervnc tigervnc-server
# su - username
username> vncpasswd

Now I should create the file /etc/systemd/system/vncserver@<something here?>.service, but the default file I find in /lib/systemd/system/vncserver@.service is different - has different entries under [Service] than what is written in an online HowTo

I don’t think the answertopia HowTo is correct because it says to open a port in the firewall but I didn’t think I have to do that if vncserver runs as a service. Also opening port 5901 is also not in the RedHat 9 documentation, although this says nothing about the contents of /etc/systemd/system/vncserver@.service:

So any help is greatly appreciated!

Solved my problem: follow the RedHat instructions, don’t open ports, don’t create any files /etc/systemd/system/vncserver@.service in fact remove any such files that exist. Simply edit the /etc/tigervnc/vncserver-config-defaults:

and the /etc/tigervnc/vncserver.users file:

then DON’T run the following, because I’m connecting through SSH:
DON’T [root]# firewall-cmd --permanent --add-service=vnc-server
DON’T [root]# firewall-cmd --reload
Since I had previously set vncpasswd and failed, restore SE Linux context just in case:
[username]$ restorecon -RFv ~/.vnc
Start vnc server for user:
[root]# systemctl enable --now vncserver@:2
Since I use NVIDIA drivers, edit [daemon] section of /etc/gdm/custom.conf:
Then reboot:
[root]# reboot

To login securely from Windows 10 box, set up ssh tunnel in cmd window:
ssh -L 5900: username@remote-ipaddress

Now point Win10 VNC client (e.g. TigerVNC) to, enter VNC passwd, get user login! Trying the same with remote-ipaddress:5902 fails to connect, good.