GNU bug report logs - #74534
[shepherd] guix-home managed shepherd shares process group with shell

Previous Next

Package: guix;

Reported by: Jelle Licht <jlicht <at> fsfe.org>

Date: Mon, 25 Nov 2024 18:44:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74534 in the body.
You can then email your comments to 74534 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#74534; Package guix. (Mon, 25 Nov 2024 18:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jelle Licht <jlicht <at> fsfe.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 25 Nov 2024 18:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jelle Licht <jlicht <at> fsfe.org>
To: bug-guix <at> gnu.org
Cc: Tomas Volf <~@wolfsden.cz>,
 Ludovic Courtès <ludovic.courtes <at> inria.fr>
Subject: [shepherd] guix-home managed shepherd shares process group with shell
Date: Mon, 25 Nov 2024 19:42:55 +0100
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




Information forwarded to bug-guix <at> gnu.org:
bug#74534; Package guix. (Mon, 25 Nov 2024 18:53:02 GMT) Full text and rfc822 format available.

Message #8 received at 74534 <at> debbugs.gnu.org (full text, mbox):

From: Jelle Licht <jlicht <at> fsfe.org>
To: 74534 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>,
 Ludovic Courtès <ludovic.courtes <at> inria.fr>
Subject: Re: bug#74534: [shepherd] guix-home managed shepherd shares process
 group with shell
Date: Mon, 25 Nov 2024 19:52:23 +0100
Jelle Licht <jlicht <at> 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




Information forwarded to bug-guix <at> gnu.org:
bug#74534; Package guix. (Mon, 25 Nov 2024 20:28:02 GMT) Full text and rfc822 format available.

Message #11 received at 74534 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: Jelle Licht <jlicht <at> fsfe.org>
Cc: 74534 <at> debbugs.gnu.org,
 Ludovic Courtès <ludovic.courtes <at> inria.fr>
Subject: Re: bug#74534: [shepherd] guix-home managed shepherd shares process
 group with shell
Date: Mon, 25 Nov 2024 21:26:58 +0100
[Message part 1 (text/plain, inline)]
Hello,

thank you for CC-ing me.

Jelle Licht <jlicht <at> 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.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 28 Nov 2024 07:50:05 GMT) Full text and rfc822 format available.

Notification sent to Jelle Licht <jlicht <at> fsfe.org>:
bug acknowledged by developer. (Thu, 28 Nov 2024 07:50:06 GMT) Full text and rfc822 format available.

Message #16 received at 74534-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tomas Volf <~@wolfsden.cz>
Cc: 74534-done <at> debbugs.gnu.org, Jelle Licht <jlicht <at> fsfe.org>
Subject: Re: bug#74534: [shepherd] guix-home managed shepherd shares process
 group with shell
Date: Thu, 28 Nov 2024 08:48:34 +0100
Hello!

Tomas Volf <~@wolfsden.cz> skribis:

> Jelle Licht <jlicht <at> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 26 Dec 2024 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 173 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.