User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

VNC connection only available if HDMI output is connected to tv

Sat Jan 18, 2020 12:16 am

I have a Pi4 which I use headless and connect to it using x11vnc. When I set it up initially the HDMI output was connected to a tv and everything worked correctly.

After disconnecting the HDMI cable to use for another Pi I find that if I reboot without the HDMI connected I am unable to connect via VNC until I reconnect the HDMI output and reboot.

It is not a major problem as I rarely reboot but strange that this is the only pi where this occurs.

I don't know what information about the pi to post except the basic.

Code: Select all

[email protected]:~ $ uname -a
Linux Pi4 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
[email protected]:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
[email protected]:~ $ 
Autostart entry :
x11vnc.desktop

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Comment=
Exec=x11vnc -forever -usepw -norepeat -nevershared -noxdamage -display :0
StartupNotify=false
Terminal=false
Hidden=false
This is the pi which works whether HDMI is connected or not:

Code: Select all

[email protected]:~ $ uname -a
Linux Pi-scratch 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux
[email protected]:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
[email protected]:~ $ 
Start service:

Code: Select all

sudo nano /etc/systemd/system/x11vnc.service
Entry:

Code: Select all

[Unit]
Description=x11vnc remote desktop server
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/pi/.vnc/passwd -rfbport 59$

Restart=on-failure

[Install]
WantedBy=multi-user.target

User avatar
HawaiianPi
Posts: 5471
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: VNC connection only available if HDMI output is connected to tv

Sat Jan 18, 2020 12:42 am

With the Pi4 you must configure a manual resolution if you have no monitor connected. Resolution can be set in the CLI raspi-config utility.

Code: Select all

sudo raspi-config

On older models the system will automatically switch to composite output when no HDMI display is connected, but that is not done with the Pi4 because it requires altering the system frequency in such a way that would affect performance, so composite is disabled by default. This means that there is no video output when no HDMI screen is connected, so there is no GUI/Desktop for VNC to display.

When you manually configure a resolution it forces HDMI and runs the GUI, so VNC works.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sat Jan 18, 2020 8:26 pm

Thank you for that explanation.

I did try changing the resolution via raspi-config, not for the reason you suggest but because the vnc screen was to small on my monitor.

None of the options in raspi-config seemed to give a 'full' screen' view on my laptop (monitor) and for various reasons were unsuitable. The only setting which worked was to use the default. Then I had a 'full screen' and the icons/font was ideal. Of course, I did not realise at that time the HDMI was involved.

So, having tried setting the resolution manually using raspi-config, what other method would you advise? I would have thought that just turning of HDMI and switching to composite was possible? It seems all the settings in raspi-config are CEA which I understand are for tv.

Having your explanation allowed me to find what should be the answer as I was preparing this reply.

I read https://www.raspberrypi.org/forums/view ... p?t=251277 by rpdom that it is necessary to add the following in .config.txt:

Code: Select all

enable_tvout=1
I will be trying that and it may also fix the below problem too, hopefully.

As a side note, as settings currently are I am getting very bad breaking up of text and icons. It is necessary to click the alt button twice to correct it temporarily.

ElEscalador
Posts: 814
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: VNC connection only available if HDMI output is connected to tv

Sat Jan 18, 2020 9:42 pm

Look over these options...I'm not certain that the enable_tvout=1 will do what you want. I think you need to use hdmi_force_hotplug=1and then set the hdmi_group=xx and hdmi_mode=xx options to whatever works for you. I think I used to use group 2 and mode 16, but it's been a while. All of those options in the link:

https://www.raspberrypi.org/documentati ... t/video.md
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sat Jan 18, 2020 11:17 pm

I had a quick check if the suggestion by rpdom would do the job and yes, the pi does boot up without hdmi connected but the broken text and some underlining still exists.

However, the screen is tiny and I don't have the chance of trying to make it full screen on my laptop at the moment but at least I am halfway there. (Visiting wife in hospital daily)

I will do some research tomorrow in the composite video settings posted above. Seems I need to set the actual resolution manually because composite has been selected. At least I know it has to be 1920x1080.

User avatar
HawaiianPi
Posts: 5471
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 12:34 am

Manually setting a resolution in raspi-config should also enable hdmi_force_hotplug=1 option, but the chosen resolution may not be the resolution displayed. Don't know why, but if that happens you can manually configure it in the GUI.

Menu > Preferences > Screen Configuration
screenresolution.jpg
screenresolution.jpg (27.21 KiB) Viewed 1048 times

Note that the HDMI numbering is wrong (HDMI1 = HDMI0). This is due to a known quirk from upstream in Linux (not a Raspbian or Raspberry Pi specific problem).

In addition, there are full screen and GUI scaling buttons in the VNC controls you can play with.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 10:09 am

HawaiianPi wrote:
Sun Jan 19, 2020 12:34 am
Manually setting a resolution in raspi-config should also enable hdmi_force_hotplug=1 option, but the chosen resolution may not be the resolution displayed. Don't know why, but if that happens you can manually configure it in the GUI.

Menu > Preferences > Screen Configuration
screenresolution.jpg

Note that the HDMI numbering is wrong (HDMI1 = HDMI0). This is due to a known quirk from upstream in Linux (not a Raspbian or Raspberry Pi specific problem).

In addition, there are full screen and GUI scaling buttons in the VNC controls you can play with.
My available settings differ from yours. I only see composite selection, nothing else.

I have found the VNC screen settings you refer to and now have full screen but monster font! Never, mind, in the time available I am making progress thank you and will look again later.

https://www.dropbox.com/s/ja224oj6ghwfp ... 0.png?dl=0

Edit: The setting in VNC which scales the screen does not survive a reboot.

User avatar
procount
Posts: 2157
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 10:28 am

makem wrote:
Sun Jan 19, 2020 10:09 am
My available settings differ from yours. I only see composite selection, nothing else.
Do you still have "enable_tvout=1" set? That's probably why.

Instead of trying to create a framebuffer for a non-existent HDMI monitor that vnc will share, you can start vnc in virtual mode so that it creates it's own framebuffer of whatever size you want, independent of any HDMI framebuffer.

https://help.realvnc.com/hc/en-us/artic ... esktop-0-5
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5550
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 2:32 pm

procount wrote:
Sun Jan 19, 2020 10:28 am
makem wrote:
Sun Jan 19, 2020 10:09 am
My available settings differ from yours. I only see composite selection, nothing else.
Do you still have "enable_tvout=1" set? That's probably why.

Instead of trying to create a framebuffer for a non-existent HDMI monitor that vnc will share, you can start vnc in virtual mode so that it creates it's own framebuffer of whatever size you want, independent of any HDMI framebuffer.

https://help.realvnc.com/hc/en-us/artic ... esktop-0-5
Whilst that is correct** AIUI @makem is not using a RealVNC viewer but, according to the o.p., x11vnc which, IIRC, is not compatible with RealVNC. Where I only need to remotely display one or two GUI apps I sometimes just use a PuTTY SSH connection with X-forwarding enabled and start them from PuTTY's command line - a hangover from my pre-retirement days when the m/c I was remotely connecting to could be someone else's (more powerful) desktop Unix/Linux box or a Linux cluster ....
Trev.
** and a method I often use as shown here: https://www.cpmspectrepi.uk/raspberry_p ... uster.html
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 4:08 pm

procount wrote:
Sun Jan 19, 2020 10:28 am
Whilst that is correct** AIUI @makem is not using a RealVNC viewer but, according to the o.p., x11vnc which, IIRC, is not compatible with RealVNC. Where I only need to remotely display one or two GUI apps I sometimes just use a PuTTY SSH connection with X-forwarding enabled and start them from PuTTY's command line - a hangover from my pre-retirement days when the m/c I was remotely connecting to could be someone else's (more powerful) desktop Unix/Linux box or a Linux cluster ....
Trev.
** and a method I often use as shown here: https://www.cpmspectrepi.uk/raspberry_p ... uster.html
[/quote]

That is a problem I suffer from - suggestions not in respect of the original post and if I as a novice take them up I often end in deeper trouble.

Now, an alternative suggestion has been made and I do appreciate all suggestions but I assume this means I must undo changes I have already made.

I use PuTTY and SSH but when everything is setup, I use an icon on the panel to select whichever pi I need at the time. I would dearly like to continue in that manner rather than have two or more alternative methods of accessing the pi's remotely from the same panel.

Now, I am unsure which way to go but no doubt if I persist I will get there. It was the difference between the Pi4 and the previous versions which threw me off I think. Anyway HWMBO is discharged tomorrow or Tuesday so time will be restricted anyway.
Last edited by makem on Sun Jan 19, 2020 4:31 pm, edited 1 time in total.

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 4:23 pm

procount wrote:
Sun Jan 19, 2020 10:28 am
makem wrote:
Sun Jan 19, 2020 10:09 am
My available settings differ from yours. I only see composite selection, nothing else.
Do you still have "enable_tvout=1" set? That's probably why.

Instead of trying to create a framebuffer for a non-existent HDMI monitor that vnc will share, you can start vnc in virtual mode so that it creates it's own framebuffer of whatever size you want, independent of any HDMI framebuffer.

https://help.realvnc.com/hc/en-us/artic ... esktop-0-5
Yes I do have enable_tvout=1 set as I said in my previous post in respect of:

www.raspberrypi.org/documentation/confi ... t/video.md

Which allowed the HDMI to be unconnected at boot time. So, as I see it at the moment, I need that setting. With Composite-1 the screen resolution is FIXEDMODE. I have never been down that path before!

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 5:03 pm

I think I need to state the current position and requirement as I for one am getting confused lol

I am using a Pi4, I do not want to connect to a tv via HDMI because when I do, the Pi is selected as the default TV screen, not the one previously in use.

This pi runs 24/7 and is never looked at via the TV.

I have Pi, 2 and 3 also running and each is selected from a panel icon on my laptop which is used as a monitor.

I have found that the x11vnc currently in use (and in use on the other pis') will not connect unless the Pi4 HDMI output is in use.

Searching suggested that in the case of the Pi4 it was necessary to switch on composite which is disabled by default.

This allows a Pi4 VNC connection but screen size is to small and I have failed to find anywhere to set it to fill the laptop screen that works across boots as it does on the other pi's.

User avatar
rpdom
Posts: 16744
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 5:09 pm

Eric. Poke me at some point during the week. I don't know much about this, but I can visit you and we can learn how to make it work together :)
Unreadable squiggle

User avatar
procount
Posts: 2157
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 5:46 pm

Sorry if I confused the situation. I missed the fact that x11vnc was stated. My experience is with realVNC and tightvnc, both of which allow a virtual display to be created. I think x11vnc is the exception to this and just copies an existing framebuffer.

OK. So the Pi4 is different to previous models in the creation of framebuffers, as Hawaiianpi has already detailed.
Without a hdmi monitor connected it will not create a framebuffer. So to get x11vnx to work you need to force a framebuffer to be created.

Setting "enable_tvout=1" will give you a framebuffer for the composite output, but on the Pi4, it will also give you slightly reduced performance due to having to adjust the clocks (which is why it is not enabled by default, unlike the previous models).
I don't know what resolution this is giving you by default, but as it is not sufficient for you, it's probably 640x480 or something similar, suitable for a standard composite TV. You could probably use "tvservice -s" or "fbset" to discover the current resolution.

To force the Pi4 to create a framebuffer for the HDMI, even when you are not using a HDMI monitor, you should replace the "enable_tvout=1" in config.txt with "hdmi_force_hotplug=1". I think this should allow your x11vnc to work as it did previously.
If the font or resolution is not as you require, add "hdmi_group" and "hdmi_mode" settings to config.txt according to the hdmi_mode tables here -> https://www.raspberrypi.org/documentati ... t/video.md. e.g. "hdmi_group=2" and "hdmi_mode=28" will give you a 1280x800 resolution.

I hope this explains the problem better and provides a better solution. Although it is only a suggestion as I don't use x11vnc.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 6:19 pm

rpdom wrote:
Sun Jan 19, 2020 5:09 pm
Eric. Poke me at some point during the week. I don't know much about this, but I can visit you and we can learn how to make it work together :)
Many thanks Dominic, I hate to bother you but may yet need to take up your offer as you will also learn ;)

My wife has had major surgery and is discharged 20/21st. I will give her a few days to get back on her feet at home (knee replaced) and then make contact. Poke, whats that lol. Never mind, I do have your email.

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 6:21 pm

procount wrote:
Sun Jan 19, 2020 5:46 pm
Sorry if I confused the situation. I missed the fact that x11vnc was stated. My experience is with realVNC and tightvnc, both of which allow a virtual display to be created. I think x11vnc is the exception to this and just copies an existing framebuffer.

OK. So the Pi4 is different to previous models in the creation of framebuffers, as Hawaiianpi has already detailed.
Without a hdmi monitor connected it will not create a framebuffer. So to get x11vnx to work you need to force a framebuffer to be created.

Setting "enable_tvout=1" will give you a framebuffer for the composite output, but on the Pi4, it will also give you slightly reduced performance due to having to adjust the clocks (which is why it is not enabled by default, unlike the previous models).
I don't know what resolution this is giving you by default, but as it is not sufficient for you, it's probably 640x480 or something similar, suitable for a standard composite TV. You could probably use "tvservice -s" or "fbset" to discover the current resolution.

To force the Pi4 to create a framebuffer for the HDMI, even when you are not using a HDMI monitor, you should replace the "enable_tvout=1" in config.txt with "hdmi_force_hotplug=1". I think this should allow your x11vnc to work as it did previously.
If the font or resolution is not as you require, add "hdmi_group" and "hdmi_mode" settings to config.txt according to the hdmi_mode tables here -> https://www.raspberrypi.org/documentati ... t/video.md. e.g. "hdmi_group=2" and "hdmi_mode=28" will give you a 1280x800 resolution.

I hope this explains the problem better and provides a better solution. Although it is only a suggestion as I don't use x11vnc.
Many thanks for taking the time to reply but in this case I think the circumstances suggest I leave this for a while as it is.

User avatar
rpdom
Posts: 16744
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 6:21 pm

makem wrote:
Sun Jan 19, 2020 6:19 pm
rpdom wrote:
Sun Jan 19, 2020 5:09 pm
Eric. Poke me at some point during the week. I don't know much about this, but I can visit you and we can learn how to make it work together :)
Many thanks Dominic, I hate to bother you but may yet need to take up your offer as you will also learn ;)

My wife has had major surgery and is discharged 20/21st. I will give her a few days to get back on her feet at home (knee replaced) and then make contact. Poke, whats that lol. Never mind, I do have your email.
Yes, poke in this case means email. My wife is still recovering from her broken hip a while back. I hope your wife is recovering well from her knee operation.
Unreadable squiggle

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 6:51 pm

rpdom wrote:
Sun Jan 19, 2020 6:21 pm
makem wrote:
Sun Jan 19, 2020 6:19 pm
rpdom wrote:
Sun Jan 19, 2020 5:09 pm
Eric. Poke me at some point during the week. I don't know much about this, but I can visit you and we can learn how to make it work together :)
Many thanks Dominic, I hate to bother you but may yet need to take up your offer as you will also learn ;)

My wife has had major surgery and is discharged 20/21st. I will give her a few days to get back on her feet at home (knee replaced) and then make contact. Poke, whats that lol. Never mind, I do have your email.
Yes, poke in this case means email. My wife is still recovering from her broken hip a while back. I hope your wife is recovering well from her knee operation.
I hope her recovery is now going well, it's been a while I know.

User avatar
HawaiianPi
Posts: 5471
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 7:15 pm

FTrevorGowen wrote:
Sun Jan 19, 2020 2:32 pm
Whilst that is correct** AIUI @makem is not using a RealVNC viewer but, according to the o.p., x11vnc which, IIRC, is not compatible with RealVNC.
doh.jpg
doh.jpg (10.85 KiB) Viewed 857 times

I missed that in the OP. My bad! Apologies to makem for any confusion I have caused.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 8:29 pm

Well, lateral thinking...........................maybe the TV can fix the problem?

It appears it can!

I have a Panasonic Smart TV with 4 HDMI inputs and ARC. Panny uses Viera Link and it was turned ON!! It seems turning that to 'OFF' stops it automatically connecting to an HDMI input which is 'live' as the Pi4 is. The other Pi's are also live but they do not cause this problem, only the Pi4 does.

So, my fix for this thread is, leave the Pi4 HDMI connected, which gives a full VNC screen and fix the TV end if that is possible.

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 8:47 pm

I don't think the Pi4 and x11vnc live well together. I have the tearing of the screen but in my case I can live with that.

I wonder if this could be caused by the 'tuning' of the Pi4 for RealVNC. If it is, then that is very annoying as it would mean changing all my VNC software for RealVNC. I did try RealVNC at one time as not happy with it.

I saw a mention of screen tearing in the x11vnc manual I think so must look that up.

I intended to use a Pi4 to teach my 8 year old grandson Scratch programming on the Pi. Screen tearing would be a major problem for that use. Such a shame as the Pi4 is more suitable for home robot learning. I don't want him to get the idea that 'Edison' and 'Edscratch' is the bees knees @ £56 for for the block and £56 for an 8 week club lesson period!

User avatar
makem
Posts: 300
Joined: Tue Jun 18, 2013 9:22 pm

Re: VNC connection only available if HDMI output is connected to tv

Sun Jan 19, 2020 8:49 pm

makem wrote:
Sun Jan 19, 2020 8:47 pm
I don't think the Pi4 and x11vnc live well together. I have the tearing of the screen but in my case I can live with that.

I wonder if this could be caused by the 'tuning' of the Pi4 for RealVNC. If it is, then that is very annoying as it would mean changing all my VNC software for RealVNC. I did try RealVNC at one time and not happy with it to the extent that having enabled it on the Pi, I reinstalled the OS..

I saw a mention of screen tearing in the x11vnc manual I think so must look that up.

I intended to use a Pi4 to teach my 8 year old grandson Scratch programming on the Pi. Screen tearing would be a major problem for that use. Such a shame as the Pi4 is more suitable for home robot learning. I don't want him to get the idea that 'Edison' and 'Edscratch' is the bees knees @ £56 for for the block and £56 for an 8 week club lesson period!

Return to “Raspberry Pi OS”