Enabling and Verifying the Raspberry Pi Camera Module V2 on a Pi 4
Learn how to enable the Raspberry Pi Camera Module V2 on a Pi 4 running Raspberry Pi OS, verify the driver, capture a test image, and troubleshoot common problems using libcamera. Follow the step‑by‑step guide, check the device node, and recover from typical failures.
31 May 2026, 00:29 UTC

Desired Outcome
Enable the Raspberry Pi Camera Module V2 on a Raspberry Pi 4 and confirm that the kernel driver is loaded, the device node /dev/video0 exists, and a test image can be captured with libcamera-still.
Prerequisites
- Raspberry Pi 4 (any revision) running Raspberry Pi OS (bullseye or newer).
- Camera Module V2 (Sony IMX219) and a compatible CSI cable.
- Power supply: 5 V/3 A or higher to avoid power‑related camera failures.
- Internet connectivity for package installation and optional firmware upgrade.
- SSH or local terminal access with
sudoprivileges.
Step‑by‑Step Procedure
- Enable the camera in raspi‑config
Runsudo raspi-configand navigate toInterface Options → Camera. SelectEnableand finish. Reboot the Pi to load the new kernel module.Command:
sudo raspi-config - Install libcamera utilities
The legacyraspistillstack is replaced bylibcamera-appsin recent OS releases.Command:
sudo apt update && sudo apt install libcamera-apps - Verify firmware version
Camera V2 requires firmware released on or after 2023‑03‑23. Check the firmware date.Command:
vcgencmd version | grep -i firmwareExpected output contains a date string, e.g.,
2023‑03‑23. If older, update the firmware or upgrade the OS. - Confirm the device node
The kernel driver should expose/dev/video0.Command:
ls /dev/video*Look for
/dev/video0. Absence indicates the driver did not load. - List detected cameras
Use libcamera to enumerate devices.Command:
libcamera-hello --list-camerasOutput should list a device named something like
camera0with the IMX219 identifier. - Capture a test image
Take a still picture to confirm image output.Command:
libcamera-still -o test.jpgAfter the command finishes, verify the file size and open it with any image viewer.
- Check kernel logs for errors
Search for camera‑related messages.Command:
dmesg | grep -i cameraLook for lines containing
errororwarning. Absence of such lines indicates normal operation.
Expected Checks and Validation
- /dev/video0 exists – confirms the kernel module is active.
- libcamera‑hello lists the camera – verifies the driver recognizes the hardware.
- test.jpg is created and viewable – proves the camera can capture images.
- No error messages in dmesg – indicates no hardware or firmware problems.
Common Issues & Recovery Options
| Problem | Possible Cause | Recovery Action |
|---|---|---|
| No /dev/video0 | Camera disabled in raspi-config, or cable not seated. | Re‑run sudo raspi-config, enable Camera, re‑boot; re‑seat the CSI cable. |
| Firmware too old | Camera V2 requires firmware 2023‑03‑23+. | Run sudo rpi-update or upgrade to the latest Raspberry Pi OS. |
| libcamera not found | Using an OS older than bullseye. | Upgrade the OS or install the legacy libraspberrypi-bin stack and use raspistill. |
| Camera reports errors in dmesg | Power supply insufficient, cable damaged, or hardware failure. | Check the power supply, replace the cable, or test the module on another Pi. |
Concrete Example: Capture a 5‑Second Preview Before Still
Sometimes a brief preview helps adjust exposure. Use the -t flag to keep the camera active for a set time before capturing.
libcamera-still -o preview.jpg -t 5000
This command keeps the camera live for 5 seconds, then captures a still image named preview.jpg. Verify the file size and view it to confirm exposure settings.
Limitations & Practical Checks
- The guide assumes Raspberry Pi OS bullseye or newer; older releases lack libcamera support.
- Camera Module V2 is only supported on Pi 4 and later; earlier Pi models require the legacy stack.
- Always verify the firmware date; older firmware can silently disable the module.
To confirm success, open the captured image with xdg-open test.jpg or view it in a file manager. A visible image indicates the camera is fully operational.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.