-
-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VNC won't show desktop when HDMI port is unplugged #4672
Comments
Did you try using port 5901? As well you could check listen ports as follow
|
The port should be the default VNC port, however, when connecting to a virtual desktop, assure to use screen But actually, as long as there is an actual X11 desktop session running, the VNC servers should be able to connect to it as well, despite a HDMI cable being attached or not, but I'm not sure whether the RPi collapses some video features which breaks the X11 server, when unplugging it. Would be interesting what happens if you have a screen attached, open a regular desktop session, connect via VNC and then unplug the screen: Does the VNC session break or stay functional? If it breaks, what does the following show? journalctl -u vncserver-x11-serviced However, if you do not aim to have a co-session on real screen + VNC, but only want a remote desktop, I'd simply use the virtual X11 session at |
Yes, I've tried port 5901, it's not working. Connection was refused. Here's the output of my ports:
|
Do you use the HDMI output for any case or should it be a headless system? |
Hey! Than you for your reply! I tried to start the Pi with HDMI cable, disconnect the cable and then connect to VNC. It works!
It's strange, because the 5900 port has 0.0.0.0:5900 IP address and I can't see the VPN connection (Wireguard) as well. |
I designed at a headless system. During the test session I have the PI next to my TV, so I can connect the HDMI cable whenever I want, the only thing bothering is when I restart the PI, the TV changes the screen to the newly connected device... |
Wireguard VPN is using UDP and not shown this way. IP 0.0.0.0 means listen on all interfaces and it should be fine. |
Okay. Got it. I thought the VPN firewall blocks the connection.
|
Does it mean you like to connect to VNC via VPN? Are you able to reach PiHole web interface via VPN? |
The PI is connected to a VPN service at all the times. Pi-hole and other application's web interface is working properly. This is my wg0.conf file, the firewall rules are defined in iptables:
|
By the way, when I'm connected to the VNC server and the TV is on, with the Pi connected, I see the same screen on my laptop and my TV. So what I'm doing on my laptop, shows on the TV as well. This is something I also want to avoid. When I'm doing something on my laptop, I don't want the TV to show the same thing. I'm just guessing, but probably I need to use a different screen. In normal circumstances, it would look like this: IP address:0 and IP address:1. Right? |
having the shared screen is somehow expected according our online docs. https://dietpi.com/docs/software/remote_desktop/#realvnc-server @MichaIng |
Okay, so to clear things up:
As you do not want to have a shared desktop, I'd disable the related RealVNC service which checks for and automatically connects to real desktop sessions: systemctl disable --now vncserver-x11-serviced The virtual desktop session is controlled by our wrapper service: systemctl enable --now vncserver
journalctl -u vncserver Btw, do you have a RealVNC enterprise subscription? I'm not advertising it but it would allow a bit more efficient virtual desktop session handling which makes sense to use when having a subscription anyway. @Joulinar |
@MichaIng disabling the service
starting our service
no VNC service LISTEN
After reboot
|
@Joulinar Ah dammit, RealVNC can only be connected to with RealVNCs own clients, right? 😢 EDIT: Ah, passing |
@MichaIng I've followed your description, then
VNC port is present:
The problem is still present, can't show the desktop. I've tried to play with ports, adding :1 or :0 to the IP address, but didn't work. |
Can you both please paste: grep 'SOFTWARE_VNCSERVER_SHARE_DESKTOP' /boot/dietpi.txt In my case it works both: The shared desktop service is not starting by itself, after having it disabled (it was never enabled) and the virtual desktop session is successfully started by our wrapper service. But it depends on |
I've set it to 1 but it doesn't change the behaviour
|
So then it works as expected: As you chose shared desktop mode, the RealVNC shared desktop service is started. Change it to You changed it to |
Yes I did following our discussion. But it doesn't matter if it is |
Okay, that is strange. What happens when you have systemctl stop vncserver
systemctl stop vncserver-x11-serviced
vncserver start
sleep 5
systemctl status vncserver
systemctl status vncserver-x11-serviced |
VNC is connecting to the real X11 session
|
Okay, in my system the EDIT: |
@MichaIng I did this while the HDMI cable was plugged in, no screen on the TV, only VNC desktop:
|
The virtual VNC session shouldn't depend on any GPU or display settings, only the real (HDMI) session and hence shared session should. Based on your output, it's still the same: The shared session service starts, the virtual desktop not. So now: Why does it not work on both your systems while it works perfectly fine on mine. Do you both have desktop autologin enabled? |
After restart, I'm able to connect to VNC and see the desktop and there's also signal to the TV. Right now it's a shared desktop. So whatever I do on the VNC, I see the same thing on TV. |
Yes, autologin is enabled. |
Yes I do. I thought this was the question to have 2 parallel session. A real and a virtual one. |
Ahhh, now I see:
So when desktop autologin is enabled, we override the mode to "prevents another VNC server being launched on :1". While it mostly makes sense to use shared desktop mode, when you have a desktop autostarting anyway, it breaks the possibility to have both, virtual and shared desktop running, or to have a local desktop and an independent VNC desktop. And we only override the mode in case of RealVNC, but not for TigerVNC, which isn't consistent. Fix it via: sed -i '/SHARED_MODE=1/d' /usr/local/bin/vncserver I'll do the same in our code. But the idea behind it stays valid. Do not enable desktop autologin unless you really have a HDMI and keyboard attached that you want to use, else it consumes unnecessarily a lot of resources. |
@MichaIng It worked! Now I have a virtual VNC desktop and a "real" desktop on the HDMI port. So, you're recommending to keep only a virtual desktop if I don't use the HDMI port often, because it consumes a lot of resources. Am I understanding right? |
Yes exactly. Better to either use the LightDM based login mask or common console login + |
All right! I appreciate your time for working on this! |
Let me keep this open until I finished the rework, I'm currently doing 🙂. |
Hi there!
I have a constant issue with Dietpi. Currently I'm using Dietpi 7.4.2 and I'm running it on a Raspberry Pi 4. I've installed RealVNC server on my Pi and client on my Mac.
I didn't change anything on the server, it is as is. I connect using an IP address, I didn't specify the port number, however I've tried to connect with the port 5900. It works the same way. I've set the resolution to 1280x720. Every time I disconnect the HDMI cable, the VNC won't show the desktop. I've even reinstalled the whole system, but it doesn't fix this problem. Any suggestions for what should I try to resolve this issue?
The text was updated successfully, but these errors were encountered: