Setup an OctoPrint Botfarm on Linux / Ubuntu with Multiple Instances January 27, 2015 at 7:51 PM

I’ve done this before. It was a while ago and there were problems to solve but I did get it working. Then I had to set it up again and ran into exactly the same problems! At this point I cursed myself and spent hours googling to solve the same problems.. And so we arrive here where I will explain what I did for your benefit and hopefully prevent myself from going insane in the future 🙂 Over at we needed a system to run several 3D printers in our botfarm. Something simple and scalable. Before we were using SD cards and RAMPS LCD modules to run the printers but this is not suitable in the long run.

We decided to setup OctoPrint instances on an old pc running Ubuntu so that each printer can be controlled from a dedicated webpage on our network or even anywhere in the world!

OctoPrint is more aimed at running one instance, usually on a Raspberry Pi (see OctoPi) so the multiple instance on Ubuntu setup is somewhat tricky if you are a noob. (like me. T_T ) Thus I will detail the steps I made to get here 🙂


First you need a PC running Ubuntu, I installed 14.04 on an old Core 2 Duo machine that was lying around. Get that all updated and what not, which is beyond the scope of this.

Next you need to install OctoPrint, I followed the instructions from here: HOWEVER! This is the root of some problems. I use Marlin on RAMPS for our printers and we like to run them at 250 000 Baud, which is not standard. If you use PySerial v2.6 or lower there is no support for this baud rate and thus you cannot connect to the printer. Not wanting to change the baud on all our printers you can patch the v2.6 to support the baud rate. This didn’t work for me and thus we used the latest v2.7 version that does support this baud rate. As such the install instructions are modified from the above by using this guide:

My install instructions thus come out as follows:

cd ~
sudo apt-get install python-pip python-dev git
sudo apt-get install python-setuptools
git clone
cd OctoPrint
sudo python install
mkdir ~/.octoprint

Next make sure you have pyserial installed:

cd ~
tar -zxvf pyserial-2.7.tar.gz
cd pyserial-2.7
sudo python install --user
sudo python3 install --user

EDIT: At this point I found the following is needed! Otherwise the system seems to use the built in 2.6//

sudo apt-get remove python-serial 

Check that you are running PySerial 2.7! If not you have a problem!

import serial

Make sure you have access rights to the serial ports (where username is your system username ofc):

sudo usermod -a -G tty username
sudo usermod -a -G dialout username


Test that everything is working fine:


And visit your servers ip in your browser with port 5000. e.g. or http://<your-ip>:5000
At this point you should now be able to setup access control and login to the server. Connect your printer and select the correct port + baud rate. If you can connect successfully then we are winning! Otherwise its time to do some sad googling…

cntrl+c in your shell to end the instance of octoprint.

Now that we are past that we can start setting up our OctoPrint instances! (The following is roughly based on these threads: )

Decide how many instances you would like. For this example I will be making 2 copies for a total of 3 instances.

cd ~
cp -rf .octoprint .octoprint1
cp -rf .octoprint .octoprint2

Rinse and repeat however many times you like. NB. It’s also possible to just make copies of the config.yaml file in .octoprint/ and have everything contained in .octoprint/ . I prefer it this way.

next create a startup script to do your evil bidding! (muhah…)

nano ~/



# start the webui 1
$OCTOPRINT_HOME/run --daemon start

# start the webui 2
$OCTOPRINT_HOME/run --daemon start --port 5001 --pid /tmp/octoprint1 --basedir ~/.octoprint1

# start the webui 3
$OCTOPRINT_HOME/run --daemon start --port 5002 --pid /tmp/octoprint2 --basedir ~/.octoprint2

(remember to change username to your username) Again, repeat for as many instances as you like. Remeber to change the port and the directories!


Lets give this a quick test..


You should now be able to reach each instance at http://<your-ip>:5000 , http://<your-ip>:5001 etc.


Each time a printer is plugged in or removed, or the machine restarted, it may be assigned to a different port. To get around this we are going to set some UDEV rules to pickup each printer and assign it a set name.

Lets assume your printer is on port ttyACM0 , do the following:

udevadm info /dev/ttyACM0


You will get a bunch of info back, we are interested in the following lines:

E: ID_SERIAL_SHORT=649363331373512141A1

repeat this for each of your printers and take note of these values.


You can also do this by plugging your printer in and then immediately running


you will get output something like this

[    3.531762] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
[    3.680789] usb 1-1.3: Product: USB2.0 Hub
[    4.002011] usb 1-1.3.1: new full-speed USB device number 6 using dwc_otg
[    4.142434] usb 1-1.3.1: New USB device found, idVendor=0403, idProduct=6001
[    4.190939] usb 1-1.3.1: Product: FT232R USB UART
[    4.206725] usb 1-1.3.1: Manufacturer: FTDI
[    4.214382] usb 1-1.3.1: SerialNumber: A10248WD
[    4.311927] usb 1-1.3.2: new full-speed USB device number 7 using dwc_otg
[    4.459478] usb 1-1.3.2: New USB device found, idVendor=0403, idProduct=6001
[    4.490897] usb 1-1.3.2: Product: FT232R USB UART
[    4.541582] usb 1-1.3.2: Manufacturer: FTDI
[    4.547665] usb 1-1.3.2: SerialNumber: A102499T
[    4.671972] usb 1-1.3.3: new full-speed USB device number 8 using dwc_otg
[    4.829533] usb 1-1.3.3: New USB device found, idVendor=0403, idProduct=6001
[    4.881350] usb 1-1.3.3: Product: FT232R USB UART
[    4.904643] usb 1-1.3.3: Manufacturer: FTDI
[    4.910623] usb 1-1.3.3: SerialNumber: A10248W3
[    5.141922] usb 1-1.3.4: new full-speed USB device number 9 using dwc_otg
[    5.285609] usb 1-1.3.4: New USB device found, idVendor=0403, idProduct=6001
[    5.319118] usb 1-1.3.4: Product: FT232R USB UART
[    5.332834] usb 1-1.3.4: Manufacturer: FTDI
[    5.338718] usb 1-1.3.4: SerialNumber: A90197ZC

Now we are going to create the rules file, you must name the file like this. Lookup udev rule writing for more info:

sudo nano /etc/udev/rules.d/10-local.rules

Into this file place a line for each printer with the values from the step above, similar to the following:

SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0010", ATTRS{serial}=="649363331373512141A1" SYMLINK+="Prusa1"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0042", ATTRS{serial}=="85339313233351A0D092" SYMLINK+="Prusa2"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0042", ATTRS{serial}=="753313339393511181E1" SYMLINK+="Prusa3"

reboot your system and check that everything is playing nicely!

sudo shutdown -r now
ls -l /dev/P*

You should get some output something like the following

lrwxrwxrwx 1 root root 7 Jan 27 15:47 /dev/Prusa1 -> ttyACM1
lrwxrwxrwx 1 root root 7 Jan 27 15:47 /dev/Prusa2 -> ttyACM2
lrwxrwxrwx 1 root root 7 Jan 27 15:47 /dev/Prusa3 -> ttyACM0

Assuming that everything worked correctly we can now always find our printers at the same place! Provided that you do not change the Arduino ofc…

Now we must setup our OctoPrint instances to play nicely with our printers. edit the config.yaml folder in ~/.octoprint/ , ~/.octoprint1/ etc as follows:

nano ~/.octoprint/config.yaml

  # Instead of Prusa1, use a name for your printer
  port: /dev/Prusa1
  # Default is false, but configuring it to true will do the job, well, not really always
  autoconnect: true
  # Instead of Prusa, use you specific prefix
  - /dev/Prusa*
  #set your baudrate
  baudrate: 250000

  # Use a different port number for each printer
  port: 5001

  # Give each of your printer a suggestive name that will appear in the title and navigation bars
  name: Prusa 1
  # Customize the color of the navigation bar (limited choice of colors)
  color: blue
  # set to true if you want to make different login credentials for each instance. 
  firstRun: false

Again, repeat for each instance you created..

lets see if we have things right so far.. (very unlikely! xD)


If everything went according to plan you should now be able to print to each printer correctly on the associated web page!!

One thing left to do… Make this run at startup.. there are many ways to do this but I decided to use a cron job:

sudo crontab -e 

@reboot /home/username/

With some luck, you should be done! Hope this helps 🙂

4 Responses to “Setup an OctoPrint Botfarm on Linux / Ubuntu with Multiple Instances”

  1. Nice Work!

    I tried this with a Raspberry Pi 2 B+ with two printers and it works well. I cannot login to both printers from the same PC, I had to use a second PC to connect to the second printer.

    I would like to connect a second webcam to the Pi to monitor the second printer.

    Do you have any idea on how to do this?


  2. Thats weird that you can’t login from the same PC. Did you change the passwords between the instances?

    Sorry not sure off hand about the Webcams, haven’t played with that yet.

  3. Hi,

    I realize this is a shot in the dark on a year old blog post. I’m trying to set up multiple instances of Octopi and the instances seem to running just fine. However when I access the second instance I can’t access System or Settings. Also some of the widgets aren’t loading correctly. If I change which instance is the ‘default’ that instance runs correctly.
    Have you run into similar issues?


  4. Hi David, Thanks for the comment!

    The issue is related to the new version of Octoprint I think. Some things have changed how they work. I really need to write an updated guide on this… Are you still struggling?

Leave a Reply