TL;DR
If your Raspberry Pi 5 shows a black screen after you switch your TV to another input and then back, the Pi may lose track of the display. This happens often when using an HDMI hub or switch. The fix is to tell the Pi to always use a fixed screen mode.
Add this line to /boot/firmware/cmdline.txt:
video=HDMI-A-1:1920x1080@60D
Reboot once. The black screen problem should be gone.
The Problem
I use a Raspberry Pi 5 connected to a TV as a small desktop computer. Sometimes, after switching the TV input to another device and then switching back, the screen stays black.
The Pi itself is still running. I can log in remotely or open a text terminal, but the desktop does not come back unless I restart the system.
Why This Happens
Modern Raspberry Pi systems handle the screen differently than older models. Instead of the Pi’s firmware managing the display, the operating system now does it directly.
Some HDMI hubs and switches do not clearly tell the Pi when the TV comes back. When that happens, the Pi assumes the screen is still gone and stops sending a picture, even though the TV is ready again.
Older fixes that change settings in config.txt (see below for details) do not always work anymore for this situation.
The Fix
The most reliable solution is to tell the Pi, “assume a screen is always connected and always use this resolution.”
To do that:
- Open a terminal (or connect using SSH).
- Edit the boot command line file:
sudo nano /boot/firmware/cmdline.txt - Go to the very end of the line, add a space, and paste:
video=HDMI-A-1:1920x1080@60D - Save the file and reboot.
That is all.
What This Does
- The Pi always sends video at 1080p, even if the TV input changes.
- The display does not reset or disappear when you switch inputs.
- When you switch back to the Pi, the picture is already there.
When This Fix Is a Good Idea
This works best if:
- your Pi is always connected to the same TV,
- you use a fixed resolution like 1080p,
- you often switch TV inputs.
If you regularly move the Pi between different screens or rely on automatic resolution changes, this may not be the best approach.
Old (Firmware-Level) HDMI Fix
On older Raspberry Pi models, or systems that do not use the newer graphics
stack, the following block could be added to the end of config.txt:
[all]
# Keep HDMI link stable across input switches
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=1
hdmi_mode=16 # 1080p @ 60 Hz
On current Raspberry Pi OS releases (Bookworm, used on Raspberry Pi 5), config.txt is located at /boot/firmware/config.txt, while on older releases it should be found at /boot/config.txt.
Conclusion
If your Raspberry Pi 5 goes black after switching TV inputs, it is usually not a crash or a bad cable. It is a communication issue between the Pi and the TV. For a simple, stable setup, forcing the display mode at startup is an effective and long-lasting fix.
I’m a US-based software engineer with a background in law. I share mostly practical tech notes here for my future self and anyone who finds them useful.
One of the things I’ve built is Masterlist: Focus & Tasks, a privacy-focused, local-storage-only task manager that offers focus tracking tied to tasks and projects, compatible with the Pomodoro technique.