I have a minimal python-based camera project that’s been running fine since the last summer. The thing takes time-lapse photos based on environmental conditions (sun’s position, detected brightness, etc.) and uploads them to a server for later processing. It is based on the (now rather old) raspi camera sample: GitHub - balena-io-playground/balena-rpi-python-picamera: balena + python + raspberry pi camera module
I updated BalenaOS to the latest version on this device (raspi zero w) and now the project container is failing to start with the following error message:
modprobe: FATAL: Module v4l2_common not found in directory /lib/modules/5.10.31
This error is obviously coming from the original sample project’s run command that I also copied over without honestly really understanding why it’s needed in this case:
CMD modprobe v4l2_common && python camera.py
Running the modprobe command via remote SSH gives the same error and indeed the /lib/modules/5.10.31 directory has nothing pointing to v4l2.
I’ve tried to research the v4l2 lib, but can’t find an up-to-date discussion about a similar issue. My best guess is that a previous version of BalenaOS contained the video4linux drivers, but something around that has now changed. Ctrl+f on the OS patch notes didn’t give any hints. I am very much out of my depth when it comes to Linux drivers and tried installing the v4l-utils package without results.
Any tips on what to try next? I’m okay with completely resetting the device if needed.
My full Dockerfile (functionally identical to the official sample and worked till the OS update as-is):
For some reason updating my Raspi Zero’s BalenaOS to “2.83.21+rev1” broke the code as per my original post. Unfortunately I don’t know what my previous OS version was and the whole device dropped offline soon after I remotely shut down all services to prevent it from crash looping for days. Maybe the SD card filled up and prevents booting now.
I think I have two ways forward:
Downgrade to OS to something from last summer until it works. Not ideal for obvious long-term reasons.
Unfortunately, my physical device is deployed far out on the field and it will take me a few weeks at least to get a full repro on the Zero hardware, but I’ll try this approach on another Pi model hopefully soon. I’ll report back on the results.
Might I suggest removing the outdated picamera Python sample code in case someone else bumps into this same issue? I’m happy to share a working version of mine after I get it rewritten on top of picamera2
Update to anyone stumbling on this later: downgrading to the “balenaOS 2.54.2+rev1” OS version works. I tested on a fresh Raspi 1.2 B+ that the latest OS gives the same error as above and downgrading resolves it.
I will still experiment later if the picamera2 route works with the latest OS, but unfortunately, it’s so so much in alpha stages that I might give it a months or two. Even just the installation is quite involved for now.