Libcamera-still --autofocus segmentation fault on Raspberry Pi 4 with IMX519

Hi, I’m stuck with an IMX519 (B0371) camera on a Raspberry Pi 4 B and hoping someone can help. I’m on the latest 0.0.10 release and whenever I run anything with --autofocus I get a segmentation fault.

Example:

libcamera-still -t 0 --afmode continuous --autofocus

Preview window unavailable
[2:30:05.761644182] [3815] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3897-c3c878a9
[2:30:05.765524014] [3817] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for ‘imx519’
[2:30:05.765612031] [3817] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[2:30:05.779447347] [3817] WARN RPI raspberrypi.cpp:1280 Mismatch between Unicam and CamHelper for embedded data usage!
[2:30:05.780624034] [3817] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[2:30:05.780849475] [3817] INFO RPI raspberrypi.cpp:1404 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:30:05.795585277] [3815] INFO Camera camera.cpp:1035 configuring streams: (0) 2328x1748-YUV420
[2:30:05.796034215] [3817] INFO RPI raspberrypi.cpp:765 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
Segmentation fault

On top of that, when I try to install the dev and apps packages I keep getting:

W: Repository is broken: libcamera-dev:armhf (= 0.0.10) has no Size information

I can’t really use it without autofocus, that’s the whole point for my application. It works intermittently and generally feels unstable. I’ve tried a bunch of suggestions from the forums but nothing worked so far. Any advice on getting it working, or an ETA on a fix? This is for a university project due in the next few days so I’m a bit pressed for time.

Environment:

  • Platform: Raspberry Pi 4 B
  • Camera: IMX519 B0371
  • uname -a: Linux sensePi 5.15.83-v7l+ #1607 SMP Thu Dec 15 12:57:56 GMT 2022 armv7l GNU/Linux
  • PRETTY_NAME=“Raspbian GNU/Linux 11 (bullseye)”, VERSION_ID=“11”, VERSION_CODENAME=bullseye, ID=raspbian, ID_LIKE=debian

libcamera-still --version
libcamera-apps build: 06f635c46c4a-intree 01-11-2022 (02:38:50)
libcamera build: v0.0.0+3897-c3c878a9

Available cameras

0 : imx519 [4656x3496] (/base/soc/i2c0mux/i2c@1/imx519@1a)
Modes: ‘SRGGB10_CSI2P’ : 1280x720 [120.02 fps - (1048, 1042)/2560x1440 crop]
1920x1080 [60.00 fps - (408, 674)/3840x2160 crop]
2328x1748 [30.00 fps - (0, 0)/4656x3496 crop]
3840x2160 [21.01 fps - (408, 672)/3840x2160 crop]
4656x3496 [10.00 fps - (0, 0)/4656x3496 crop]

dmesg:
[ 10.636724] imx519 10-001a: Device found is imx519
[ 10.639634] imx519 10-001a: Consider updating driver imx519 to match on endpoints

Memory (from /proc/meminfo):
MemTotal: 3878268 kB
MemFree: 3122144 kB
MemAvailable: 3441884 kB
Buffers: 37952 kB
Cached: 470900 kB
SwapCached: 0 kB
Active: 139992 kB
Inactive: 437848 kB
Active(anon): 1056 kB
Inactive(anon): 149708 kB
Active(file): 138936 kB
Inactive(file): 288140 kB
Unevictable: 70028 kB
Mlocked: 16 kB
HighTotal: 3211264 kB
HighFree: 2578684 kB
LowTotal: 667004 kB
LowFree: 543460 kB
SwapTotal: 102396 kB
SwapFree: 102396 kB
Dirty: 8 kB
Writeback: 0 kB
AnonPages: 139016 kB
Mapped: 155020 kB
Shmem: 81776 kB
KReclaimable: 21148 kB
Slab: 41516 kB
SReclaimable: 21148 kB
SUnreclaim: 20368 kB
KernelStack: 1960 kB
PageTables: 5248 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 2041528 kB
Committed_AS: 1282000 kB
VmallocTotal: 245760 kB
VmallocUsed: 6204 kB
VmallocChunk: 0 kB
Percpu: 448 kB
CmaTotal: 327680 kB
CmaFree: 292600 kB

Relevant part of /boot/config.txt:

dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on
start_x=1
display_auto_detect=1
max_framebuffers=2
disable_overscan=1

[cm4]
otg_mode=1

[pi4]
arm_boost=1
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
dtoverlay=rpi-sense
gpu_mem=128
dtparam=i2c_vc=on
dtparam=i2c_arm=on
dtoverlay=imx519
boot_delay=1
dtoverlay=w1-gpio
enable_uart=1

Thanks in advance for any pointers.

Hi, thanks for the detailed report. The segfault with --autofocus definitely shouldn’t happen, and the sensor properties / Unicam-CamHelper warnings plus that DelayedControls error on control id 0x009a090a are worth digging into.

Before we can narrow this down we need a full diagnostic dump from your setup, since the output you posted doesn’t include the underlying driver and libcamera details.

Please reboot your Pi, then run the following:

wget -O arducam-camera-bug-report https://github.com/ketai-dhr/arducam-camera-bug-report/releases/download/tools/arducam-camera-bug-report
chmod +x ./arducam-camera-bug-report
./arducam-camera-bug-report

That will produce an arducam-bug-report.txt in the current directory. Could you attach that file here so we can take a look?

Also, just to confirm while you’re at it - is the libcamera-apps build you’re on the one shipped with our installer, or did you end up with a mix of packages? The “Repository is broken: libcamera-dev:armhf (= 0.0.10) has no Size information” warning usually points to a mismatch in the apt sources, so knowing how it was installed helps.

Here’s the bug report file you asked for:

arducam-bug-report.txt

Let me know if there’s anything else you need from my side. I ran it right after a reboot as you said.

Thanks, got the report. So the problem isn’t completely solved yet, but looking through your dump I want to flag the kernel version: you’re running 5.15.83-v7l+ (Linux sensePi 5.15.83-v7l+ #1607 SMP armv7l), and this segmentation fault on autofocus with the 16MP (IMX519) camera lines up with a known incompatibility on that kernel.

So the likely culprit is the kernel version itself rather than the camera or the libcamera-apps usage.

What I’d suggest, if you have some spare time: back up your Pi first, then burn/switch the kernel down to 5.15.61. After that, reinstall the camera driver and Arducam’s libcamera build on top of 5.15.61 and re-test the --autofocus command to see if the segfault goes away.

To summarize for anyone following: current state is a segfault on IMX519 autofocus under kernel 5.15.83-v7l+; workaround is to drop to kernel 5.15.61, reinstall the driver and Arducam’s libcamera, and verify autofocus. Please keep your follow-ups in this thread so we can track the result - if it still faults after the downgrade we’ll pick up from there. There’s also a related discussion here if you want to compare notes: Segmentation fault with autofocus on 16mp - #16 by Dion