[mcu host] Can not update MCU 'mcu' config as it is shutdown after system reset/start

Printer Model: Modified ANET A8 with E3D-V6 extruder, capacitive leveling sensor, 2 stepper for z-axis
MCU / Printerboard: BTT SKR MINI V1.2 with additional stepper for extruder

klippy.log (536.1 KB)

Hello,
If the MCU host is activated in the printer.cfg the error message “Can not update MCU ‘mcu’ config as it is shutdown” appears after a system start or restart.

Raspberry Pi as MCU

[mcu host]
serial: /tmp/klipper_host_mcu

The mcu host is only integrated and has no further function (integration test).
FIRMWARE_RESTART fixes the problem temporarily until the next reboot.
After deactivating the mcu host klipper starts without problems.

Make sure to have followed RPi microcontroller - Klipper documentation and verify that it is actually executed at boot. Sounds like a Linux issue

Hi Sineos,

After updating all the components, I did the [RPi Microcontroller - Klipper Documentation] (RPi microcontroller - Klipper documentation) again (3rd try). I made a pseudo change in menuconfig to save the new configuration. Then make clean and make flash.
Same system behavior :frowning:

The Raspberry is a 3b. I am using the MainSail OS Linux build.
Basically it should work though, right?

A delayed start of Klipper did not bring the solution either.
I guess I will do without mcu host or try a complete reinstall.

Thanks!
Bauschlumpf

The relevant part in the documentation is:

cd ~/klipper/
sudo cp "./scripts/klipper-mcu-start.sh" /etc/init.d/klipper_mcu
sudo update-rc.d klipper_mcu defaults

You can check yourself with sudo systemctl list-dependencies:

 $ sudo systemctl list-dependencies
default.target
● ├─cpufrequtils.service
● ├─display-manager.service
● ├─haveged.service
● ├─hostapd.service
● ├─klipper_mcu.service
● ├─loadcpufreq.service
● ├─rng-tools.service
● ├─sysfsutils.service
● ├─systemd-update-utmp-runlevel.service
● └─multi-user.target
●   ├─chrony.service
●   ├─console-setup.service
●   ├─cpufrequtils.service
●   ├─cron.service
●   ├─dbus.service
●   ├─hostapd.service
●   ├─klipper.service
●   ├─klipper_mcu.service

klipper_mcu.service needs to be started before the main Klipper service by the Linux OS. Above you can see that on my system the klipper_mcu.service is started under the default target before anything else.

My systemctl list-dependencies was so as you discribe.

I have new the system with redownload the image from mainailos. Same result. :frowning:

klipper_mcu.service is unter default.target and multi-user.target after klipper.service.

I renew the system again and change the start script of klipper.service to start klipper_mcu.service before klipper.

Thank you very much!!!

I have found a solution. Instead of:

cd ~/klipper/
sudo cp "./scripts/klipper-mcu-start.sh" /etc/init.d/klipper_mcu
sudo update-rc.d klipper_mcu defaults

I made the following additions, because MainsailOS uses systemd and the boot sequence gets messed up.

  • Creation of the file /etc/systemd/system/klipper-mcu.service
#Systemd Klipper-MCU Service

[Unit]
Description=Starts Klipper MCU for Klipper
Documentation=https://www.klipper3d.org/
After=network.target
Before=klipper.service

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=root
RemainAfterExit=yes
ExecStart= /home/pi/klipper/scripts/klipper-mcu-start.sh start
Restart=always
RestartSec=10

The path to klipper/scripts/klipper-mcu-start.sh may have to be changed.

  • sudo systemctl daemon-reload
  • sudo systemctl enable klipper-mcu

With ‘User = root’ I am unsure, unfortunately could not create a custom folder below /var/run that survives the reboot including permissions.

My solution is deprecated with the commit e631840 (scripts: add systemd klipper-mcu.service example · Klipper3d/klipper@e631840 · GitHub) from @meteyou

  • The file /home/pi/klipper/scripts/klipper-mcu-start.sh is deleted

New standard solution:
Simple follow the new description in RPi microcontroller - Klipper documentation

=> overwrite my /etc/systemd/system/klipper-mcu.service with the new one
and rebuild and install the micro-controller code

Thanks to @meteyou