Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make systemd service user-specific instead of system-wide #5

Open
rGunti opened this issue Nov 8, 2024 · 4 comments
Open

Make systemd service user-specific instead of system-wide #5

rGunti opened this issue Nov 8, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@rGunti
Copy link

rGunti commented Nov 8, 2024

Related to the following comment on the YouTube video (I am not the author of the comment, but I share the same view and have some information about this)

@zvpunry1971
2 hours ago
5:45 Don't throw own service files to /lib/systemd/system/, there they belong to /etc/systemd/system/. But that is only for services that don't belong to some specific user. On a raspberry pi you have the default user that is automatically logged in. This user has its own systemd running, it is controlled with "systemctl --user ..." and has its service files in ~/.config/systemd/user/

That said, depending on your desktop environment (I assume raspberry pi defaults), there is another place to automatically start the script: ~/.config/autostart/ where you can put *.desktop files.

The .service file has to be located under ~/.config/systemd/user/ instead and systemctl commands have to be used with the --user flag, apart from that the handling should be the same.

Disclaimer: I pulled this information from my own project of running an Elgato Stream Deck on Linux Mint (Ubuntu-based), but afaik systemd should handle this the same way on Raspbian as well.

@geerlingguy geerlingguy added the enhancement New feature or request label Nov 8, 2024
@geerlingguy
Copy link
Owner

Agreed, since this is a userspace thing, it shouldn't apply to the global system. Permissions might even be easier (e.g. not having to do #4 and use sudo to copy that file).

@wulph111
Copy link

The .service file has to be located under ~/.config/systemd/user/ instead and systemctl commands have to be used with the --user flag, apart from that the handling should be the same.

I tried to implement this and got the following error:

pi@pipad:~/bin $ systemctl --user enable kiosk

...

Unit /home/pi/.config/systemd/user/kiosk.service is added as a dependency to a non-existent unit graphical.target.

@geerlingguy
Copy link
Owner

Ah, in that case we could probably remove that target from kiosk.service, since the user account would only be logged in after the graphical target's been reached!

@sprior
Copy link

sprior commented Nov 15, 2024

I was just working on this a little. Starting from the kiosk.service in the repo I had to comment out the User and Group lines. I also changed the graphical.target to default target. I mostly got it working except that the cursor didn't hide - haven't figured out why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants