guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 11f772ccdd305842565e1cb5ec9c468193f3fddc
Author: Giacomo Leidi <[email protected]>
AuthorDate: Tue Mar 10 00:44:25 2026 +0100

    services: Do no fork in rootless Podman's one-shot services.
    
    Forking shouldn't be done in one-shot services as this messes up the
    Shepherd's understanding of a process status.
    
    * gnu/services/containers.scm
    (rootless-podman-cgroups-fs-owner-service): Replace
    make-forkexec-constructor with system*.
    (rootless-podman-cgroups-limits-service): Replace
    make-forkexec-constructor with system*.
    (rootless-podman-cgroups-root-fs-service): Replace
    make-forkexec-constructor with system*.
    * gnu/tests/containers.scm (run-rootless-podman-test): Drop 60 seconds
    long timeout and adjust tests.
    
    Change-Id: I08fe96a8dc8fd7f4cdaa2b52b0b04293a5d30272
---
 gnu/services/containers.scm | 27 +++++++-------
 gnu/tests/containers.scm    | 90 +++++++++++++++++++--------------------------
 2 files changed, 52 insertions(+), 65 deletions(-)

diff --git a/gnu/services/containers.scm b/gnu/services/containers.scm
index 494b5824959..951bb70ec40 100644
--- a/gnu/services/containers.scm
+++ b/gnu/services/containers.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2024, 2025 Giacomo Leidi <[email protected]>
+;;; Copyright © 2024-2026 Giacomo Leidi <[email protected]>
 ;;; Copyright © 2025 Owen T. Heisler <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -290,11 +290,11 @@ available for each configured user."))
                     (documentation
                      "Set ownership of /sys/fs/cgroup to the configured 
group.")
                     (start
-                     #~(make-forkexec-constructor
-                        (list
-                         #$(cgroups-fs-owner-entrypoint config))))
+                     #~(lambda ()
+                         (zero?
+                          (system* #$(cgroups-fs-owner-entrypoint config)))))
                     (stop
-                     #~(make-kill-destructor))))
+                     #~(const #f))))
 
 (define cgroups-limits-entrypoint
   (program-file "cgroups2-limits-entrypoint"
@@ -319,11 +319,11 @@ available for each configured user."))
                      "Allow setting cgroups limits: cpu, cpuset, io, memory and
 pids.")
                     (start
-                     #~(make-forkexec-constructor
-                        (list
-                         #$cgroups-limits-entrypoint)))
+                     #~(lambda ()
+                         (zero?
+                          (system* #$cgroups-limits-entrypoint))))
                     (stop
-                     #~(make-kill-destructor))))
+                     #~(const #f))))
 
 (define rootless-podman-shared-root-fs-entrypoint
   (program-file "rootless-podman-shared-root-fs-entrypoint"
@@ -339,11 +339,12 @@ pids.")
                      "Buildah/Podman running as rootless expects the bind mount
 to be shared.  This service sets it so.")
                     (start
-                     #~(make-forkexec-constructor
-                        (list
-                         #$rootless-podman-shared-root-fs-entrypoint)))
+                     #~(lambda ()
+                         (zero?
+                          (system*
+                           #$rootless-podman-shared-root-fs-entrypoint))))
                     (stop
-                     #~(make-kill-destructor))))
+                     #~(const #f))))
 
 (define (rootless-podman-shepherd-services config)
   (list
diff --git a/gnu/tests/containers.scm b/gnu/tests/containers.scm
index 6b7dd7f355f..dbf80b20140 100644
--- a/gnu/tests/containers.scm
+++ b/gnu/tests/containers.scm
@@ -149,58 +149,44 @@
            marionette)
 
           (test-assert "services started successfully and /sys/fs/cgroup has 
correct permissions"
-            (begin
-              (define (run-test)
-                (marionette-eval
-                 `(begin
-                    (use-modules (ice-9 popen)
-                                 (ice-9 match)
-                                 (ice-9 rdelim))
-
-                    (define (read-lines file-or-port)
-                      (define (loop-lines port)
-                        (let loop ((lines '()))
-                          (match (read-line port)
-                            ((? eof-object?)
-                             (reverse lines))
-                            (line
-                             (loop (cons line lines))))))
-
-                      (if (port? file-or-port)
-                          (loop-lines file-or-port)
-                          (call-with-input-file file-or-port
-                            loop-lines)))
-
-                    (define slurp
-                      (lambda args
-                        (let* ((port (apply open-pipe* OPEN_READ args))
-                               (output (read-lines port))
-                               (status (close-pipe port)))
-                          output)))
-                    (let* ((bash
-                            (string-append #$bash "/bin/bash"))
-                           (response1
-                            (slurp bash "-c"
-                                   (string-append "ls -la /sys/fs/cgroup | "
-                                                  "grep -E ' \\./?$' | awk '{ 
print $4 }'")))
-                           (response2 (slurp bash "-c"
-                                             (string-append "ls -l 
/sys/fs/cgroup/cgroup"
-                                                            
".{procs,subtree_control,threads} | "
-                                                            "awk '{ print $4 
}' | sort -u"))))
-                      (list (string-join response1 "\n") (string-join 
response2 "\n"))))
-                 marionette))
-              ;; Allow services to come up on slower machines
-              (let loop ((attempts 0))
-                (if (= attempts 60)
-                    (error "Services didn't come up after more than 60 
seconds")
-                    (if (equal? '("cgroup" "cgroup")
-                                (run-test))
-                        #t
-                        (begin
-                          (sleep 1)
-                          (format #t "Services didn't come up yet, retrying 
with attempt ~a~%"
-                                  (+ 1 attempts))
-                          (loop (+ 1 attempts))))))))
+            (marionette-eval
+             `(begin
+                (use-modules (ice-9 popen)
+                             (ice-9 match)
+                             (ice-9 rdelim))
+
+                (define (read-lines file-or-port)
+                  (define (loop-lines port)
+                    (let loop ((lines '()))
+                      (match (read-line port)
+                        ((? eof-object?)
+                         (reverse lines))
+                        (line
+                         (loop (cons line lines))))))
+
+                  (if (port? file-or-port)
+                      (loop-lines file-or-port)
+                      (call-with-input-file file-or-port
+                        loop-lines)))
+
+                (define slurp
+                  (lambda args
+                    (let* ((port (apply open-pipe* OPEN_READ args))
+                           (output (read-lines port))
+                           (status (close-pipe port)))
+                      output)))
+                (let* ((bash
+                        (string-append #$bash "/bin/bash"))
+                       (response1
+                        (slurp bash "-c"
+                               (string-append "ls -la /sys/fs/cgroup | "
+                                              "grep -E ' \\./?$' | awk '{ 
print $4 }'")))
+                       (response2 (slurp bash "-c"
+                                         (string-append "ls -l 
/sys/fs/cgroup/cgroup"
+                                                        
".{procs,subtree_control,threads} | "
+                                                        "awk '{ print $4 }' | 
sort -u"))))
+                  (list (string-join response1 "\n") (string-join response2 
"\n"))))
+             marionette))
 
           (test-equal "/sys/fs/cgroup/cgroup.subtree_control content is sound"
             (list "cpu" "cpuset" "io" "memory" "pids")

Reply via email to