Autofocus has stopped working on all 8 of my Pi 4s (Pimoroni Trilobot kits) that use Arducam 16MP AF cameras, model B0371. A couple were clean installs and the rest had been running the OS with pivariety for months and used to focus fine. After a recent apt-get upgrade the autofocus broke on the existing installs, and the fresh installs fail the same way.
Followed the Arducam native camera quick start guide
Running this:
libcamera-hello -t 0 --autofocus-mode=continuous
gives:
Preview window unavailable
INFO Camera camera_manager.cpp:297 libcamera v0.0.5+82-2783c8d8
INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media2 and ISP device /dev/media0
INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
INFO Camera camera.cpp:1033 configuring streams: (0) 2328x1748-YUV420
INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
WARN IPARPI ipa_base.cpp:665 Could not set AF_MODE - no AF algorithm
WARN IPARPI ipa_base.cpp:1014 Could not set AF_SPEED - no focus algorithm
WARN IPARPI ipa_base.cpp:996 Could not set AF_RANGE - no focus algorithm
#0 (0.00 fps) exp 31745.00 ag 4.00 dg 1.64
The camera streams but never actually focuses. I’ve already tried clean re-installing and manually installing some packages. I’ve also sent my full diag.txt and a photo of the setup over PM.
Thanks for the report. The key lines are the three warnings:
WARN IPARPI ipa_base.cpp:665 Could not set AF_MODE - no AF algorithm
WARN IPARPI ipa_base.cpp:1014 Could not set AF_SPEED - no focus algorithm
WARN IPARPI ipa_base.cpp:996 Could not set AF_RANGE - no focus algorithm
That tells me libcamera isn’t loading an AF-capable algorithm for the IMX519, so it just ignores the autofocus request. Before changing anything, can you generate an Arducam camera bug report so we can see the full state of the install?
Got it, thanks. Looking at the report, this points to a libcamera incompatibility. The apt version you have installed doesn’t include the Arducam autofocus handling, which matches the ‘no AF algorithm’ warnings.
Next step is to install the Arducam-provided libcamera instead. Follow the ‘Getting Started’ section of this guide:
Followed the guide, but I’m getting an error when I use the -1 flag on install_pivariety_pkgs.sh:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libcamera-dev' instead of './libcamera-dev_0_git20230512+8689dd6b-1_arm64.deb'
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following packages have unmet dependencies:
libcamera-dev : Depends: libcamera0 (= 0~git20230512+8689dd6b-1) but 0~git20230707+2783c8d8-1 is to be installed
E: Unable to correct problems, you have held broken packages.
python3-picamera2 is already the newest version (0.3.12-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
It’s selecting the apt libcamera-dev instead of the .deb, and the libcamera0 versions don’t match.
Adding more detail — I think it’s a fundamental version conflict between Arducam’s libcamera* packages and what apt wants. The git20230309 versions might work, but every time I try to install them apt pulls the later versions instead.
E: Packages were downgraded and -y was used without --allow-downgrades.
Note, selecting 'libcamera0' instead of './libcamera0_0_git20230512+8689dd6b-1_arm64.deb'
The following packages will be REMOVED: python3-libcamera
The following packages will be DOWNGRADED: libcamera0
libcamera-dev : Depends: libcamera0 (= 0~git20230512+8689dd6b-1) but 0~git20230707+2783c8d8-1 is to be installed
E: Unable to correct problems, you have held broken packages.
libcamera-hello: error while loading shared libraries: libcamera.so.0.0.4: cannot open shared object file: No such file or directory
Then after sudo apt-get upgrade, libcamera-apps got upgraded to 1.2.1-1 (over 0~git20230309+4def288-1), and libcamera-hello --autofocus-mode=continuous -t 0 still shows the same no-AF-algorithm warnings.
Thanks, that confirms the conflict. The install script was letting apt pick libcamera0 0~git20230707+2783c8d8-1 instead of Arducam’s 0_git20230512+8689dd6b-1 build. The downgrade was blocked without --allow-downgrades, and libcamera-dev then failed because it requires the Arducam libcamera0 version.
We’ve updated the install script logic to fix that selection. Please re-run these in order:
Quick clarification — run them exactly in that order and make sure the first command is the -l flag. That step matters because it sets the list the later package steps use. The updated script should stop apt from pulling the newer conflicting libcamera0, which was causing the ‘held broken packages’ error you saw even with -1.
If you still get that libcamera-dev dependency error, paste the full output and I’ll dig into it.
That worked, autofocus is back for now. Afterward I tested stability with:
sudo apt-get update
sudo apt-get upgrade
Output:
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Hit:4 http://archive.raspberrypi.org/debian bullseye InRelease
The following packages will be upgraded: libcamera-apps
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Get:1 http://archive.raspberrypi.org/debian bullseye/main arm64 libcamera-apps arm64 1.2.1-1 [301 kB]
Unpacking libcamera-apps (1.2.1-1) over (1.2.1-1)
Setting up libcamera-apps (1.2.1-1)
Processing triggers for libc-bin (2.31-13+rpt2+rpi1+deb11u5)
Programs still working after the update/upgrade. But I’m a bit concerned: it feels like every libcamera update breaks the Arducam build. Is there a longer-term plan so we don’t have to redo this after each apt upgrade?
Glad it’s working. To wrap up: the root cause was the previous install script allowing apt to install conflicting libcamera versions, which dropped the Arducam AF support and produced those ‘no AF algorithm’ warnings. The updated script logic now prevents that conflict, and your apt update/upgrade test shows libcamera-apps 1.2.1-1 works fine.
On the longer-term compatibility point — that’s a valid concern and I’ll pass it along. The updated script is the current safeguard, so if a future upgrade breaks autofocus again, re-run the -l / libcamera0 / libcamera_apps sequence first and let us know.