supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Alexis <flexibeast@gmail.com>
To: supervision <supervision@list.skarnet.org>,
	skaware <skaware@list.skarnet.org>
Subject: s6-rc user services on Gentoo
Date: Tue, 02 Apr 2024 15:42:06 +1100	[thread overview]
Message-ID: <87jzlgnzoh.fsf@gmail.com> (raw)


Hi all,

Laurent has suggested i ask on IRC about this, but since (a) i'm 
in UTC+10, (b) i'm constantly moving between a few different 
networks, and (c) my bouncer is currently out of action (it's a 
Story), i thought i'd ask on these lists instead, to facilitate 
asynchronous replies. :-)

When i was on Void, a few years ago, i used s6+66 in place of 
runit. Since moving to Gentoo, i've been using OpenRC.

OpenRC currently doesn't have user services. They're gradually 
being worked on:

  https://github.com/OpenRC/openrc/pull/573

but the current state of things is that the contributor is 
rewriting the PR:

  https://github.com/OpenRC/openrc/pull/573#issuecomment-2007766162

i've had a lot on my plate for a while, but in more recent times 
i've had a bit more space to faff around with lower-priority 
stuff, and so i'm exploring setting up s6-rc to manage the user 
services i need. Once i've done so, i can:

* write a guide on the Gentoo wiki[a]; and

* provide service definitions for others to use via my personal 
  overlay[b].

which might help more people to become familiar with the s6 
ecosystem in general, and with s6-rc in particular (rather than 
trying to use s6 for service management as well as supervision).

However, i've reached an impasse, and i'm hoping some can tell me 
what i'm missing / what i'm doing wrong / what i'm 
misunderstanding.

Here's the situation:

* 
  S6RC_SERVICE_REPO=${HOME}/src/srht/gentoo-overlay/sys-apps/s6-rc-services/files/

* The above directory contains two service directories:
** dbus-session-bus/, containing:
*** type: longrun
*** notification-fd: 3
*** producer-for: dbus-session-bus-log
*** run:
    #!/usr/bin/execlineb -P
    importas HOME HOME
    redirfd -w 4 ${HOME}/.env.d/DBUS_SESSION_BUS_ADDRESS
    dbus-daemon --session --fork --nopidfile --print-address=4
*** finish:
    #!/usr/bin/execlineb -P
    importas HOME HOME
    rm -f ${HOME}/.env.d/DBUS_SESSION_BUS_ADDRESS
** dbus-session-bus-log/, containing:
*** type: longrun
*** notification-fd: 3
*** consumer-for: dbus-session-bus
*** pipeline-name: dbus-session-bus-pipeline
*** run:
    #!/usr/bin/execlineb -P
    importas HOME HOME
    exec -c
    s6-log -d3 -- t ${HOME}/.logs/s6-rc-services/dbus-session-bus

* SCANDIR="${XDG_DATA_HOME}/s6-rc/services"

* The above directory contains symlinks to

  ${S6RC_SERVICE_REPO}/{dbus-session-bus,dbus-session-bus-log}

* S6RC_COMPILED="${XDG_STATE_HOME}/s6-rc/compiled"

* Running:

  s6-rc-compile "${S6RC_COMPILED}" "${SCANDIR}"

  completes successfully.

* Running

  s6-svscan -- "${SCANDIR}"

  succeeds, with two s6-supervise processes created.

* HOWEVER, running

  s6-rc-init -c "${S6RC_COMPILED}" -l "${XDG_RUNTIME_DIR}/s6-rc" 
  "${SCANDIR}"

  fails, with the error message:

  unable to supervise service directories in 
  /run/user/1000/s6-rc/servicedirs: File exists

i've taken a look at s6rc_livedir_create.c:

  https://git.skarnet.org/cgi-bin/cgit.cgi/s6-rc/tree/src/libs6rc/s6rc_livedir_create.c

but nothing is leaping out to me as explaining what's happening.

Thoughts?


Alexis.

[a] The current s6 and s6-rc pages on the wiki have lot of detail, 
without any "quickstart" tutorials that might make it easy for 
people to get on board. A while ago i did a big restructure of the 
s6 article:

   https://wiki.gentoo.org/wiki/User:Flexibeast/drafts/S6

which i feel improves the current page:

   https://wiki.gentoo.org/wiki/S6

but which has been awaiting review by a more senior wiki editor 
than me.

The s6-rc page is similarly detailed and similarly lacking a 
"quickstart":

   https://wiki.gentoo.org/wiki/S6-rc

[b] Various people are providing s6 service definitions, 
e.g. https://codeberg.org/alecStewart1/gentoo-s6-scripts, but i'm 
not
currently aware of any providing s6-rc service definitions - 
pointers welcome. :-)

             reply	other threads:[~2024-04-02  4:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  4:42 Alexis [this message]
2024-04-02 10:44 ` Hoël Bézier
2024-04-02 23:44   ` Alexis
2024-04-02 20:57 ` Guillermo
2024-04-03  0:12   ` Alexis
2024-04-03 11:37   ` Laurent Bercot
2024-04-06 12:43     ` Guillermo
2024-04-06 13:57       ` Laurent Bercot
2024-04-06 15:57       ` Muhammad Mahendra Subrata
2024-04-06 18:31         ` Laurent Bercot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzlgnzoh.fsf@gmail.com \
    --to=flexibeast@gmail.com \
    --cc=skaware@list.skarnet.org \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).