Cannot overwrite non-directory /opt/mjpg-streamer with www during Arducam OctoPrint setup on Raspberry Pi 4B

Hi, I’m trying to get an Arducam 12MP IMX708 Fixed Focus HDR Camera Module working with OctoPrint on a Raspberry Pi 4B. I can access the camera fine over SSH and with libcamera, but OctoPrint won’t stream it. My system is: Linux octopi 6.1.21-v7l+ #1642 SMP Mon Apr 3 17:22:30 BST 2023 armv7l GNU/Linux. Before I go through the guide, are all the steps actually required? And are they still correct for kernel 6.1.21 with a camera module 3?

Hi, yes, please follow the guide starting from step 3. You can find it here: Solution On OctoPrint - Arducam Wiki

Thanks. I got through the earlier parts, but on Step 4 (downloading the libcamera source) the copy command fails. Here’s what I ran and the error I get:

sudo cp -a -r ./www /opt/mjpg-streamer

cp: cannot overwrite non-directory ‘/opt/mjpg-streamer’ with directory ‘./www’

The steps to close mjpg-streamer and install the new source seemed to complete fine. I can still access the camera over SSH and libcamera, just no stream in OctoPrint. Here’s what the mjpg streamer experimental directory looks like: [screenshot attached]

Thanks for the screenshot. Looking at the error and your directory listing, the problem is that there’s an empty folder with the same name under /opt/mjpg-streamer. That existing folder conflicts with the ./www directory when cp tries to copy it over, which is why you get ‘cannot overwrite non-directory’.

If you’re only using OctoPrint, you can actually ignore this error. If you need it for other things, just delete the empty folder under /opt/mjpg-streamer first, then retry the copy command:

sudo cp -a -r ./www /opt/mjpg-streamer

Got it, thanks. I removed the empty folder and reran the command, and this time the copy went through without that error. So the empty same-named folder under /opt/mjpg-streamer was what was blocking the ./www directory from being copied over.

Exactly. The existing empty folder with the same name prevented cp from overwriting it with the ./www directory. Once that folder is removed, the copy succeeds. If you run into anything else with the OctoPrint stream, feel free to post back.