IMX519 Unable to set controls: Device or resource busy

  1. Where did you get the camera module(s)?
    Starter campaign

  2. Model number of the product(s)?
    IMX519 16mp autofocus

  3. What hardware/platform were you working on?
    RPI4 bullseye 6.1.21-v8+ 64 bit

  4. Instructions you have followed. (link/manual/etc.)
    Quick Start - Arducam Wiki

  5. Problems you were having?

error: XDG_RUNTIME_DIR not set in the environment.
Made X/EGL preview window
[1:28:17.512158890] [14296]  INFO Camera camera_manager.cpp:299 libcamera v0.0.0+4226-8689dd6b
[1:28:17.550586805] [14298] ERROR V4L2 v4l2_device.cpp:352 'imx519 10-001a': Unable to set controls: Device or resource busy
[1:28:17.592523096] [14298]  INFO RPI raspberrypi.cpp:1485 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media2 and ISP device /dev/media1
[1:28:17.592963650] [14296]  INFO Camera camera.cpp:841 Pipeline handler in use by another process
ERROR: *** failed to acquire camera /base/soc/i2c0mux/i2c@1/imx519@1a ***

  1. The dmesg log from your hardware?
    Where do I get this?

  2. Troubleshooting attempts you’ve made?
    I tried refollowing the guide and reinstalled the driver/libcamera/apps.
    libcamera-hello --list gives:

Available cameras
-----------------
0 : imx519 [4656x3496] (/base/soc/i2c0mux/i2c@1/imx519@1a)
    Modes: 'SRGGB10_CSI2P' : 1280x720 [30.00 fps - (0, 0)/0x0 crop]
                             1920x1080 [30.00 fps - (0, 0)/0x0 crop]
                             2328x1748 [30.00 fps - (0, 0)/0x0 crop]
                             3840x2160 [30.00 fps - (0, 0)/0x0 crop]
                             4656x3496 [30.00 fps - (0, 0)/0x0 crop]

I also went through FAQ for imx519 and did not find a solution.

  1. What help do you need?
    The camera was working, started another project and now am back to this project. Now it gives me the above error.

@microzee

It looks like the camera is being occupied, did your previous project use a streaming service like octopi.

Well, I was stumped. It’s been so long since I’ve worked on this project, I forgot I had a crontab setup to run a script at startup. Sorry for the wasted forum bandwidth.

Side question, I had built from source the official libcamera/apps for an Ubuntu 22.04 distribution (so not the Arducam version of libcamera). Is it true that we must use Arducam version for IMX519 to work properly? Currently when trying to use it with ubuntu it says:

 WARN IPARPI raspberrypi.cpp:801 Could not set AF_MODE - no AF algorithm
Segmentation fault (core dumped)

and then there is a core file created. According to RPi forums:

Unfortunately Arducam haven’t upstreamed the latest support for IMX519 to the main libcamera branch, so rebuilding isn’t really an option.
Please complain to Arducam about that as there is nothing anyone else can do about it.

@microzee

We are working on this, until then, you can try it with our fully open source code.