Subject: bug#76282: Signal handling (like SIGINT) and guix shell --container: PID 1

From: Tomas Volf <[email-masked]>
Date: Mon, 02 Jun 2025 21:24:17 +0200

Ludovic Courtès <[email-masked]> writes:

> I didn’t follow closely but how about this:
>
> diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
> index 1c2d222c748..43cfffbd9cb 100644
> --- a/guix/scripts/environment.scm
> +++ b/guix/scripts/environment.scm
> @@ -980,6 +980,11 @@ (define* (launch-environment/container #:key command bash user user-mappings
>              ;; Call an additional setup procedure, if provided.
>              (when setup-hook
>                (setup-hook profile)))
> +
> +          ;; Do not run the shell as PID 1 since that prevents proper signal
> +          ;; handling (?).
> +          #:child-is-pid1? #f
> +
>            #:guest-uid uid
>            #:guest-gid gid
>            #:writable-root? writable-root?

Seems to fix the issue for me, nice.

Reviewed-by: Tomas Volf <[email-masked]>

Tomas

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