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.
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)
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.
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.
@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:
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.