[shepherd] guix-home managed shepherd shares process group with shell

  • Done
  • quality assurance status badge
Details
3 participants
  • Jelle Licht
  • Ludovic Courtès
  • Tomas Volf
Owner
unassigned
Submitted by
Jelle Licht
Severity
normal

Debbugs page

Jelle Licht wrote 4 months ago
(address . bug-guix@gnu.org)
874j3vi28g.fsf@fsfe.org
Cc'ing Tomas and Ludo, as they actually diagnosed the issue [0].

The user shepherd, as configured using guix home, runs under the same
process group as the shell that initially triggered guix home's
"$HOME/.guix-home/on-first-login" script.

This leads to the user shepherd receiving signals that are sent to the
shell, such as a SIGINT/^C, and subsequently stopping entirely.

If I understand the fine folks on IRC correctly, the daemonize action of
the root-service in shepherd is missing a call to (setsid). I am
uncertain whether this setsid call should be made conditional or not.

Kind regards,
Jelle Licht

Jelle Licht wrote 4 months ago
(address . 74534@debbugs.gnu.org)
871pyzi1so.fsf@fsfe.org
Jelle Licht <jlicht@fsfe.org> writes:

Toggle quote (18 lines)
> Cc'ing Tomas and Ludo, as they actually diagnosed the issue [0].
>
> The user shepherd, as configured using guix home, runs under the same
> process group as the shell that initially triggered guix home's
> "$HOME/.guix-home/on-first-login" script.
>
> This leads to the user shepherd receiving signals that are sent to the
> shell, such as a SIGINT/^C, and subsequently stopping entirely.
>
> If I understand the fine folks on IRC correctly, the daemonize action of
> the root-service in shepherd is missing a call to (setsid). I am
> uncertain whether this setsid call should be made conditional or not.
>
> Kind regards,
> Jelle Licht
>
> [0]: https://logs.guix.gnu.org/guix/2024-11-25.log#172506

Addendum:
running `herd eval root "(setsid)"` solves my particular issue, making
^C on my shell no longer kill my user shepherd.

- Jelle
Tomas Volf wrote 4 months ago
(name . Jelle Licht)(address . jlicht@fsfe.org)
87v7wbcb59.fsf@wolfsden.cz
Hello,

thank you for CC-ing me.

Jelle Licht <jlicht@fsfe.org> writes:

Toggle quote (4 lines)
> Addendum:
> running `herd eval root "(setsid)"` solves my particular issue, making
> ^C on my shell no longer kill my user shepherd.

Oh, that is neat. I did not realize this can be fixed like that without
modifying shepherd's source code. I turned it into a service that I
added into my home-environment:

Toggle snippet (10 lines)
;; Bug 74534: Home shepherd can be killed by ^C
(simple-service 'call-setsid-in-home-shepherd home-shepherd-service-type
(list
(shepherd-service
(documentation "Give shepherd its own process group.")
(provision '(setsid))
(start #~(lambda _ (setsid) #t))
(one-shot? #t))))

Have a nice day,
Tomas

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
-----BEGIN PGP SIGNATURE-----

iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmdE3ZIOHH5Ad29sZnNk
ZW4uY3oACgkQL7/ufbZ/wakHoA//ZtZ3FwEGwks1dTcez0yyYLOuMFh8f3MQUTuf
XM4cEg5Dt44wB2dumSD3CKFRDNk4JBuq8h1Ay53M1bGhSrxzPgr444SsswLXMbr3
gXeAxxy7vXGjh6H0eai5dkObcPJW7lDKnbWdK4unQHnr1g5WwAwWEAZNTB45RRyj
zSjwdC/gG55pVIu8c6fXAHmSDvV9kdcoHIF4IfgX50rAkU0N6WVeAqdda2tboLKb
wHoqNiZxJRbNJAyrRf/JVrWHFgTXQc9pcX76n3xU6t/bEFPQZbhF9mdjoV2F06aP
JVXCV0RXjfa5NWY15B59bAG1Danm0ru2Di4K1Qlgpnx2AXZsA8X1/fBwxfNpUAq8
CamozkoQ4Qxsf9eNSEsV9ZmA1yviyqGIwsFFo75sEngVF0IVOVYeuTs8Kepjouv5
Z6CCGBIumgRaxMyKgM3TMEXSdOi+FxCIhWrAfw/WaSeTxItuKEHzzhPs04afUNzv
lrH2V4js6NVoq6LIV2RIBlnbglaRygc7bjm6bf4KHJP5fhKolZlcmPi6w2sd9704
YE4FtnvsPdJYPLubUB7LAYfW5qtOU8+OA6gmO12CFc8osskSqxbdFoVnijR1RAZf
3TtwiOwsw2GZm8hVN1LVoXRaEgcOj7UgyttTC/f0cNt9yl3CX7Kzhr0PjJwzPpP1
69f3mio=
=tWsi
-----END PGP SIGNATURE-----

Ludovic Courtès wrote 3 months ago
(name . Tomas Volf)(address . ~@wolfsden.cz)
87ed2v94tp.fsf@gnu.org
Hello!

Tomas Volf <~@wolfsden.cz> skribis:

Toggle quote (6 lines)
> Jelle Licht <jlicht@fsfe.org> writes:
>
>> Addendum:
>> running `herd eval root "(setsid)"` solves my particular issue, making
>> ^C on my shell no longer kill my user shepherd.

Fixed in Shepherd commit 2b41e5bad65e783c7a9cc4d7a3f460cab6b64285.

Toggle quote (13 lines)
> Oh, that is neat. I did not realize this can be fixed like that without
> modifying shepherd's source code. I turned it into a service that I
> added into my home-environment:
>
> ;; Bug 74534: Home shepherd can be killed by ^C
> (simple-service 'call-setsid-in-home-shepherd home-shepherd-service-type
> (list
> (shepherd-service
> (documentation "Give shepherd its own process group.")
> (provision '(setsid))
> (start #~(lambda _ (setsid) #t))
> (one-shot? #t))))

Nice workaound.

Thank you, comrades!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 74534@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 74534
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help