12

I am using Raspian Stretch and I can not set the resolution of my desktop when using VNC headless.

I am using Real VNC because it comes by default (I have it configured there).

I have no monitors plugged in.

I have tried all the suggestions here

Currently I have the following saved in /boot/config.txt

hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080      
hdmi_group=2     
hdmi_mode=16

but still it looks like it boots into 640x480.

When I try to set this from the Raspberry Pi Configuration GUI, no options are available (only "Default - preferred monitor settings").

When I do not make these changes to config.txt I can set the monitor resolution from the GUI but still no changes take place.

Please let me know if you have a solution to this issue.

7 Answers 7

13

My solution for this problem of resolution being stuck at 640x480 wwith RealVNC access to a headless Raspberry PI with Raspbian Buster was not exactly listed in the answers above, and to compound matters, my config.txt is apparently newer than that posted by @andrew-g-za. After some experimentation, I found that if I comment out the lines towards the end (as shown below) I was able to achieve a 1920x1080 resolution with my remote headless connection.

    [pi4]
    # Enable DRM VC4 V3D driver on top of the dispmanx display stack
    #dtoverlay=vc4-fkms-v3d
    #max_framebuffers=2

    [all]
    #dtoverlay=vc4-fkms-v3d
    [all]
    #dtoverlay=vc4-kms-v3d

I want to thank @Luis Augusto Libório and @breversa for their contributions to this solution. Also, I beg to differ with @David G over his comment:

If you are using a true HEADLESS VNC, then nothing in config.txt will do a damn thing.

as those of you facing the same problem that I had will probably attest once you try this fix.

2
  • 1
    I worked my way down through the answers and this one did it for me. Commented Feb 24, 2021 at 19:28
  • this FIXED for me! I was stuck on "Composite-1" poor resolution. Doing the above, it "unlocked" the resolution settings in raspi-config! So you have to set it and reboot and it works!
    – Allexj
    Commented Feb 22, 2022 at 15:35
8

Thank you so much!! I've been trying really hard to solve this problem, and this is it, as you said:

in the config.txt file, comment those lines:

#Enable DRM VC4 V3D driver on top of the dispmanx display stack
#dtoverlay=vc4-fkms-v3d
#max_framebuffers=2

and voila!! Now you can configure your video settings as you wish.

2

I followed the instructions on RealVNCs troubleshooting page.

In brief,

  • Open the Raspberry Pi configuration application ('Start' > Preferences > Raspberry Pi Configuration)
  • On the system tab, click the Set Resolution.. button
  • Choose the resolution you want
  • Reboot

I did this all in headless mode via a VNC session on a fresh Raspian Stretch install, using VNCViewer 6.0.1 on Windows.

Perhaps you aren't given any resolution options because you have already forced a resolution - have you tried editing config.txt to set the video mode back to default?

For reference, here's my /boot/config.txt file:

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=16

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

This corresponds to a display resolution of 1024x768 @ 60Hz according to the config.txt documentation

Here's the options that are presented in the resolution settings: enter image description here

I find the drop-down a bit touchy, you need to click and hold to get the list to display correctly.

4
  • Yes and there are still no options to set resolution.
    – Startec
    Commented Sep 25, 2017 at 18:47
  • Does the GUI not provide options, or do they not apply when you select them? Commented Sep 26, 2017 at 15:13
  • It presents no options.
    – Startec
    Commented Sep 28, 2017 at 2:12
  • i've added a screenshot of the config i see - is yours anything like that? do you have any custom settings for VNC, either on the pi or locally? Which model of raspberry pi are you running this on? Commented Sep 28, 2017 at 21:03
0

In addition to @andrew-g-za’s answer, please make sure that you’re NOT using the (at the current time) still experimental OpenGL driver !

Using the Full KMS OpenGL driver results in the resolution being set to the lowest one, even if you select another.

Using the Fake KMS OpenGL driver results in the resolution being able to be set higher, but not necessarily as high/the same as what you selected (but it may be sufficient enough for your needs).

Using the legacy driver should honor the selected resolution.

In the /boot/config.txt file, the OpenGL driver options are (usually) at the bottom of the file (look for vc4-kms-v3d or vc4-fkms-v3d). I don’t have access to my RaspPi right now, but I’ll try and add more info later.

Also worth reading/exploring : https://github.com/raspberrypi/linux/issues/1644

0

If you are using a true HEADLESS VNC, then nothing in config.txt will do a damn thing. This is also the right way to run VNC on a unix system. This means a VNC server that does not interact with any physical display. I believe "tightvnc-standalone-server" is a current packaging for this.

What you do in this case is ensure the VNC server's command line includes "-geometry widthxheight" (and maybe "-dpi number") to explicitly set the values.

Edit: The current packages appear to be tightvncserver and tigervnc-standalone-server. Apparently I combined the two names.

5
  • Using vncserver -geometry 1280x1024 from my ssh session and then using the New Desktop is 192.168.0.150:1 in VncViewer worked for me. Also, vncserver -geometry 1280x768 and vncserver -geometry 1920x1080 Commented Jan 2, 2021 at 10:44
  • 1
    As others have said, config.txt does affect the way the VNC server operates with the Raspberry Pi OS.
    – Bob Brown
    Commented Nov 17, 2021 at 12:40
  • @BobBrown I said "true headless vnc". Not no monitor -- no video card. A purely software solution. config.txt affects the hardware resolution, and as such is irrelevant. (I suspect OP assumed incorrectly that no monitor meant headless.)
    – David G.
    Commented Nov 20, 2021 at 13:12
  • @DavidG. The concept of "video card" does not make sense in the context of the Raspberry Pi as the GPU is part of the Broadcom SoC. Using the VNC server that's part of the OS release requires changed to config.txt.
    – Bob Brown
    Commented Nov 20, 2021 at 20:38
  • @BobBrown OP asked about HEADLESS VNC. He may not have been using it, but that doesn't mean that shouldn't be answered. The [corrected] package(s) I referred to are part of the OS distribution, though perhaps not part of some prepackaged filesystem. And while "video card" makes less sense with a PI, it makes perfect sense when talking about headless VNC.
    – David G.
    Commented Nov 22, 2021 at 12:30
0

This is an old thread but here is my take after a day of researching and testing.

hdmi_force_hotplug=1 This is forcing fake monitor on HDMI port with resolution set to 640x480. Headless option does not work as long as hotplug=1 is in effect.

You could set hdmi_group=2 and hdmi_mode=16 (or similar) to get resolution permanent but it defeats headless settings. After plugging monitor with hotplug=1 "xrandr -s 0" will reset it to current monitor default size.

dtoverlay=vc4-fkms-v3d max_framebuffers=2 This will set new multimonitor driver or revert to old settings when disabled. Headless works with this driver when hotplug is desabled.

2 options for this issue:

  1. Don't use hotplug=1 option in config.txt and utilize headless for VNC. You need to reboot to get local monitor working with this.
  2. Use hdmi_force_hotplug=1, group and mode to set resolution for VNC. Use "xrandr -s 0" in command mode to reset the screen when monitor is plugged in. You could use "xrandr -s 0" again when monitor unplugged to set it back to your preferred VNC resolution.
0

@bill-anon 's comment may solve the issue on newest models but it didn't on mine (3B+ with Raspbian Buster). I actually solved by just by appending ,nocomposite to the dtoverlay option.

My config.txt looks like that:

...
# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=35
...
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
    
dtoverlay=vc4-fkms-v3d,nocomposite

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.