Skip to content

Instantly share code, notes, and snippets.

@djorborn
Last active November 23, 2021 22:28
Show Gist options
  • Save djorborn/8b075770b12646f4970d6679d2bf71df to your computer and use it in GitHub Desktop.
Save djorborn/8b075770b12646f4970d6679d2bf71df to your computer and use it in GitHub Desktop.
Klipper & OctoPrint for Void Linux

This is a guide for installing Klipper and Octoprint on Void Linux

Installing Klipper

I am assuming you have a printer.cfg file in your home directory, your printer is connted via USB and you know kinda how to use a terminal.

I have made a new user pi, to keep things as close to the raspberry-pi setup as I can. I recommend you do this as well.

To make a new user

# Login as root
su
# create the new user
useradd -m -G dialout,tty -s /bin/bash pi

Add this user to soders with visudo command, google if you need help with vi or install nano and run EDITOR=nano visudo form root.

You will need python2 for this to run and python3 to set it up. As of writing this python2 in Void Linux is called python in xbps and python3 is python3. I think they are working on making everything python3 and there is a python3 branch that I have tested and works without Python2 but I am not sure how complete that is.

Now that the user is set up and you are logged in as pi, do the following....

  1. Install system dependencies
sudo xbps-install -S python python3 python3-pip python3-devel python3-setuptools git base-devel libffi-devel libyaml-devel avrdude avr-gcc avr-binutils avr-libc
  1. Clone Klipper Repo from github
cd ~/
git clone https://github.com/Klipper3d/klipper.git klipper
cd klipper
  1. Setup python-venv
python3 -m venv venv
source venv/bin/activate
  1. Install Dependencies
./venv/bin/python -m pip install --upgrade pip
./venv/bin/pip install -r scripts/klippy-requirements.txt
  1. Create runsv service(runit) direcotry and file
sudo mkdir /etc/sv/klipper
sudo touch /etc/sv/klipper/run
sudo chmod +x /etc/sv/klipper/run
  1. Edit the file /etc/sv/klipper/run
#!/bin/bash
export USER=pi
export HOME=/home/pi
groups="$(id -Gn "$USER" | tr ' ' ':')"

exec chpst -u "$USER:$groups" "$HOME"/klipper/venv/bin/python "$HOME"/klipper/klippy/klippy.py "$HOME"/printer.cfg -l /tmp/klippy.log
  1. Enable klipper
sudo ln -srv /etc/sv/klipper /var/service
  1. It be a good idea to reboot too.

Install OctoPrint in Void Linux

All of the dependencies got installed in the Klipper install, so this is pretty simple.

  1. make the directory
cd ~
mkdir OctoPrint && cd OctoPrint
  1. Setup Python3 venv
python3 -m venv venv
source venv/bin/activate
  1. Install Octoprint
./venv/bin/pip install pip --upgrade
./venv/bin/pip install octoprint
  1. Create runsv service(runit) direcotry and file
sudo mkdir /etc/sv/octoprint
sudo touch /etc/sv/octoprint/run
sudo chmod +x /etc/sv/octoprint/run
  1. Edit the file /etc/sv/octoprint/run
#!/bin/bash
export USER=pi
export HOME=/home/pi
groups="$(id -Gn "$USER" | tr ' ' ':')"

exec chpst -u "$USER:$groups" "$HOME"/OctoPrint/venv/bin/octoprint serve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment