-
Notifications
You must be signed in to change notification settings - Fork 117
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
Linux service package - adapt to older systemd versions #454
Comments
What are the boundaries in terms of distro versions? |
Currently, zrok-share.service requires systemd v232 or newer because that's when |
What does that translate to in distro versions for Debian/ubuntu and centos? |
It excludes Ubuntu Bionic and CentOS 7, but all the newer distros I've tested were good. |
from the Vagrantfile
EDIT: add Debian test results |
Tried Debian Buster (10), which has v241, but zrok panicked. Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: INFO: running: zrok enable ...
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: panic: user: unknown userid 64342
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: goroutine 1 [running]:
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: main.(*enableCommand).run(0xc000090d20, 0x0?, {0xc000322fc0, 0x1, 0x0?})
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: /home/runner/work/zrok/zrok/cmd/zrok/enable.go:61 +0x1268
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: github.com/spf13/cobra.(*Command).execute(0xc000396300, {0xc000322f40, 0x4, 0x4})
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x863
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: github.com/spf13/cobra.(*Command).ExecuteC(0x4d7e2c0)
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: github.com/spf13/cobra.(*Command).Execute(...)
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: main.main()
Nov 16 03:32:40 debian10.localdomain zrok-enable.bash[6397]: /home/runner/work/zrok/zrok/cmd/zrok/main.go:99 +0x1a
Nov 16 03:32:40 debian10.localdomain systemd[1]: zrok-share.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
Nov 16 03:32:40 debian10.localdomain systemd[1]: zrok-share.service: Failed with result 'exit-code'. |
I'll revisit this after the zrok daemon mode is introduced because that will entail a refactor of the zrok-share Linux package that provides the systemd service. |
Hi, |
Hey there @tristanryerparke! I'll need your help to diagnose this one because I don't have a representative environment to test with. Let's debug Please add this line to the other shell options that are set near the top of set -o xtrace The next time the service runs it will use the modified script. Are you allowing systemd to manage the file content, owner, and mode of the files in I expect systemd to set the file owner of all files in This means the dynamic UID from the last run no longer exists, so it raises a question about whether there are still some files owned by the prior run's dynamic UID inside that directory. |
@qrkourier here is the full output from
I'm not that familiar with linux, but when I try Funnily enough, I can run a command on that same system like Is there good way to do a full uninstall and reinstall of all zrok things on the system, and try again? |
I did find that the Go library in use will sometimes fail to resolve the UID when running in a systemd dynamic user sandbox. I've sent a patch that resolves this for Debian 10 (Buster), which is where I first encountered the same error you reported. I think that will fix it for Raspbian too. Can you determine whether your version of Raspbian is in fact a descendant of Debian 10? I didn't have the same issue on Debian 11 or 12. # inspect distribution info
cat /etc/*-release Meanwhile, you may wish to disable your sudo systemctl disable --now zrok-share.service Substitute a line like this in place of
With that modification to the user service, you may load and enable it with these commands. systemctl --user daemon-reload
systemctl --user enable --now zrok-share.service Now you should see a status. systemctl --user status zrok-share.service And logs journalctl --user -xeu zrok-share.service If you don't see logs, you may need to enable journal persistence in [Journal]
Storage=persistent After changing sudo systemctl restart systemd-journald.service In this configuration, the systemd service runs as user "pi" and so the enabled zrok environment is located in |
this worked, thank you. Debian info:
|
If the version of systemd predates the features used by the service then the service should adapt itself to the available features.
The features used to drop privileges are not new, but give this issue a +1 if you encounter the issue of STATE_DIRECTORY not defined and want to run the zrok-share service with an older version of systemd.
The workaround is to modify the service unit to run as root, or another user, and to manually create that user's HOME for the service to use, replacing the directives
DynamicUser
orStateDirectory
if they're not supported by the older systemd.The text was updated successfully, but these errors were encountered: