Fixing Raspberry Pi VNC “Cannot Currently Show the Desktop” but It’s Not Resolution or hdmi_force_hotplug

Follow me as I tell the story of why the two common fixes (resolution and hdmi_force_hotplug) for “Cannot Currently Show the Desktop” didn't work when using VNC for my Raspberry Pi.

Fixing Raspberry Pi VNC “Cannot Currently Show the Desktop” but It’s Not Resolution or hdmi_force_hotplug

The Short

None of the usual answers around changing the resolution or fiddling with hdmi_force_hotplug in /boot/config.txt worked and it turns out my issue was that I had no disk space left.

My trail cam project with a Raspberry Pi Zero 2 W was becoming overheated in the sun causing the Wi-Fi chip to fail. Hundreds/thousands of lines per second were added to syslog and kern.log and thus filling my SD card until it couldn't. Then attempting to diagnose the problem (enough time had passed for the Pi to cool after bringing it inside) I wasn't able to use VNC to get in. I could SSH in and after a lot of time spent troubleshooting, I realised my disk was full. Dealing with the bloated logs followed by a reboot solved it.

The Long

A project around making a trail cam from a Raspberry Pi Zero 2 W, a battery, camera, and solar panel started failing when left out in the direct summer sun. I had figured the sun was going to charge the battery and supply the low power Pi but when sometime after midday the Pi stopped being connected to Wi-Fi. Thinking it was just due to being too far from the router, I left it outside. It wasn't until later I brought it in and the Pi inside the container was very hot.

After leaving the Pi to cool, I could see it again on the network. Using VNC to check what went wrong lead me to my next four hours of troubleshooting:

Error connecting to the Raspberry Pi via VNC.

"Cannot currently show the desktop". Plugging the Pi into a monitor showed the boot screen, but it never booted into the OS. A simple search said it was easy to fix. Either with changing the screen resolution of the Pi or by modifying /boot/config.txt around the HDMI port. Thankfully I could SSH into it to try these out.

Neither worked.

Thinking maybe there was a problem with VNC, I attempted to manually invoke it with the command vncserver over SSH and this error popped up:

Error when trying to start VNC.

Turns out, I had no space left on the SD card. Which felt odd since I couldn't have filled nearly 30GB of motion-activated footage in a few hours.

Using df -h I saw my drive was in fact, full:

Full disk.

I spend some time looking up commands to help diagnose where this space is being used up. I found this forum really helpful:

https://www.linuxquestions.org/questions/slackware-14/mistakenly-filled-up-100-of-dev-root-can-no-longer-start-xsession-as-non-root-user-4175678672/

Running some of these commands, I began to zero in on the problem.

sudo du -hxd 1 / | sort -h showed the /var folder holding 25GB of files.

/var folder looking suspect.

Digging into /var with sudo du -hxd 1 /var | sort -h we can see it's the folder where logs are stored.

/var/log looking very suspect.

In the /var/log directory we can see most of the problem is sitting there with sudo du -hxd i /var/log | sort -h:

The files in /var/log seem to be the issue.

Taking a look at the files with ls -laS:

All the files in /var/log

Shows the issue is in both:

  1. syslog
  2. kern.log

Taking a quick second to learn how to read files nicely with the terminal

Had to learn how to read large files in the terminal and I used:

  • tail -n 10000 syslog
  • more

These showed a MASSIVE amount of errors in both files.

kernel: [22754.321297] brcmfmac: brcmf_sdio_htclk: HT Avail request error: -5
W-Fi chip errors.

Searching around for this and similar issues shows it's the Wi-Fi chip and that this can happen when the board has overheated. I can't seem to find any details around the temperature in the logs when temperature warnings occur, but considering the Pi was too hot to touch - I'll assume it was the heat.

As a funny side note, I had to learn how to increase the scrollback buffer in PuTTY.

Going back far enough, we can see the beginning of the issue:

The start of the Wi-Fi chip errors.

Learning how to clear the logs, I learned that rotating the logs was the way to go. So that was easy as sudo logrotate --force /etc/logrotate.conf.

However, this started zipping the logs and storing them - which is exactly what you would expect, except I realised how long this would take and I didn't particularly care. So I cleared the logs out.

After clearing and a sudo reboot, success!

Successful remoting into the Pi!

To Conclude

If you're reading this, I hope I helped. I feel this was a very remote edge case, but now and again someone else has the same far flung issue.