Setting up OctoPrint on a Raspberry Pi running Raspberry Pi OS (Debian)

Do I make a new folder called scripts, because scripts isn't in pi

Turns out "scripts" wasn't there because I am running Ubuntu, and this is for RPi, used a copy guide but made for ubuntu, they just had the code to make scripts. Got that, but now, I don't know why, but same problem, not running on startup.

1 Like

Here's the guide link

And I did replace the user with pi (my user)

i found this command to be really helpful for weeding out haporxy issues

sudo haproxy -c -f /etc/haproxy/haproxy.cfg
1 Like

Hello everybody,

today I noticed that the RaspiCam stream did not load anymore. The mjpeg-streamer itseft could be started by the webcamDaemon script did not start the stream.
The reason was that in the conditional start at the end of the script the output of vcgencmd get_camera was different on my pi (pi4b 4GB bullseye 32bit): instead of supported=1 detected=1 it returned supported=1 detected=1, libcamera interfaces=0.
So I had to change the elif statement a bit in order for it to trigger.

Instead of:

elif [ "`vcgencmd get_camera`" = "supported=1 detected=1" ] && { [ "$camera" = "auto" ] || [ "$camera" = "raspi" ] ; }; then

it is now:

elif [[ "`vcgencmd get_camera`" == "supported=1 detected=1"* ]] && { [ "$camera" = "auto" ] || [ "$camera" = "raspi" ] ; }; then

Maybe this helps if someone else runs into that issue.

Best regards JΓΆrg

1 Like

@foosel I just wanted to say thank you very much for this how-to! I have been struggling with getting Octoprint on a Banana Pi M2 Zero for about a week or so. With your guide I was able to get it installed on a the last version of Armbian that released for the M2 Zero (2020). Your instructions worked like a charm! Thank you!


I am having an issue with the venv. When I try and still pip or Octoprint, It states that "...locations that require TLS/SSL, however ssl module in Python is not available."

When I am NOT in the venv, I do not have this issue. So how do I get past this so I can install OctoPrint.

This is on a Raspberry PI 3 Model B

What OS have you installed?

Raspbian release 8.0 (jessie)

This guide is written to be used with Raspberry Pi OS based on Debian Buster (10) or Debian Bullseye (11). Jessie is way too ancient to be trying to install today.

A quick note for the next time these instructions are triaged;
I just setup a new bullseye/RPi4 box and noticed that In the optional webcam section you can drop the requirement to install subversion for mjpeg_streamer, it does not appear to be needed anymore, at least for Bullseye. Everything compiled and ran without it.


Not that there's any reason it wouldn't, but this all works great on 64-bit Raspberry Pi OS! Thanks so much for your work!

Linux raspberrypi 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye


instructions worked with a few minor tweaks to get octoprint along with a USB webcam up and running on an Orange Pi 3 LTS using the debian bullseye image from Orange Pi. I also just finished turning an old intel atom laptop that originally had windows 7 starter installed on it into an octoprint server using these instructions along with the raspberry pi desktop iso for PC.

very nicely put together instructions.


Many thanks to the mods and the helpful octoprinters. The guide was really clear and useful. With minor modifications I was able to succesfully install, config and run OctoPrint from scratch on a $30 Le Potato AML S905x-cc SBC with Ubuntu 22.04.1 LTS Jammy (Armbian) installed along with an old Microsoft LifeCam I had lying around. I also managed to install a WiFi dongle to get wireless support (standard Le Potato comes with Ethernet port only). OctoPrint is connected to a Voxelab Aquila G32 and is working like a charm. So far it has been great! You guys rock.

1 Like

I was wondering about how to start the mjpg-streamer outside of its directory /home/pi/mjpg-streamer/mjpg-streamer-experimental. Even if I give an explicit path and try to run it from say /home/pi/scripts, I get an error about file not found. I am trying to get it to run automatically, but so far nothing works. I have to ssh into my board which is running armbian buster (Orange Pi 3 LTS), change to the streamer directory and run this command.

./mjpg_streamer -i "./ -n -f 30 -r 640x480 -d /dev/video1"  -o "./ -w ./www" &

This runs fine and the octoprint stream works with my web camera, but only in that directory. I tried using the webcamd service in tutorial which uses the script webcamDaemon, but when it runs, it fails because it is using /dev/video0 and my usb camera is on /dev/video1.

Using V4L2 device.: /dev/video0

In the webcamDaemon script, find the line like this:

camera_usb_options="-r 640x480 -f 10"

And add your specified device there:

camera_usb_options="-r 640x480 -f 10 -d /dev/video1"

I am pretty sure I tried that and it did not work. I did figure out a method though after much Internet searching. I moved the mjpg-streamer binary into /usr/bin, then I moved the input and output .so files into /usr/lib. Then I used the /usr/bin/mjpg_streamer -i "/usr/lib/ -n -f 30 -r 640x480 -d /dev/video1" -o "/usr/lib/ -w ./www" & in the rc.local file. Now, everything works as it is supposed to. Well, good enough for me anyway.

Thanks for the informaition though.

So, I tried adding the streamon and streamoff to octoprint's menu, but I get errors when I try to use it as it needs a password. Anyway around this or a way to popup a password box?

This is the error:

{"error":"Command for custom:streamoff failed: 500 Internal Server Error: Command for custom:streamoff failed with return code 1:\n\nSTDOUT:\n\n\nSTDERR:\nsudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper\n\nsudo: a password is required\n"}

In the guide, there is this note for the startup/shutdown commands, the same applies to the webcam commands.

Yes, I know about that. I am not using a Raspberry Pi, I am using an Orange Pi as $60 vs $150 was too much a temptation to pass up. I did add those rules and the standard shutdown and reboot commands do work. It is the video stream commands such as Stream off and Stream on that do not work. Not a big deal really. I will probably just remove those commands if I can't figure it out.