Error installing driver for 5MP camera on Raspberry Pi Zero W: too many arguments

Hi everyone, I’m trying to set up my Arducam 5MP camera (the one without the IR filter) on a Raspberry Pi Zero W, and I keep hitting an error when I run the pivariety install script. The command I’m using is:

./install_pivariety_pkgs.sh -p libcamera

And the console throws this back at me:

./install_pivariety_pkgs.sh: line 543: [: too many arguments

I followed the installation instructions step by step, so I’m not sure what I’m doing wrong. Anyone seen this before?

That error at line 543 is a shell script syntax problem, but before diving into the script itself, can you confirm exactly which camera module you’re using? The 5MP no-IR version could be a couple of different sensors, and it makes a big difference here. Also, what OS image are you running on the Zero W? Is it Raspberry Pi OS (which version, Bullseye or Bookworm)?

It’s the ov5647 based 5MP module, no IR filter. The Pi Zero W is running Raspberry Pi OS. I already tried re-downloading the pivariety package and running the install again, but I get the exact same error:

./install_pivariety_pkgs.sh: line 543: [: too many arguments

I also double-checked the camera ribbon cable connection just in case, but that didn’t change anything since the error happens during the package install, before the camera is even touched.

Thanks, that’s the important detail. For the ov5647 module, the Arducam customized libcamera / pivariety package install is actually not required at all. The ov5647 sensor is natively supported by Raspberry Pi, so running ./install_pivariety_pkgs.sh -p libcamera isn’t just unnecessary here - that’s exactly what’s triggering the “[: too many arguments” error on line 543 of the script. The script isn’t really meant for this sensor and hits a bad test condition.

Ah okay, that would explain why it kept failing no matter what I did. So if I shouldn’t use the pivariety installer, what should I do instead to get the camera working? I’m fine skipping that script, I just want to see a preview.

Right, skip the pivariety installer completely for this module. Since ov5647 is supported by the built-in libcamera stack, you can just use libcamera-hello directly. Before you do, make sure the ov5647 driver is enabled in the config file - on the newer Raspberry Pi OS images you’d typically add/enable it via the camera settings (or the older raspi-config / boot config approach depending on your OS version). Then run:

libcamera-hello

That should give you a live preview if the driver is enabled and the ribbon cable is seated properly.

I enabled the ov5647 driver in the config file and gave libcamera-hello a try without touching the pivariety script. I didn’t want to post too soon, but it looks like it’s working now - I get a preview window from the camera. So the whole problem was just that I was running an installer I didn’t need.

Exactly. To sum it up: the ov5647 5MP module is natively supported by Raspberry Pi, so the Arducam customized libcamera / pivariety package is not needed. Running ./install_pivariety_pkgs.sh -p libcamera triggered that line 543 error, and the fix is simply to not use that installer for this sensor. Use the built-in libcamera-hello command instead, after enabling the ov5647 driver. If you need the exact steps for enabling the driver on your OS version, the official camera software docs are here: https://www.raspberrypi.com/documentation/computers/camera_software.html