Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: s6-rc-update does not stop or start services in changed bundle (Read 865 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

s6-rc-update does not stop or start services in changed bundle

I am not sure if I am misunderstanding what s6-rc-update is intended to do.

I have gone through this process a couple times now, and I always must manually stop or start the service. Below is a transcript of removing cupsd from the default bundle, and having to manually stop the service.

I am especially confused by the documentation saying that s6-rc will inspect the difference between the two compiled databases and stop services that are not present in the new compiled database. (Docs excerpted below)

I get similar (lack of) behavior when adding cupsd back to the default bundle. Am I doing something wrong? Or am I just misunderstanding the expectations of s6-rc-update?

Quote
s6-rc-update tries to avoid needlessly restarting services. For instance, running it with a new compiled that is an exact copy of the old compiled should not cause any restarts. s6-rc-update will flag a service to be restarted in the following cases:

    The service has disappeared in the new compiled. In this case, the old service will simply be stopped.
From: https://skarnet.org/software/s6-rc/s6-rc-update.html (under restarts)

The transcript below indicates "stopping services in the old database" and "bringing selected services down"

Code: [Select]
# s6-rc-db contents default | grep cupsd
cupsd
# pgrep cupsd 11756
# rm /etc/s6/adminsv/default/contents.d/cupsd
# s6-rc-compile /etc/s6/rc/compiled-new /etc/s6/adminsv /etc/s6/sv
# s6-rc-update -v3 /etc/s6/rc/compiled-new
s6-rc-update: info: computing state adjustments
s6-rc-update: info: stopping services in the old database
s6-rc: info: bringing selected services down
s6-rc-update: info: updating state and service directories
s6-rc-update: info: successfully switched to new database
s6-rc-update: info: updating s6rc-fdholder pipe storage
s6-rc-update: info: cleaning up scan directory
s6-rc-update: info: starting services in the new database
s6-rc: info: bringing selected services up
# s6-rc-db contents default | grep cupsd
# pgrep cupsd
11756
# s6-rc stop  cupsd

Re: s6-rc-update does not stop or start services in changed bundle

Reply #1
It would probably be best to ask upstream for clarification on this. In my experience, s6-rc-update will restart services if it thinks it needs to (e.g. adding a dependency or something to a running service), but I can't recall it ever stopping a service simply because it was no longer in a bundle.

Re: s6-rc-update does not stop or start services in changed bundle

Reply #2
Went to OFTC #s6 and got some clarification. I intend to make a patch for s6 docs roughly outlining the following. I'm happy to add to the Artix wiki, too, so will look at making edits there (it's outdated with regard to bundle maintenance).

s6-rc-update will stop services whose definitions no longer exist, but does not make changes based on bundle updates. Thus, within the Artix setup, for a service to be automatically stopped, you'd remove it from the bundle (necessary to keep the resultant db consistent) *and also* remove the service directory from /etc/s6/sv. This second bit is not reasonable, because Artix expects to own sv/.

Thus, the restart and auto-stop logic in s6-rc-update is not enough to automatically stop a service removed from a bundle. Instead, we must invoke the s6-rc state machine to make the changes. This is very simple, assuming a fairly standard Artix setup: the default bundle is used by init and is the root of the dependency graph. Assuming users either make bundles that are included in default or directly edit default, then the following is sufficient to make the final state reflect the newly updated rc db:

Code: [Select]
# <changes reflected in default...>
# s6-rc-compile /etc/s6/rc/<new-db> /etc/s6/adminsv /etc/s6/sv
# s6-rc-update /etc/s6/rc/<new-db>
# s6-rc -p change default

Re: s6-rc-update does not stop or start services in changed bundle

Reply #3
Is there anything dated besides the whole bit about s6-rc-bundle-update? That's very old legacy stuff that was removed ages ago. I can just delete that paragraph on the wiki.

Edit: and removed it.

Re: s6-rc-update does not stop or start services in changed bundle

Reply #4
That was the primary section I was thinking of.