Difficulty with Systemd Autostart (Pi4 - venv)

What is the problem?

I have installed Octoprint using this guide

My pi does various things that aren't octoprint, so I set it up to run in a python venv

I can see the web interface fine if I run:

~/OctoPrint/venv/bin/octoprint serve

However when I try to start the service I get:

Job for octoprint.service failed because the control process exited with error code.

journalctl says

Dec 11 20:28:00 raspberrypi systemd[1]: Starting The snappy web interface for your 3D printer...
β–‘β–‘ Subject: A start job for unit octoprint.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘ A start job for unit octoprint.service has begun execution.
β–‘β–‘ The job identifier is 1458.
Dec 11 20:28:00 raspberrypi systemd[1334]: octoprint.service: Failed to determine user credentials: No such process
Dec 11 20:28:00 raspberrypi systemd[1334]: octoprint.service: Failed at step USER spawning /home/steve/OctoPrint/venv/bin/octoprint: No such process
β–‘β–‘ Subject: Process /home/steve/OctoPrint/venv/bin/octoprint could not be executed
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘ The process /home/steve/OctoPrint/venv/bin/octoprint could not be executed and failed.
β–‘β–‘ The error number returned by this process is ERRNO.

My /etc/systemd/system/octoprint.service

Description=The snappy web interface for your 3D print>



What did you already try to solve it?

I've googled the error message, which has led me to this community.

Have you tried running in safe mode?

What's that?

Did running in safe mode solve the problem?

No idea - this is a systemd issue

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

browser.user_agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0
connectivity.connection_ok: true
connectivity.enabled: true
connectivity.online: true
connectivity.resolution_check: octoprint.org
connectivity.resolution_ok: true
env.hardware.cores: 4
env.hardware.freq: 1800
env.hardware.ram: 8190787584
env.os.bits: 64
env.os.id: linux
env.os.platform: linux
env.plugins.pi_support.model: Raspberry Pi 4 Model B Rev 1.4
env.plugins.pi_support.throttle_check_enabled: true
env.plugins.pi_support.throttle_check_functional: true
env.plugins.pi_support.throttle_state: 0x0
env.python.pip: 22.3.1
env.python.version: 3.9.2
env.python.virtualenv: true
octoprint.last_safe_mode.date: unknown
octoprint.last_safe_mode.reason: unknown
octoprint.safe_mode: false
octoprint.version: 1.8.6
systeminfo.generated: 2022-12-11T20:32:43Z
systeminfo.generator: systemapi

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

Seemingly working installation, without ability to autostart via systemd

I think I've found two clues that I blindly followed an out of date tutorial:

(1) pi is the (now deprecated) default RaspberryPi user; and
(2) pi is not the user I use to run Octoprint!

I can't (yet) access my pi remotely, but will check the above when on the same network.

The install guide you linked in your original post above is kept up-to-date, however it doesn't explicitly mention to change the usernames I guess if you aren't using Pi. Something had to be put in there and it would be more common to change the username now than it used to be. The guide could be updated to make it more explicit I suppose.

I agree - using <$USER> or similar as a placeholder would be just as easily overlooked as using pi

I was basically just not giving it enough thought because I was rushing

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.