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

Previous Next

Package: guix;

Reported by: ingar <at> onionmail.info

Date: Fri, 14 Feb 2025 09:59:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: ingar <at> onionmail.info, 76282 <at> debbugs.gnu.org
Subject: bug#76282: Signal handling (like SIGINT) and guix shell --container: PID 1
Date: Sun, 01 Jun 2025 23:34:20 +0200
[Message part 1 (text/plain, inline)]
Hello,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> Your analysis appears correct; the above 'make' runs with PID 3.
>
> --8<---------------cut here---------------start------------->8---
> maxim <at> terra ~/src/forgejo$ guix shell -CNF -m manifest.scm -- env GOPATH=/tmp TAGS="bindata timetzdata sqlite sqlite_unlock_notify" make build
> go: downloading go1.24.3 (linux/amd64)
> ^Cgo: downloading go1.24.3 (linux/amd64)
> ^Cgo: downloading go1.24.3 (linux/amd64)
> ^Cgo: downloading go1.24.3 (linux/amd64)
> ^Cgo: downloading go1.24.3 (linux/amd64)
> ^CForgejo requires Go 1.24 or greater to build. You can get it at https://go.dev/dl/
> make: *** [Makefile:297: go-check] Error 1
> ^C^C^C^C^C^C^C^C^C
> # doesn't abort, need kill -9 $pid
> --8<---------------cut here---------------end--------------->8---
>
> This doesn't handle signals as expected because it runs as PID 1.  I
> agree this needs be documented or better, handled with --init ala
> docker.

I didn’t follow closely but how about this:

[Message part 2 (text/x-patch, inline)]
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?
[Message part 3 (text/plain, inline)]
Thanks,
Ludo’.

This bug report was last modified 13 days ago.

Previous Next


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