设计为用于PostmarketOS, 也可适用于其他Linux发行版, 只要串口在/dev/ttyACM*
或/dev/ttyUSB*
可用即可.
安装:
- 将本仓库克隆或下载到你需要安装klipper chroot容器的设备上.
- 获取 ubuntu-base rootfs:
在 http://mirrors.ustc.edu.cn/ubuntu-cdimage/ubuntu-base/releases/22.04/release 找到符合你设备架构的rootfs,下载到本目录,然后用以下命令解压到rootfs
文件夹下:如有需要,进入mkdir rootfs cd rootfs tar -xf ubuntu-base-*.tar.gz
rootfs/etc/apt/sources.list
替换镜像源. - 先运行
mount.sh
挂载容器所需目录 - 进入容器,在其中创建并进入
klippy
用户,用于运行klipper:sudo chroot rootfs /bin/bash apt update && apt install sudo git -y useradd klippy usermod -a -G sudo klippy mkdir -p /home/klippy/ chown klippy:klippy /home/klippy/ su klippy cd ~
- 在容器内的
klippy
用户,通过kiauh安装klipper, moonraker, klipperscreen和Mainsail/Fluidd - 安装完退出chroot容器命令行, 将
scripts
文件夹下的脚本复制到rootfs/home/klippy/scripts
目录下. - 对于PostmarketOS, 如需通过wifi正常访问可能需要以下操作:
默认开放
sudo cp 99_klipper.nft /etc/nftables.d/ sudo service nftables restart
80
(WebUI),7125
(Moonraker) 端口.如需使用其他端口(如摄像头), 请在99_klipper.nft
中另外添加(格式参考原有规则), 再运行命令.
使用:
- 运行
mount.sh
挂载容器所需目录 - 然后
start_all.sh
启动chroot容器中的klipper
其他脚本:
start_klipperscreen.sh
: 启动klipperscreenchroot.sh
: 进入chroot shell,默认为root
用户chroot_klippy.sh
: 进入chroot shell并切换到klippy
用户umount.sh
: 解除挂载容器
注意: 由于chroot容器中没有systemd,Moonraker的更新检测不可用,必须通过kiauh更新.忽略以下警告.
[machine]: DBus Connection Not available, systemd service tracking and actions are disabled
Unable to retrieve Moonraker service info. Service file must be updated manually.
Designed for PostMamarketOS, but also usable on other linux distros as long as the serial port is usable on /dev/ttyACM*
or /dev/ttyUSB*
Installation:
- Clone or download this repository to the device you want to install klipper chroot container.
- Get ubuntu-base rootfs:
Find a rootfs for your device's architecture in http://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/ , download it to this folder, and unpack it torootfs
folder with the following:Entermkdir rootfs cd rootfs tar -xf ubuntu-base-*.tar.gz
rootfs/etc/apt/sources.list
and replace repository with a mirror if needed. - Run
mount.sh
to mount directories for the container - Enter the container, create and switch to user
klippy
inside it, for running klipper:sudo chroot rootfs /bin/bash apt update && apt install sudo git -y useradd klippy usermod -a -G sudo klippy mkdir -p /home/klippy/ chown klippy:klippy /home/klippy/ su klippy cd ~
- Install klipper, moonraker, klipperscreen and Mainsail/Fluidd with kiauh
- Exit the chroot shell, then copy scripts in
scripts
folder torootfs/home/klippy/scripts
. - For PostmarketOS, this config is probably needed for accessing via wifi:
Opens port
sudo cp 99_klipper.nft /etc/nftables.d/ sudo service nftables restart
80
(WebUI),7125
(Moonraker) by default. For any additional ports, please add in99_klipper.nft
, then execute the commands below.
Usage:
- Run
mount.sh
first to mount directories for the container - Run
start_all.sh
to run klipper in the container
Other scripts:
start_klipperscreen.sh
: Start klipperscreenchroot.sh
: Enter chroot shell, withroot
userchroot_klippy.sh
: Enter chroot shell, withklippy
userumount.sh
: Unmount the container
Notice that Moonraker's update checker is unavailable as There is no systemd in chroot. Use kiauh for updates instead. Ignore the following warnings.
[machine]: DBus Connection Not available, systemd service tracking and actions are disabled
Unable to retrieve Moonraker service info. Service file must be updated manually.