BRLtty / ModemManager - Services Interfering with Klipper

Background

Some Linux distributions, particularly their desktop variants, may install services that interfere with connected printer boards. This can result in Klipper losing the ability to connect to the board or commands such as ls /dev/serial/by-id showing no results.
So far, two services are known:

  • ModemManager
  • BRLtty

How to Diagnose

The How-To Trouble-Shoot article provides a detailed approach for diagnosing such events using the Linux dmesg command.

Manual Process

To manually check for such processes and disable them use the following commands:

# List all brltty services (replace with "modemmanger" to check this)
sudo systemctl list-units | grep -i brltty
# For each item in the result list of the above command run
sudo systemctl mask brltty.path
sudo systemctl stop brltty.path
# "brltty.path" is only an example. Replace it with the first command's output

Automatic Solution

This shell script will automatically check if the services exist, disable them, and then “mask” them to prevent unintentional startups of these services by other services.
Run this command:

curl -sf -L https://raw.githubusercontent.com/Sineos/useful_bits/main/Linux/disable_unwanted_services.sh | sudo bash

:warning: WARNING:

  • This script requires root privileges and will error if not run as root
  • We have no intention of conducting any malicious activity on your installation. However, it is good practice to exercise caution when executing foreign scripts under root privileges.
  • If you do not feel comfortable with it, then follow the manual process
3 Likes