Install OctoPrint/OctoPi for different user than "pi"

What is the problem?

I was wondering if it is at all possible to install OctoPrint or OctoPi for a different user than the default "pi" user without editing the hard-coded username throughout the source code?

What did you already try to solve it?

I've renamed the default "pi" user and the "/home/pi" to my own user. After this errors started showing saying "/home/pi" couldn't be found, or user "pi" doesn't exist. So I started going through the source code and changing the hard-coded "pi" user to my own. But this is quite a tedious process and I don't think this is a good solution (possibly if I got it working, there may be problems installing extensions)...

Have you tried running in safe mode and if so did it solve the issue?

No: not needed.

Additional information about your setup

Using:

  • OctoPi 0.17.0 (.img, no manual install)
  • Raspberry 4B 8GB model
  • booting from SD card (no USB boot)
  • printer: Prusa i3 MK3S (not yet connected)

I was just wondering if installation for a different user was possible. If not I'll just use the default "pi" user, but would prefer my own user.

OctoPi comes with everything configured for the user "pi". You could reinstall/reconfigure everything for a different user, but then you would first have to remove OctoPrint (and mjpeg streamer) before installing it for a new user. At that point it would probably be easier to not start with OctoPi, but start with a clean Raspberry OS and following the generic guide but using a different user. OctoPrint has no preference for any os user.

1 Like

Oh, I was thinking of installing OctoPrint on a Raspberry Pi OS manually, but in the code I thought I still saw some references directly to the "pi" user/home folder. But I'll try anyway and otherwise I'll just keep the "pi" user.

In the code, there should be no hard reference to the user pi. What you may find hard is just renaming the folder /home/pi, since python/pip is probably looking in /home/pi/oprint for the modules (OctoPi), so this will break.

You can of course, install OctoPrint manually using the guide, but after you have a new user, then run everything logged in as them so the permissions are right.

Nope. OctoPrint is not only user agnostic, it's platform agnostic. I develop it under Windows. If there was hardcoded usernames or paths here, I'd certainly notice.

1 Like

Nice. I've already installed a bare Raspberry Pi OS. Going to install OctoPrint later today. Thanks

I had to edit cat /etc/systemd/system/octoprint.service
Replace pi in the lines below with your desired username. By default it points to /home/pi Then restart the service and run systemctl staus octoprint to verirify the service is running

User=pi
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint