-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
runit-void: add alternatives to runit-void to facilitate fast init switching #29115
Conversation
In my opinion this would be most cleanly solved by xbps-alternatives. But if void-linux/xbps#185 (xbps can't replace a real file with a symlink) is still a problem and no work is being done to solve it, then we're stuck with virtual packages. That said, I'm interested to try this out. |
Looks like this works (tested on a fakeroot for now):
the files are being replaced by symlinks correctly. |
Also, a virtual package approach would remove the other init's |
@mobinmob might be intrested |
Thanks @teldra! |
This is the wrong solution to a problem I'm not even sure exists. Almost everything in About the only bits which might apply to alternatives to runit are Replacing runit with an alternative is a fine thing to do, but I don't think Void has the resources to provide any official support for swappable service management and init systems. Alternatives and virtual packages each cause problems that we probably don't want. To go down the path of runit altneratives, |
@st3r4g I hadn't gone with the alternatives route for a couple of reasons but it is definitely the cleaner approach. First, someone (it might have even been you) had mentioned in IRC that xbps-alternatives was buggy and so I didn't want to put something as critical as startup and shutdown on that. The second is that I don't know at what point alternatives become available in the life of a new system and I didn't want to break off the extra work to guarantee that /sbin/init was available on bootstrap and otherwise very minimal systems at every point in the lifecycle. I'd assumed that was the reason that runit-init was explicitly symlinked to init in the first place. As for poweroff that's a very good point. I'm thinking that a hybrid approach might make the most sense: alternatives for halt, poweroff, reboot, and shutdown, and an explicit link for init. That way system boot will continue to work using the plumbing as it exists but everything else takes the more flexible route. That would still require there to be a subpackage for init itself which is kind of lame but it would make everything else pretty straight forward. Thoughts? |
Yes it was me. But virtual packages have similar issues too, and are generally avoided when possible. So I understand that committers would not want to take responsibilities for this.
The symlink should be there as soon as it is installed, so I don't see the issue here... but maybe I'm missing something. As a start it would be good to do what ahesford said and move away from |
I've got a half written reply to aheford vis-a-vis moving away from runit-void but the gist of is that I agree but didn't want to break that work off as part of this, at least not as part of the initial PR. As for the symlink presence, the concern is really about the guarantees around when alternatives symlinks are present. The dependency graph guarantees that packages, and by extension binaries, will be present but I don't know if alternatives provide those same guarantees in all circumstances. |
Pretty sure they do. The alternative is registered (and the symlink created) in the unpack phase, right after package files are unpacked: |
@ahesford, thanks for the reply. From a high-level standpoint a decent chunk of void-runit seems generic enough to be reused, only Something that I've been trying hard to avoid is accidentally making a fork of the distribution. I know that there are other people using Void as a baseline for various supervision-based init alternatives and it's a management and maintenance overhead for each person to backport upstream changes into their bespoke derivatives. My goal with this PR (in whatever form it finally ends up taking) is to add just enough flexibility into the core distribution to facilitate letting people do these experiments and system drifts without having to fork or hold core parts of the distribution. That isn't to say it'll work perfectly without a shim, but managing a compatibility shim is a lot easier when you aren't fighting the package manager. Also, I'm not advocating that Void take on any support burden for people using these knobs, just just there isn't an expectation of support if someone uses alternatives to switch in a magical rust implementation of awk, and in making these knobs I've been trying to make sure to not add additional management overhead for the distro maintainers or the core system. If there's a place with the documented pitfalls of alternatives and virtual packages that would be great. I did just find void-linux/xbps#318 which seems mildly terrifying but I am definitely interested in seeing what else there is. At the end of the day I'd like to get this merged, but I'd like to get it merged in the best format I can, and one that impacts the core Void maintainers the least. |
c442d0a
to
82505de
Compare
Updated to use an alternatives-based approach since that seems generally less disastrous at least in local testing. It's got some gotchas that I'm still working through, though I think most of those are fixable at the xlint and documentation level. |
I think this is a useful feature in general, and while I'm not in support of maintaining multiple init systems as is, it will allow experimentation with s6-based systems more easily, and may provide a path forward for Void in this way. |
maybe it would be better to rename |
I considered namespacing the commands with the general init scheme name as a prefix (runit-shutdown, runit-halt, etc) originally for the same reason you suggested but decided that using the package name as a suffix was probably more user friendly. This way people can type shut to get all in-path shutdown providers (for example). It also means that there won't be a name collision in the future if runit-void picks up an "init" executable in the future. The other possibility I saw was to use the full package name as the identifier but |
yeah, I actually like it more as a suffix. Also, s6-{init,poweroff,...} would be bad because it would give the impression that they are actual members of the s6 suite. I wonder if we can rename runit-init to init-runit to fix this little inconsistency. Or maybe just leave as it is, since init is not even executed manually. |
I'd leave it as is. |
So, I gave this a try and didn't encounter any xbps-alternative bugs. However there is an issue when trying to shutdown with runit after switching the alternative to s6, because
|
Fixing the first is easy, the second will most likely involve patching the source to accept additional command names. I want to think on it a bit before making that change though since I'm not particularly keen on adding a patch and I'm hoping inspiration strikes. |
82505de
to
d65904b
Compare
I was hoping this could all be done in the template but it looks like no. This pull request now depends on void-linux/void-runit#70 Once that merges I'll update the template here with the new release version of void-runit. |
Trying again with void-runit master and it looks pretty nice. The issues above are solved.
Installing it will add an alternative for
To boot into s6:
And to boot back to runit:
In case init breaks, |
Thanks for the independent check @st3r4g! |
d65904b
to
726d00c
Compare
I'm updating the PR with the assumption that void-runit will be tagged with today's date. Hence the giant failure. |
d762d08
to
429852e
Compare
429852e
to
ebfd01c
Compare
Updated to not conflict with the recent 20210314 release version. |
Pinging on merge or NAK of this PR. Locally everything works as expected without any alternatives messes or what have you: Before installing 20210314_2:
After installing 20210314_2:
Since there aren't any other packages currently providing alternatives for halt, init, poweroff, reboot, or shutdown, the problems noted in xbps#185, xbps#253, or void-packages#15836 are not blocking issues. |
ebfd01c
to
cd3b1fd
Compare
My 2 cents:
|
I'd argue that alternatives is the only mechanism that allows for safe replacement of the shutdown handlers while still leaving a recovery path if something goes wrong. Specifically in the case of runit-void vs s6-linux-init, the runit-void
I'm inclined to agree with the dislike of having more than one init but short of a hefty realignment of package contents there is a problem with that solution and that perspective. Specifically, runit (the suite) is two things: a process supervisor and half an init system (primarily pid 1). Similarly, runit-void is all of the low-level initialization policy mechanisms for Void and half of an init system (primarily the shutdown part). The initial form of this PR separated the runit-void shutdown programs into a subpackage but as @st3r4g mentioned that breaks the rollback guarantee of having the official binaries present in some form, as well as forcing users to use the Regardless of what handles system lifecycle duties replacing the runit package isn't an option. First, it doesn't solve the halt, poweroff, reboot, or shutdown name collisions. But more importantly there are several packages with runtime dependencies on |
The runit-void package handles multiple duties. Th first is being the base system configuration for all mainline void linux installs. The second is handling the population of ownership of the init and power controls (/usr/bin/halt, /usr/bin/shutdown, and the init, poweroff, and reboot symlinks). Since those commands are required to manage a system, anybody who wants to experiment with an alternate init scheme needs to do one of: put their init control elsewhere, hold runit-void, or clean up after any reloads of runit-void. This change adds the suffix `-runit` to shutdown, halt, poweroff, and reboot and then registers shutdown, halt, poweroff, reboot, and init names with alternatives under the void-init group. This will allow other inits to take over for runit-void in a non-destructive fashion and allows for easy rollbacks even in the face of disaster. Thanks to st3r4g for pointing me towards xbps-alternatives instead of using a virtual package to handle the ownership flip-flop. It is a much cleaner method with significantly more straightforward semantics, though not without its pitfalls.
cd3b1fd
to
92536db
Compare
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it. |
The runit-void package handles multiple duties. Th first is being the
base system configuration for all mainline void linux installs. The
second is handling the population of ownership of the init and power
controls (/usr/bin/halt, /usr/bin/shutdown, and the init, poweroff, and
reboot symlinks). Since those commands are required to manage a system,
anybody who wants to experiment with an alternate init scheme needs to
either put their init control elsewhere or clean up after any reloads of
runit-void.
The structure here is to split the commands required to start or stop a
system away from the configuration and services that make up the core of
Void. Core functionality continues to be provided by runit-void but it
is adjusted to depend on a virutal package called "void-init" for the
init and power commands. In mainline Void systems "void-init" is
provided by runit-void-init, a subpackage built alongside runit-void,
however this change allows any package to provide that functionality
without breaking the core distribution configuration.
From a package management perspective runit-void-init provides void-init
and replaces void-init. This allows for a single-pass replacement of any
other void-init providers simply by installing runit-void-init.
Similarly, an alternative init package can be installed in a single pass
via the same mechanisms without explicitly defining all packages that it
needs to override.
General
Have the results of the proposed changes been tested?
It's technically a new package but mostly a rearrangement of functionality to allow for better experimentation.