#924132 runit: Add support for runit in init-system-helpers

#924132#5
Date:
2019-03-09 20:05:57 UTC
From:
To:
Hi,

this is for buster +1

Here is my proposal for adding runit-init support in
'init-system-helpers'; please do not reassign to init-system-helpers
as this need also some changes in runit and dh-runit to work properly.
This is still a work in progress but it's enough to do some testing:

 * for init-system-helpers look here
https://salsa.debian.org/Lorenzo.ru.g-guest/init-system-helpers

 * for runit look here
https://salsa.debian.org/Lorenzo.ru.g-guest/runit/tree/runsvchd+helpers
    (this include also commits for #916973 and for #924038)

For more details and (hopefully) a discussion look here
https://www.freelists.org/post/debian-runit/Runitinit-support-in-initsystemhelpers

Thanks,
Lorenzo

#924132#10
Date:
2019-03-11 18:12:10 UTC
From:
To:
[2019-03-09 21:05] Lorenzo Puliti <lorenzo.ru.g@gmail.com>

Thank you for your work. It will take me some time to understand your
proposal, see code and think about it.

#924132#15
Date:
2019-05-21 15:38:09 UTC
From:
To:
Dear init-system-helpers Maintainers,

 here are a series of 5 commits that add support for runit-init into
 'update-rc.d', 'invoke-rc.d' and 'service' scripts.

https://salsa.debian.org/Lorenzo.ru.g-guest/init-system-helpers/commits/runit

 This has been already reviewed by Dmitry Bogatov.
 If you don't have further question or requirements, can you upload to experimental
 and then, after Buster release, to unstable?

 Thanks,
 Lorenzo

#924132#24
Date:
2019-05-24 17:59:16 UTC
From:
To:
Hi Lorenz

Could you post the patches as a salsa MR? It would make for easier review.


Saludos

#924132#29
Date:
2019-05-25 19:01:02 UTC
From:
To:
Sure, here is the link

https://salsa.debian.org/debian/init-system-helpers/merge_requests/10

Thanks

Il giorno ven 24 mag 2019 alle ore 19:59 Felipe Sateler <fsateler@gmail.com>
ha scritto:

#924132#34
Date:
2019-05-27 20:09:38 UTC
From:
To:
Thanks!

I'll take a look as soon as possible.

#924132#59
Date:
2020-03-17 01:54:35 UTC
From:
To:
Control: affects -1 + runit-init

Hi,
I'm now maintaining runit:
is there any update on the progress of this bug?
If you don't have time to spend on this, would be ok
if I ask another DD for an NMU?

Thanks
Lorenzo

#924132#64
Date:
2020-03-17 12:33:33 UTC
From:
To:

#924132#71
Date:
2021-04-07 16:04:06 UTC
From:
To:
Hi again,

This bug report is stuck since a long time and also the discussion on
salsa MR ended without reply nor upload on your side.
Now it's likely that I have to support also a catch-all package for
runit services in addition to the standard dh-runit code, but the idea
of runit relying on update-rc.d/invoke-rc.d code that would work for
that case has already been discarded..

Overall I think that the best way to go forward is that I divert
helpers with runit-init (as openrc and file-rc did in the past) so that
I can experiment and find a working solution for runit users without
generating bug on this package.
We can always merge runit support later if we find a solution that
works for both sides.

Let me know if you disagree, but in that case please make sure you have
the time to join the discussion untill we find a solution.

Regards,
Lorenzo

#924132#76
Date:
2024-05-04 12:03:46 UTC
From:
To:
Dear Maintainer,

Kindly ask if is there any progress of this bug. It will be very grateful for
adding support of runit in init-system-helpers as it will make use runit as
system init a bit easier.

I just start to use runit, so please correct me if I am wrong. Honestly it
seems to me that runit's support for sysvinit is poor, making use runit as
system init hard. Yes, runit-init will start scripts under /etc/rc2.d/ for me
as done in /etc/runit/2 during boot. But after boot completes, sv status/up/down
is not working for scripts under /etc/init.d/. Maybe it is better to solve this
by improving support for sysvinit in runit. But if this can be easily done in
init-system-helpers, it may still be a choice. And doing this in
init-system-helpers
has a benefit that have a consistent interface between different init. When I
used systemd as init, I still was used to use `service start/stop' to manage
system daemons. It will be thankful to still use that when use runit as init.

So really please consider adding support for runit in this package.

Regarding to the merge requests by Lorenzo Puliti[1], I have applied it into
and rebuild the init-system-helpers package. It helps me immediately. Although
maybe more polish(or update) is still needed. The first one is that the patch
only consider service under /etc/sv/. Under /etc/service/, I see there are
symlinks to not only /etc/sv/*, but also /usr/share/runit/sv.current/*.
/usr/share/runit/sv.current/* is provided by the runit-services
package and may also
be treated. Another one is `service --status-all' now only shows runit services.
It will better to show both runit services and sysvinit services. This
may be done
by the following changes:
--- a/script/service
+++ b/script/service
@@ -79,6 +87,26 @@
               functions | halt | killall | single| linuxconf| kudzu)
                   ;;
               *)
+                if [ -n "$is_runit" ]; then
+                   runit_service=
+                   if [ -d "/etc/sv/${SERVICE}" ]; then
+                     runit_service="/etc/sv/${SERVICE}"
+                   elif [ -d "/usr/share/runit/sv.current/${SERVICE}" ]; then
+                     runit_service="/usr/share/runit/sv.current/${SERVICE}"
+                   fi
+
+                   if [ -n "$runit_service" ]; then
+                     sv status "$runit_service" \
+                       | sed -e 's|run: /etc/sv/| \[ + ] run: |' \
+                             -e 's|down: /etc/sv/| \[ - ] down: |' \
+                             -e 's|fail: /etc/sv/|disabled: |' \
+                             -e 's|run: /usr/share/runit/sv.current/|
\[ + ] run: |' \
+                             -e 's|down:
/usr/share/runit/sv.current/| \[ - ] down: |' \
+                             -e 's|fail:
/usr/share/runit/sv.current/|disabled: |'
+                     continue
+                   fi
+                fi
+
                 if ! is_ignored_file "${SERVICE}" \
             && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
                         out=$(env -i LANG="$LANG"
LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC"
LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY"
LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME"
LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE"
LC_MEASUREMENT="$LC_MEASUREMENT"
LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH"
TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)

instead of the original changes:
--- a/script/service +++ b/script/service @@ -73,6 +80,11 @@ while [ $# -gt 0 ]; do ;; *) if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then + if [ -n "$is_runit" ]; then + exec sv status /etc/sv/* \ + | sed -e 's|run: /etc/sv/|\[ + ] run: |' -e 's|down: /etc/sv/|\[ - ] down: |' -e 's|fail: /etc/sv/|disabled: |' + exit 0 + fi cd ${SERVICEDIR} for SERVICE in * ; do case "${SERVICE}" in I attach the debdiff between my build against 1.66 if it will help. [1]: https://salsa.debian.org/debian/init-system-helpers/merge_requests/10 Regards, Jun Mo
#924132#81
Date:
2024-08-27 23:47:26 UTC
From:
To:
Dear init-system-helpers maintainers,

such support is now done, so I'm attaching an updated patchset:

* no patch is needed for update-rc.d: the rescan need to happen
  between enable and signal to a service; both actions are handled
  by runit-helper, so a rescan in update-rc.d is not useful.

* invoke-rc.d: what is needed is a way to block invoke-rc.d when
  a native runit service is found, so that duplicated and conflicting
  instances are avoided. I've added an override mechanism.

* service: patch updated for new service layout; also --status-all
  is changed so that runscripts status is distinguishable from the
  sysv status (runit currently uses a mix of native and sysv scripts
  so the distinction is useful)

Regards,
Lorenzo

#924132#86
Date:
2024-08-28 00:11:46 UTC
From:
To: