install tvservice is the process of making the tvservice utility available on a Raspberry Pi running Raspbian or Raspberry Pi OS, enabling HDMI display control via the VideoCore GPU driver.
sudo apt update && sudo apt install raspberrypi-utils -y
tvservice is part of the raspberrypi-utils package. On older or legacy systems, libraspberrypi-bin may be used. The binary is located at /opt/vc/bin/tvservice.
Common Errors
- Error:
bash: tvservice: command not found
Cause: Theraspberrypi-utilspackage is not installed or the binary is not in PATH. The full path is/opt/vc/bin/tvservice.
Fix: Install the package as above or add/opt/vc/binto$PATH. - Error:
tvservice is not supported when using the vc4-kms-v3d driver
Cause: You are running the modern KMS driver.tvservicecannot work because the legacy VideoCore API is not exposed.
Fix: Switch to legacy firmware KMS (Bullseye only) or usevcgencmd/modetestalternatives. - Error:
Cannot open /dev/fb0: No such file or directory
Cause: Framebuffer device missing under KMS.tvservicemay attempt to use it.
Fix: Ensure you have a console framebuffer (e.g.,vc4-fkms-v3dprovides/dev/fb0). On KMS, framebuffer is emulated through DRM. - Error:
Failed to allocate EDID buffer
Cause: HDMI monitor not connected or EDID read failure.
Fix: Check physical connection. Usetvservice -d edid.datto dump EDID and decode withedid-decode. - Error:
tvservice: error while loading shared libraries: libvcos.so: cannot open shared object file: No such file or directory
Cause: Userland libraries not inldconfigpath.
Fix: Runsudo ldconfig -vafter building userland, or install theraspberrypi-utilspackage which includes libraries.
Why tvservice Is Missing
tvservice is part of the raspberrypi-utils package, which contains VideoCore utilities for the legacy proprietary driver (vc4-fkms-v3d or firmware KMS). Starting with Raspberry Pi OS Bullseye (Debian 11), the default graphics driver switched to the open-source vc4-kms-v3d (Kernel Modesetting). Under this driver, tvservice is not functional and the package may not be installed.
| RPi OS Version | Default Graphics Driver | tvservice Available? | Reason |
|---|---|---|---|
| Buster (10) and earlier | Firmware KMS / vc4-fkms-v3d | Yes (built-in) | Legacy driver exposes VideoCore API |
| Bullseye (11) Lite | vc4-kms-v3d | Not installed by default | Driver does not support tvservice |
| Bookworm (12) Lite | vc4-kms-v3d | Not present in repos | Driver deprecates VideoCore-specific tools |
| Bullseye Desktop | vc4-kms-v3d (with xserver-xorg-video-fbdev) | May be absent | Desktop uses KMS, no tvservice needed |
Tested on Raspberry Pi OS Bullseye Lite (kernel 5.15) with vc4-kms-v3d driver; tvservice not functional.
How to Install tvservice
Installing tvservice requires either using the legacy driver (Bullseye only) or installing the package from a repository that provides it. Follow these steps according to your OS version.
-
Check Current OS Version and Driver
# Determine RPi OS release cat /etc/os-release | grep VERSION_ID # Check active graphics driver ls /dev/dri/ # If /dev/dri/card0 exists, KMS is active; tvservice may not work.If you are using LibreELEC, Pi-Star, or other non-Raspbian images, skip to the Pi-Star method below.
-
For Raspberry Pi OS Bullseye (Legacy Driver)
tvservicecan be made to work by forcing the legacy firmware KMS driver. This disables KMS advantages but restores VideoCore access.# Install the package (may fail if not in repos) sudo apt update sudo apt install libraspberrypi-bin -y # Ensure the legacy driver is loaded # Add to /boot/config.txt: echo "dtoverlay=vc4-fkms-v3d" | sudo tee -a /boot/config.txt sudo reboot # After reboot, test tvservice /opt/vc/bin/tvservice -sIf the package is missing from repositories (common in newer images), download the
.debfrom an older Buster install or compile from source. See the Pi-Star method. -
For Pi-Star 4.x / 3.x Users
Pi-Star images often include tvservice as part of the
/opt/vc/bindirectory. If missing, install via source:# Enable write access (if in read-only mode) rpi-rw # Clone the userland repository and build sudo apt update sudo apt install cmake git -y git clone https://github.com/raspberrypi/userland cd userland ./buildme sudo ldconfig -v # The binary will be at /opt/vc/bin/tvservice /opt/vc/bin/tvservice -sReference: This method is documented in the January 2019 K2IE blog post and works on Pi-Star 4.0 RC+. Ensure
/opt/vc/libis in your linker path. -
Quick Reference Table
Action CLI Command Key Flag Description Install package sudo apt install raspberrypi-utilsN/A Installs tvservice on systems with legacy support Check status /opt/vc/bin/tvservice -s-sDisplay current HDMI status Turn off HDMI sudo /opt/vc/bin/tvservice -o-oPower down HDMI output Turn on HDMI sudo /opt/vc/bin/tvservice -p-pPreferred mode restore List modes tvservice -m DMT-m GROUPList supported display modes (DMT/CEA) -
For Raspberry Pi OS Bookworm and Later
tvserviceis intentionally unsupported under KMS. If you must use it, downgrade to Bullseye (legacy driver) or use alternative tools:vcgencmdfor power management, andmodetest(from libdrm) for display enumeration. No direct installation method exists for Bookworm without breaking KMS.# Alternative: switch off display via KMS (requires root) echo "off" | sudo tee /sys/class/drm/card0-HDMI-A-1/status # Or use vcgencmd for basic power control vcgencmd display_power 0
Frequently Asked Questions
What is the difference between ‘sudo apt install tvservice’ and ‘sudo apt install raspberrypi-utils’?
Answer: ‘sudo apt install tvservice’ fails because tvservice is not a package; ‘sudo apt install raspberrypi-utils’ correctly installs the tvservice binary along with other utilities. tvservice is included in the raspberrypi-utils package on Raspberry Pi OS. Attempting to install a package named “tvservice” will return E: Unable to locate package tvservice. Use the correct package name:
sudo apt update && sudo apt install raspberrypi-utils -y
When should I use the ‘–no-install-recommends’ flag during installation of tvservice?
Answer: Use ‘–no-install-recommends’ in resource-constrained or containerized environments to avoid pulling non-essential dependencies for raspberrypi-utils. The flag reduces package size and install time. For example, on a minimal Raspberry Pi image:
sudo apt install --no-install-recommends raspberrypi-utils -y
This installs only the core utils (including tvservice) and skips documentation, debug tools, and optional firmware packages.
How do I fix ‘E: Unable to locate package tvservice’ on Raspberry Pi OS?
Answer: Run ‘sudo apt update’ to refresh sources, then install the correct package: ‘sudo apt install raspberrypi-utils’. This error occurs when the package database is outdated or when using the wrong package name. Ensure the raspberrypi-sys-mods repository is enabled (default on Raspberry Pi OS). Steps:
sudo apt update
sudo apt install raspberrypi-utils -y
Verify installation with tvservice --version.
Does tvservice work on Ubuntu Server for Raspberry Pi or AWS EC2 instances?
Answer: tvservice works on Raspberry Pi OS (Debian-based) but not on standard Ubuntu Server or EC2 due to missing proprietary GPU firmware. On Ubuntu for Pi (Ubuntu Core or Server), the package raspberrypi-utils may be available but tvservice requires the VideoCore GPU driver and /dev/vchiq access, which are absent on EC2 or non-Raspberry Pi hardware. Use only on physical Raspberry Pi running Raspberry Pi OS.
What is the fastest way to install tvservice from a clean image or script?
Answer: Use a single apt command without further prompts: ‘sudo apt install -y raspberrypi-utils’ after ensuring sources are updated. For headless automation, combine update and install in one line, suppressing unnecessary output:
export DEBIAN_FRONTEND=noninteractive
sudo apt update -qq && sudo apt install -y -qq raspberrypi-utils
tvservice -v # Verify
This reduces execution time to under 10 seconds on a modern Raspberry Pi with a fast SD card.

Command Line Expert & Software Engineer
Welcome! I’m Thomas Heinrich, a software engineer and system administrator with a deep passion for the Command Line Interface (CLI). With years of experience navigating the terminal, building backend architectures, and automating server deployments, I created this space to share practical, real-world terminal knowledge.
Whether you are a beginner taking your first steps in a Linux environment or a seasoned DevOps engineer looking to optimize your deployment scripts, you will find actionable solutions here. My goal is to help you ditch the mouse, speed up your workflow, and harness the full power of the command line.