VNC on Raspberry Pi shows Cannot Currently Show the Desktop

10,836

Solution 1

Raspbian Buster:

  1. Launch command line and run:

    sudo raspi-config

  2. Display options -> Resolution. Then select a resolution mode, I recommend select 1280x720 but you can also choose the higher resolution (1920x1080). Save and finish.

  3. Reboot and connect to raspberry again through VNC client.

Raspbian Bullseye:

  1. Launch command line and run:

    sudo raspi-config

  2. Display options -> VNC Resolution. Then select a resolution mode, I recommend select 1280x720 but you can also choose the higher resolution (1920x1080). Save and finish.

  3. Reboot and connect to raspberry again through VNC client.

Solution 2

According to the documentation:

If your Raspberry Pi is headless (i.e. not plugged into a monitor) or controlling a robot, it is unlikely to be running a graphical desktop.

So the idea is to create a new virtual desktop via vncserver command and use the display number in VNC.

Solution 3

Basically should be sufficient to specify a HDMI mode. I have a Raspberry Pi4 headless, this is my configuration in /boot/config.txt

# 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=82

# 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 infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

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

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

[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
gpu_mem=128
start_x=1
enable_uart=1
#hdmi_enable_4kp60=1

Then I disabled encryption and set a VNC password. In addition, if you to see the raspistill/raspivid preview through VNC you have to enable this: RealVNC Viewer > Menu > Options > Troubleshooting > Optimize screen capture - select 'Enable direct capture mode'

Share:
10,836

Related videos on Youtube

Martin Vinter
Author by

Martin Vinter

Updated on June 04, 2022

Comments

  • Martin Vinter
    Martin Vinter almost 2 years

    I am trying to use VNC in a headless install on my Raspberry Pi 4, running Raspberry Pi OS, installed via Raspberry Imager. The install is more or less vanilla, as the only changes I have made are for connecting (seting up SSH, wireless and VNC as noted in this guide: https://www.tomshardware.com/reviews/raspberry-pi-headless-setup-how-to,6028.html).

    When I log in via VNC I get the "Cannot Currently Show the Desktop"-error. It should be possible to fix by changing the screen resolution via raspi-config, but that makes the pi unresponsive. Setting the pi to use "G3 legacy" should fix that issue either after a reboot or without (answers vary on that), but it doesn't seem to make a difference in either case.

    Does anyone know how I can get to connect via VNC to my pi?

    Thanks :)

  • Martin Vinter
    Martin Vinter about 3 years
    Hi rok. Thank you for answering. i have copy pasted your config file onto my pi, but it makes no differnce. My pi still hangs whenever I try to access screen resolution, and I can't get a desktop via VNC :(
  • rok
    rok about 3 years
    I don't understand what you mean by " I try to access screen resolution".. just copy settings from my config file to your.. it already contains the screen resolution settings. I suggest you to try with a fresh install of raspbian.
  • CanonicalBear
    CanonicalBear over 2 years
    I owe you a beverage of your choice. Took me 2 days of reading guides and this is what was missing in all of them.
  • Tarod
    Tarod over 2 years
    Happy to help @CanonicalBear!
  • Lucas
    Lucas over 2 years
    This used to work, but now appears broken with the latest Raspbian.
  • Devin Norgarb
    Devin Norgarb almost 2 years
    I was stuck in the same loop of reading tutorials and not having any success with the steps they provided. Running vncserver was all I needed to do. Thanks for this @CanonicalBear