unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74534: [shepherd] guix-home managed shepherd shares process group with shell
@ 2024-11-25 18:42 Jelle Licht
  2024-11-25 18:52 ` Jelle Licht
  0 siblings, 1 reply; 4+ messages in thread
From: Jelle Licht @ 2024-11-25 18:42 UTC (permalink / raw)
  To: 74534; +Cc: Tomas Volf, Ludovic Courtès


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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#74534: [shepherd] guix-home managed shepherd shares process group with shell
  2024-11-25 18:42 bug#74534: [shepherd] guix-home managed shepherd shares process group with shell Jelle Licht
@ 2024-11-25 18:52 ` Jelle Licht
  2024-11-25 20:26   ` Tomas Volf
  0 siblings, 1 reply; 4+ messages in thread
From: Jelle Licht @ 2024-11-25 18:52 UTC (permalink / raw)
  To: 74534; +Cc: Tomas Volf, Ludovic Courtès


Jelle Licht <jlicht@fsfe.org> writes:

> 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#74534: [shepherd] guix-home managed shepherd shares process group with shell
  2024-11-25 18:52 ` Jelle Licht
@ 2024-11-25 20:26   ` Tomas Volf
  2024-11-28  7:48     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Tomas Volf @ 2024-11-25 20:26 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 74534, Ludovic Courtès

[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]


Hello,

thank you for CC-ing me.

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.

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:

--8<---------------cut here---------------start------------->8---
     ;; 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))))
--8<---------------cut here---------------end--------------->8---

Have a nice day,
Tomas

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#74534: [shepherd] guix-home managed shepherd shares process group with shell
  2024-11-25 20:26   ` Tomas Volf
@ 2024-11-28  7:48     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2024-11-28  7:48 UTC (permalink / raw)
  To: Tomas Volf; +Cc: 74534-done, Jelle Licht

Hello!

Tomas Volf <~@wolfsden.cz> skribis:

> 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.

> 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’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-28  7:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25 18:42 bug#74534: [shepherd] guix-home managed shepherd shares process group with shell Jelle Licht
2024-11-25 18:52 ` Jelle Licht
2024-11-25 20:26   ` Tomas Volf
2024-11-28  7:48     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).