You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In debugging updating Moonraker on a printer platform, I was attempting to test running it outside of systemd's control, just running it from the command line as my own user. It wasn't clear this wasn't exactly supported and I didn't find any mention in the docs that you shouldn't do this, so I pressed on.
However, the startup sequence fails with an exception from dbus_next, trying to interrogate the org.freedesktop.systemd1 services available on the machine. Ultimately since it can't find the service, it ends up putting the system into a read-only state.
It wasn't immediately obvious to me that you shouldn't/couldn't test the system outside of systemd, so I assumed there was something wrong with my environment, and added debug logging to figure out what objects dbus_next was unhappy about or why it may be failing in such a way. The output from those statements in the relevant section is here:
2024-12-22 05:39:40,386 [server.py:load_component()] - Component (authorization) loaded
2024-12-22 05:39:40,409 [server.py:_initialize_component()] - Performing Component Post Init: [dbus_manager]
2024-12-22 05:39:40,426 [dbus_manager.py:get_interfaces()] - bus_name: org.freedesktop.PolicyKit1, bus_path: /org/freedesktop/PolicyKit1/Authority
2024-12-22 05:39:40,444 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.PolicyKit1.Authority
2024-12-22 05:39:40,446 [server.py:_initialize_component()] - Performing Component Post Init: [file_manager]
2024-12-22 05:39:40,493 [server.py:_initialize_component()] - Performing Component Post Init: [machine]
2024-12-22 05:39:40,493 [machine.py:validation_init()] - Validation version in database out of date
2024-12-22 05:39:40,494 [dbus_manager.py:get_interfaces()] - bus_name: org.freedesktop.systemd1, bus_path: /org/freedesktop/systemd1
2024-12-22 05:39:40,528 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.systemd1.Manager
2024-12-22 05:39:40,583 [dbus_manager.py:get_interfaces()] - bus_name: org.freedesktop.login1, bus_path: /org/freedesktop/login1
2024-12-22 05:39:40,607 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.login1.Manager
2024-12-22 05:39:40,765 [dbus_manager.py:get_interfaces()] - bus_name: org.freedesktop.systemd1, bus_path: /org/freedesktop/systemd1/unit/klipper_5fmcu_2eservice
2024-12-22 05:39:40,802 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.DBus.Properties
2024-12-22 05:39:40,807 [dbus_manager.py:get_interfaces()] - bus_name: org.freedesktop.systemd1, bus_path: /org/freedesktop/systemd1/unit/klipper_2eservice
2024-12-22 05:39:40,843 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.DBus.Properties
2024-12-22 05:39:40,847 [dbus_manager.py:get_interfaces()] - bus_name: org.freedesktop.systemd1, bus_path: /org/freedesktop/systemd1/unit/moonraker_2eservice
2024-12-22 05:39:40,885 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.DBus.Properties
2024-12-22 05:39:40,890 [dbus_manager.py:get_interfaces()] - bus_name: org.freedesktop.systemd1, bus_path: /org/freedesktop/systemd1/unit/webcamd_2eservice
2024-12-22 05:39:40,925 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.DBus.Properties
2024-12-22 05:39:40,937 [machine.py:check_virt_status()] - No Virtualization Detected
2024-12-22 05:39:40,958 [machine.py:_find_public_ip()] - Detected Local IP: 192.168.1.166
2024-12-22 05:39:40,964 [webcam.py:_set_default_host_ip()] - Default public webcam address set: http://192.168.1.166
2024-12-22 05:39:40,969 [machine.py:extract_service_info()] - Getting interfaces on bus: org.freedesktop.systemd1, path: /org/freedesktop/systemd1/unit/session_2d2_2escope, pid: 15376
2024-12-22 05:39:40,969 [dbus_manager.py:get_interfaces()] - bus_name: org.freedesktop.systemd1, bus_path: /org/freedesktop/systemd1/unit/session_2d2_2escope
2024-12-22 05:39:40,993 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.systemd1.Unit
2024-12-22 05:39:41,002 [dbus_manager.py:get_interfaces()] - interface: org.freedesktop.systemd1.Service
2024-12-22 05:39:41,002 [machine.py:extract_service_info()] - Error Extracting Service Info
Traceback (most recent call last):
File "/home/mks/moonraker-env/lib/python3.7/site-packages/dbus_next/proxy_object.py", line 217, in get_interface
intr_interface = next(i for i in self.introspection.interfaces if i.name == name)
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mks/moonraker_repo/new-repo/moonraker/components/machine.py", line 1217, in extract_service_info
[f"{bus}.Unit", f"{bus}.Service"]
File "/home/mks/moonraker_repo/new-repo/moonraker/components/dbus_manager.py", line 141, in get_interfaces
intf = proxy_obj.get_interface(ifname)
File "/home/mks/moonraker-env/lib/python3.7/site-packages/dbus_next/aio/proxy_object.py", line 159, in get_interface
return super().get_interface(name)
File "/home/mks/moonraker-env/lib/python3.7/site-packages/dbus_next/proxy_object.py", line 219, in get_interface
raise InterfaceNotFoundError(f'interface not found on this object: {name}')
dbus_next.errors.InterfaceNotFoundError: interface not found on this object: org.freedesktop.systemd1.Service
The issue was that when running outside of systemd's control, the object created for moonraker is a Scope object instead of a Service as its expecting to query:
The logic tries to use the Unit and Service interfaces on a Scope object and that generates the InterfaceNotFound exception.
I would like to suggest that the logic be updated to better handle this condition (only query objects with interfaces they support) and also perhaps check and handle that its not running as a systemd service and log as such.
I would also suggest that adding a warning to indicate that write access is disabled helped me figure out why things looked like they started but in fact it was in a read-only state. Something like:
self.server.add_warning(str(ve))
+ self.server.add_warning(f"Write access is disabled.")
fm.disable_write_access()
anytime disable_write_access() is called.
I don't know enough about the Moonraker internals to make the changes and submit a PR, so instead I figured I'd document the issue at least and submit it as a bug report. Might help someone else down the road.
Client
Fluidd
Browser
Other or N/A
How to reproduce
Start moonraker from the command line directly instead of from systemd.
Additional information
No response
The text was updated successfully, but these errors were encountered:
While Moonraker expects systemd to be installed by default, it is possible to select another provider, or disable some of the enhanced system management options. See the documentiation for details, particularly the provider options.
What happened
In debugging updating Moonraker on a printer platform, I was attempting to test running it outside of systemd's control, just running it from the command line as my own user. It wasn't clear this wasn't exactly supported and I didn't find any mention in the docs that you shouldn't do this, so I pressed on.
However, the startup sequence fails with an exception from
dbus_next
, trying to interrogate theorg.freedesktop.systemd1
services available on the machine. Ultimately since it can't find the service, it ends up putting the system into a read-only state.It wasn't immediately obvious to me that you shouldn't/couldn't test the system outside of systemd, so I assumed there was something wrong with my environment, and added debug logging to figure out what objects
dbus_next
was unhappy about or why it may be failing in such a way. The output from those statements in the relevant section is here:The issue was that when running outside of systemd's control, the object created for moonraker is a Scope object instead of a Service as its expecting to query:
2024-12-22 05:39:40,969 [machine.py:extract_service_info()] - Getting interfaces on bus: org.freedesktop.systemd1, path: /org/freedesktop/systemd1/unit/session_2d2_2escope, pid: 15376
The logic tries to use the Unit and Service interfaces on a Scope object and that generates the InterfaceNotFound exception.
anytime
disable_write_access()
is called.I don't know enough about the Moonraker internals to make the changes and submit a PR, so instead I figured I'd document the issue at least and submit it as a bug report. Might help someone else down the road.
Client
Fluidd
Browser
Other or N/A
How to reproduce
Start moonraker from the command line directly instead of from systemd.
Additional information
No response
The text was updated successfully, but these errors were encountered: