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

OpenRC support #102

Open
n0toose opened this issue Jul 4, 2020 · 12 comments · May be fixed by #114
Open

OpenRC support #102

n0toose opened this issue Jul 4, 2020 · 12 comments · May be fixed by #114
Labels
enhancement New feature or request

Comments

@n0toose
Copy link

n0toose commented Jul 4, 2020

Hey, I was wondering whether getting xow to work with the OpenRC service manager would be possible.

Thanks!

@medusalix
Copy link
Owner

It's certainly possible, but I don't have any experience writing init scripts.
If you'd like to create such scripts, I'd suggest putting them into a repository and I'll add a link to the README.

@kakra
Copy link
Contributor

kakra commented Jul 6, 2020

OpenRC does not support user services... I think xow was converted to running with user privileges only recently? So it would need to become an xdg autostart item - which is not compatible with systemd-user service... You can either use one or the other.

@medusalix
Copy link
Owner

Nah, it's still a system-service right now. I've realized that user-services have too many drawbacks to be a good alternative.

@kakra
Copy link
Contributor

kakra commented Jul 6, 2020

Then it should be very easy to create an OpenRC service, the format is pretty simple. But xow probably needs a real log file writer so logs to not vanish in /dev/null. I banned OpenRC from my system when I migrated to systemd (by masking /etc/init.d from package installation in Gentoo), so I can't really help here.

@medusalix
Copy link
Owner

@AlwaysLivid Are you still interested in creating an init file yourself?

@medusalix medusalix added the enhancement New feature or request label Aug 4, 2020
@n0toose
Copy link
Author

n0toose commented Aug 4, 2020

@AlwaysLivid Are you still interested in creating an init file yourself?

In all honesty, I'm still trying to get the hang of Gentoo and I barely know anything about OpenRC, as well as a bunch of side-projects on my plate. I'll try to look into it.

@n0toose
Copy link
Author

n0toose commented Aug 4, 2020

Just not particularly sure if I'm able to make the time for it. Could I reach out to you on any other platforms? @medusalix

@kakra
Copy link
Contributor

kakra commented Aug 4, 2020

... Are you still interested in creating an init file yourself?

In all honesty, I'm still trying to get the hang of Gentoo and I barely know anything about OpenRC, as well as a bunch of side-projects on my plate. I'll try to look into it.

Gentoo is in the process of making systemd a first-class citizen (but not a replacement). Portage currently unifies session manager support useflags from elogind and systemd and will make either of both a requirement. After this, switching from or to systemd should be mostly plug & play. So you may want to wait and not even bother with learning OpenRC, and just stick with systemd.

You could also enable systemd just now by switching to a systemd profile, but it may require you to tweak one or another useflag and maybe uninstall or mask a package currently. I'm using systemd in Gentoo since over 5 years without any major problems, and without any problems at all since at least 2 years.

@medusalix
Copy link
Owner

@AlwaysLivid You can join the Discord server if you want.
@kakra Would you mind enabling the Server Widget in the server settings? I'd like to add a Discord badge to xow's README.

@115100
Copy link

115100 commented Aug 6, 2020

#!/sbin/openrc-run

command=/bin/xow
pidfile=/var/run/xow.pid
command_background=true
command_user="nobody:nobody"
name="xow"

depend() {
        keyword -lxc
}

Works for me. Ideally, you want a dedicated user to run xow under instead of nobody, but the guru overlay's ebuild doesn't create a user and I can't be bothered to maintain my own ebuild.

kapsh added a commit to kapsh/xow that referenced this issue Aug 11, 2020
Support is optional, therefore init/conf files will be prepared
for packagers while building but not installed.

Closes medusalix#102
@kapsh kapsh linked a pull request Aug 11, 2020 that will close this issue
@kapsh
Copy link

kapsh commented Aug 11, 2020

Delivered in #114.

Basically it works, customizing user, environment and logging supported too.

❯ rc-service xow start
xow              | * Caching service dependencies ... [ ok ]
xow              | * Starting xow ... [ ok ]

~ root@hedgehog
❯ cat /var/log/xow.log 
2020-08-11 14:27:27 INFO  - xow v0.5-17-g0b3b7f3 ©Severin v. W.
2020-08-11 14:27:27 INFO  - Waiting for device...
2020-08-11 14:27:28 INFO  - Wireless address: 62:45:b5:0d:d8:63
2020-08-11 14:27:28 INFO  - Dongle initialized

The only issue I found that after suspend2ram xow exits with

2020-08-11 13:46:42 ERROR - Error in bulk read: LIBUSB_ERROR_NO_DEVICE
2020-08-11 13:46:42 INFO  - Shutting down...

and service reported as crashed. Don't know a way to restart it automatically, cheers for heads-up. This also can be fixed by returning to waiting for device state when connection is lost, @medusalix what would you say about that?

kapsh added a commit to kapsh/xow that referenced this issue Aug 11, 2020
Support is optional, therefore init/conf files will be prepared
for packagers while building but not installed.

Closes medusalix#102
kapsh added a commit to kapsh/xow that referenced this issue Aug 12, 2020
Support is optional, therefore init/conf files will be prepared
for packagers while building but not installed.

Closes medusalix#102
@kapsh
Copy link

kapsh commented Aug 12, 2020

Managed to automate restarts by using supervise-daemon instead of start-stop-daemon (current openrc default), works for me after suspend.

kapsh added a commit to kapsh/xow that referenced this issue Jan 6, 2021
Support is optional, therefore init/conf files will be prepared
for packagers while building but not installed.

Closes medusalix#102

Signed-off-by: Alexander Kapshuna <[email protected]>
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

Successfully merging a pull request may close this issue.

5 participants