-
Notifications
You must be signed in to change notification settings - Fork 100
Description
Description
camera-streamer consistently fails to open the libcamera device on the first connection attempt when started by crowsnest. The --camera-auto_reconnect=1 flag causes it to retry and succeed, so the stream works — but the initial error always appears in the systemd journal.
When camera-streamer is started manually (outside of crowsnest), it opens the device successfully on the first try every time.
Environment
- SBC: Raspberry Pi 4 Model B Rev 1.4
- OS: Raspbian GNU/Linux 11 (bullseye)
- Kernel: Linux 6.1.21-v8+ aarch64
- Camera: IMX708 (Raspberry Pi Camera Module 3) via CSI
- crowsnest: v4.1.17-1-g9cc3d4a
- camera-streamer: f1627aa
- libcamera: v0.0.5+83-bde9b04f
Configuration
[cam 1]
mode: camera-streamer
enable_rtsp: false
port: 8080
device: /base/soc/i2c0mux/i2c@1/imx708@1a
resolution: 1920x1080
max_fps: 10
custom_flags: --camera-options=AfMode=Manual --camera-options=LensPosition=5.26Symptoms
Every time crowsnest starts or restarts, the systemd journal shows:
Cannot open device /base/soc/i2c0mux/i2c@1/imx708@1a, exiting.
After auto_reconnect, the device opens successfully and the stream works:
device/libcamera/device.cc: CAMERA: Device path=/base/soc/i2c0mux/i2c@1/imx708@1a opened
Reproduction
sudo systemctl restart crowsnestjournalctl -u crowsnest -n 15→ "Cannot open device" always appearscurl -s -o /dev/null -w "%{http_code}" http://localhost:8080/snapshot→ 200 (stream works)
Investigation
Extensive testing was performed:
- Manual start of camera-streamer with identical parameters: always succeeds on first try
- Adding delays (3s, 5s) between detection phase and camera-streamer start: no effect
- Disabling
list_picam_controlsandlist_picam_resolution(which briefly open the camera during detection): no effect - Replacing
echo | xargswith direct execution: no effect - Replacing pipe to
log_outputwith file redirect: error still appears in journal (not in log file), suggesting camera-streamer internally forks and the child process writes to stderr before inheriting the redirect - Checking
/dev/video*withfuser: no stale processes holding the device - Checking
libcamera-hello --list-camerasimpact: does not lock the camera
The error appears to be specific to camera-streamer being started as a child process of the crowsnest bash script. It does not occur when camera-streamer is started directly from the command line, even with the exact same parameters, working directory, and pipe chain.
Expected behavior
camera-streamer should open the libcamera device on the first attempt without error, or the initial probe failure should not be logged as an error when auto_reconnect is enabled.
Workaround
The stream works reliably thanks to --camera-auto_reconnect=1. The error message is cosmetic only.