Raspberry pi 3 B camera issues after upgrade

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=11
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
  • Distro version | bookworm 0
  • Kernel version | Linux DietPi 6.12.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.20-1+rpt1~bpo12+1 (2025-03-19) aarch64 GNU/Linux
  • Architecture | arm64
  • SBC model | RPi 3 Model B+ (aarch64)
  • Power supply used | several
  • SD card used | One boots from USB drive the other from SD card

Additional Information (if applicable)

  • Software title | motioneye
  • Was the software title installed freshly or updated/migrated? Both
  • Can this issue be replicated on a fresh installation of DietPi? Yes

Steps to reproduce

  1. Install HW camera, install fresh dietpi, install motioneye
  2. make sure camera is active in dietpi-config
  3. Can not add camera to motioneye

Expected behaviour

  • Camera available in motioneye

Actual behaviour

  • No camera available

Extra details

Let me tell you the whole story.

I have one raspberry pi 3B that runs pihole and motioneye (with official raspberry pi camera (i think v2)). It has been doing this permanently for years. I have another 3B that only acts as a camera when we are on holiday. It has a chinese bought camera (ali express) which works just fine.

Two weeks ago, I took out the second pi and did all the upgrades needed. Suddenly the camera stopped working (it was working before the upgrades). /dev/video0 was not available anymore. When I rebooted the pi it said ‘hwmon hwmon1 : Undervoltage detected!’ right after the ‘systemd-shutdown : Rebooting’ but it did not reboot. I thought that the power supply (official) gave out but it did not. I tried with the powersupply of the working other one and that gave the same. When I disconnected the ribbon cable of the camera, it stopped saying that and it would just reboot normally. Maybe something went wrong during a patch so I reinstalled a new dietpi image and did the setup again but that also did not solve it. So I ordered a new camera and ribbon cable (also not an official one) and waited. I also upgraded the software of the second (working) one to the last version and that seemed fine. So I waited.

A few days ago, I logged in to the working one his motioneye and it seemed like that it also stopped working. The last recordings are from a few days after I did the upgrade. It behaves in much the same way. It stops when rebooting (although it did not give the Undervoltage error) and in this case motioneye says: v4l2_device_open: Failed to open video device /dev/video0: No such file or directory.

I tried the new camera and ribbon cable and it changed nothing.

Some extra command results that are the same on both systems:
vcgencmd get_camera : supported=1 detected=1, libcamera interfaces=0
rpicam-hello --list-cameras : No cameras available!
libcamera-hello --list-cameras: No cameras available!
I do not know if it is related but I also get this error in journalctl: systemd-udevd[177]: bcm2835-camera: Worker [180] terminated by signal 11 (SEGV)

I am a bit stomped. I could try another operating system but I do not want to. I really really like dietpi. I have a feeling that it is related with the new kernel somehow but I dont understand.

1 Like

Hey,

This is an update to my own problem.

I was investigating it quite a lot more and although I do not know why it works but i got it working.

First thing I had to do was to add ‘camera_auto_detect=1’ to /boot/config.txt. That resolved the undervoltage detection on reboot/shutdown and also made available /dev/video0. I kept reading that this is on by default but it is obviously not in dietpi. It is in raspbian lite.

At this point I could add the camera to motioneye (on the new install, it did not give any visible changes on the existing install). It still says that it can not connect to the camera afterwards.

In order to get that working I had to do the following

apt-get -y install libcamera-v4l2 libcamera-tools
sed -i ‘s//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/’ /etc/systemd/system/motioneye.service

Which I found here:

Then I see the image. I dont know if everything works. I will have to have some days to really test it but it seems to be working so far.

Can this be implemented automatically somehow? The first thing (config.txt) should be implemented as soon as the camera is put to on in the dietpi-config. The second thing might be good to add when motioneye gets installed (unless it breaks something or is not stable, I am not a good judge in that)

1 Like

I had this issue where a previously working camera on Dietpi 9.10.0 stopped working after updating to Dietpi 9.12.1. Restoring a backup to 9.10.0 got the camera working again.

1 Like

Did you tried running apt update && apt upgrade? This should update all Debian packages but keep current DietPi version. Would be interesting how this behaves.

I did. It was fully up to date both times (after the initial upgrade and on the fresh install).

Maybe @MichaIng has an idea

@Vidar with “after upgrade” you mean after migrating to the new RPi firmware stack, right? Yeah that removed the MMAL library … ah actually AFAIK it was removed on latest legacy kernel as well.

If camera_auto_detect=1 works, KMS/DRM seems to be enabled, which implicitly disables the legacy camera API. If it works at all, one must disable KMS/DRM and enable legacy camera support e.g. via dietpi-config or:

/boot/dietpi/func/dietpi-set_hardware rpi-opengl disable
/boot/dietpi/func/dietpi-set_hardware rpi-camera enable

However, camera module v3 does not support the legacy API and AFAIK all recent RPi kernel builds do not ship the MMAL library anymore.

To enable the modern camera API:

/boot/dietpi/func/dietpi-set_hardware rpi-camera disable
/boot/dietpi/func/dietpi-set_hardware rpi-opengl vc4-kms-v3d
G_CONFIG_INJECT 'camera_auto_detect=' 'camera_auto_detect=1' /boot/config.txt

This creates /dev/video0 as well, but along with a lot of other /dev/video* devices which do not work on their own like with the old API or genetic V4L2 cameras, but via libcamera API, which motion (the backend utility used by motionEye) does not support. libcamerify is the shim to provide the legacy API on top of the new API.

We do really need to add native support for this to dietpi-config, I agree, even more importantly as/if the legacy camera driver/API does not work anymore at all, at least not on Bookworm systems even with legacy kernel: DietPi-Config | RPi: Add modern RPi camera module support · Issue #5127 · MichaIng/DietPi · GitHub

1 Like