Klipper

Important

We recommend installing Klipper via Repetier-Server because we install it directly so that Klipper is integrated in Repetier-Server. The fix shown here is needed only if Klipper is installed as described on the official Klipper page.

Can’t see /tmp/printer and not connect

Klipper by default adds a link /tmp/printer pointing to the correct device to connect to. If that link is owned by a different user then repetierserver and the /tmp folder has the +t flag set, we can not read and open the link due to permission problems. In that case you can either reference the device directly – normally /dev/pts/1 and everything will work.

Solution 1

If you have multiple klipper instances so it is not clear which device will point to which pts device, you can tell klipper where to place that link with -I flag.

New systemd solution

Current klipper versions use a systemd service file to create a service. Here the solution is to change the user running klipper to “repetierserver” and the permission problems with /tmp/printer are gone. So log in via ssh and follow the instructions.

Stop klipper service

sudo service klipper stop

Edit klipper service to run as user repetierserver

sudo nano /etc/systemd/system/klipper.service

Replace old content

#Systemd service file for klipper
[Unit]
Description=Starts klipper on startup
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=pi
RemainAfterExit=yes
ExecStart=/home/pi/klippy-env/bin/python /home/pi/klipper/klippy/klippy.py /home/pi/printer.cfg -l /tmp/klippy.log
Restart=always
RestartSec=10#Systemd service file for klipper
[Unit]
Description=Starts klipper on startup
After=network.target

Into the following one where we only changed the User= line:

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=repetierserver
RemainAfterExit=yes
ExecStart=/home/pi/klippy-env/bin/python /home/pi/klipper/klippy/klippy.py /home/pi/printer.cfg -l /tmp/klippy.log
Restart=always
RestartSec=10

Remove old files which were created by the user “pi”

sudo rm /tmp/klippy.log
sudo rm /tmp/printer

Recreate the service and start klipper

sudo systemctl daemon-reload
sudo service klipper start

Now you can select /tmp/printer as serial device in Repetier-Server and connection should work.

Old init.d solution

Older klipper versions used a service defined in /etc/init.d/klipper – for these use this solution-

Default is in /etc/default/klipper and can be changed there. So create a folder writeable by Klipper, e.g.

sudo mkdir /var/lib/klipper
sudo chmod 777 /var/lib/klipper

And then modify in /etc/default/klipper

KLIPPY_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/printer.cfg -l /tmp/klippy.log"

into

KLIPPY_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/printer.cfg -l /tmp/klippy.log -I /var/lib/klipper/connect"

And then also enter /var/lib/klipper/connect manually in Repetier-Server port name. After restarting Klipper Repetier-Server should now see the link and open it without problems.

Alternative solution

The alternative solution that works as well as the replaced link is to start klipper as repetierserver user. Edit /etc/default/klipper and set

KLIPPY_USER=repetierserver

and restart klipper. Now both have the same user and no permission problems exist.

Introduction

There are several configurations, that can not be changed in the user interface. We start with good default values, but especially if you are a printer manufacturer or if you like to hack how Repetier-Server handles some things, you can still change them.

Most important is the initial configuration that determines where all files get stored, on which ip and port we listen or if the interface should be branded, where to check for updates and so on. This configuration can exist in three parallel files. The last one read changing a setting wins. For that reason you should only add settings you want to change! The first file read is our default RepetierServer.xml file in the installation path. Do not touch this – every update will overwrite it with latest version. Far manufacturer we suggest using same path as our config just with -extra in name, so be default it would be RepetierServer-extra.xml. Now in case users want to change something as well, they should use the STORAGE_DIR/database/RepetierServer.xml file. This also gets backed up using Repetier-Server Monitor.