Arksine / moonraker

Web API Server for Klipper
https://moonraker.readthedocs.io
GNU General Public License v3.0
1.02k stars 392 forks source link

Moonraker host shutdown not working #808

Closed Gizzzle closed 2 months ago

Gizzzle commented 5 months ago

What happened

When trying to shutdown the Raspberry CM4 module on my Manta M8P board, nothing happens. In the moonraker.log the following error comes up:

[common.py:build_error()] - JSON-RPC Request Error - Requested Method: machine.shutdown, Code: 500, Message: Error running shell command: 'sudo systemctl poweroff'

I used the MainsailOS image, but also tried to reinstall via Kiauh.

Client

Mainsail

Browser

Firefox

How to reproduce

In mainsail press the host shutdown button

Additional information

moonraker.log

Arksine commented 5 months ago

You have the systemd_cli provider configured in [machine]. When you do this the user that owns the Moonraker process needs "no password" sudo permission for Moonraker to restart. FWIW, you also have packagekit disabled in the update_manager. APT needs the "no password" permission to install packages, so this too will fail if you attempt to do so.

I would recommend using the default systemd_dbus provider. The polkit permissions should be installed already, but if not the script in ~/moonraker/scripts/set-policykit-rules.sh can add them. If you don't want to do this, you need to give the user no password access.

Arksine commented 2 months ago

As this discussion has concluded I'm going to close this.