Libcamera on Ubuntu

I am using Ubuntu 23.04 and I am just trying to get libcamera-hello --list-cameras to work to see if it can identify my arducam pivariety low light camera module for RPI (SKU: B0333). The paper that came with the camera said in order to install the driver I should do
wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
./install_pivariety_pkgs.sh -p kernel_driver
Then it says press y to reboot but there is no option to do that. I read on another forum that the last line should be changed to
./install_pivariety_pkgs -d
I also did this and the option to reboot did come up (however it said in the forum that it wasn’t needed, I did anyway for extra security). Next it says to see if the driver was downloaded using
dmesg | grep arducam
however I need to use
sudo dmesg | grep arducam
yet when I do this nothing comes up but it runs. So, this is where my first red flag came up, yet I still tried to install the libcamera app installation. ./install_pivariety_pkgs.sh -p libcamera_dev and ./install_pivariety_pkgs.sh -p libcamera_apps
These seemed to download, but there is no libcamera directory made from this. I could not do libcamera-still or libcamera-hello. Neither of these commands work.

I also tried to install libcamera from source code because it was giving me trouble. I followed software installation - libcamera is missing in Ubuntu aarch 64, raspberry pi - Ask Ubuntu but ninja gave me trouble, so I did it separately with using ninja-build instead of ninja.
sudo apt install build-essential meson libyaml-dev python3-yaml python3-ply python3-jinja2 libssl-dev openssl git
sudo apt install ninja-build
git clone https://git.libcamera.org/libcamera/libcamera.git
cd libcamera
meson build
sudo ninja -C build install
This did create a directory called libcamera; however, it didn’t create a libcamera-apps directory. When I tried to run libcamera-hello --list-cameras it said the command could not be found. Hence I am stuck and I do not know how to get this camera running on Ubuntu.

I was not able to get the upstream or rpi versions of libcamera-apps working on Ubuntu.

After talking to the person maintaining the rpi fork, they released a libcamera-apps update that brought the rpi libcamera and libcamera-apps repos into sync - and i was able to get it to work on Ubuntu.

Note: the overlay system is different between Raspian and Ubuntu.
On Raspian, it’s at /boot; on Ubuntu, it’s at /boot/firmware.

Once you’re in the right path, check the overlays folder: ls /boot/firmware/overlays/imx*
to see if your camera driver is there. If not, you’ll need to find/build your camera’s dbto driver.

Once you have your driver, you’ll need to enable it in your /boot/firmware/config.txt file.

I don’t have an imx* folder but I did find all the different imx* files in the overlays folder. I am using the imx462 with RPi pivariety low light camera (SKU: B0333), so I located the file imx462.dtbo.bak, imx462.dtbo, arducam-pivariety.dtbo.bak, and arducam-pivariety.dtbo.

In the config.txt file I went to the bottom and inserted the lines dtoverlay=arducam-pivariety and dtoverlay=imx462. From my understanding the .dtbo.bak files are backups so I do not need to have redundancies in the code, so I didn’t add them. Yet when I rebooted the pi and tried to do libcamera-hello it still said the “command not found”.

Sorry - typo on my part - fixed.

I was not able to get the libcamera/libcamera-apps to work on Ubuntu from the package installers mentioned by ArduCam on:
https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Libcamera-User-Guide/

Others may have success doing so, but I ended up building from source.

Note when building from source:

I ended up going with the RaspberryPi fork. At the time, the RPI libcamera and libcamera-apps repos were out of sync. After a bug report, the maintainers updated libcamera ( raspberrypi/libcamera-apps@3d9ac10) which fixed that problem.

Once you get a synchronized libcamera and libcamera-apps installation, you should be able to call libcamera-hello.

Note: once I did this, I still had 2 remaining issues: I had to get the previewer to work. That involved a) building libcamera with the correct build options (see the repo READMEs), and setting up my boot/firmware/config.txt to correctly set up the display. Then I needed to find the correct imxXXXX.dtbo driver and configure that in config.txt file.

If I get access to ArduCam’s Wiki, I’ll add these instructions for getting this to work on Ubuntu. Otherwise, I’ll add a forum topic.

1 Like

@bfree

Did you have any additional luck on getting the libcamera software working on Ubuntu 22? I’m struggling and could use some additional insight.

Camera drivers do work in Ubuntu 22, though I’ve had varying degrees of success with different cameras. The IMX477 works fine with 0.2.0 of libcamera installed from source via the raspi fork, and main of raspicam-apps installed from source. Compile both of these from source once you have ubuntu 22.04 installed, and update your config.txt to call out the right overlay (I have not had success with autodetection) and I’ve had stable results on the IMX477, at least. I’m struggling with the global shutter camera, IMX296, but I think that’s a driver issue rather than a libcamera issue.