Hi,

Danny Milosavljevic <dan...@friendly-machines.com> writes:

> Since I think I know what causes it that should be easy enough.

I added a simple ‘lsof’ invocation and displayed the list of remaining
processes:

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 8c6563c99d..8b383e3d81 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -351,11 +351,14 @@ (define %root-file-system-shepherd-service
              ;; Return #f if successfully stopped.
              (sync)
 
+             (format #t "processes: ~s~%" (processes))
              (let ((null (%make-void-port "w")))
                ;; Redirect the default output ports.
                (set-current-output-port null)
                (set-current-error-port null)
 
+               (system* #$(file-append (@ (gnu packages lsof) lsof)
+                                       "/bin/lsof"))
                ;; Close /dev/console.
                (for-each close-fdes '(0 1 2))
 
When running:

  ./pre-inst-env guix system vm --no-graphic gnu/system/examples/bare-bones.tmpl

… you can inspect the output.  For this particular OS config,
everything looks good: PID 1 is the only process left and remaining open
files come from itself (‘lsof’ is way too verbose but you can search for
“w REG” in the output: the “FD” column would contain something like
“3w” for a read-write FD and the “TYPE” column would contain “REG” for a
regular file.)

Could you try that with your own OS config?

Note that since ‘user-processes’ does (kill -1 SIGKILL), the culprit
(process holding a read-write file descriptor) is likely going to be
‘shepherd’.

If that’s the case, we could also try this:

  (port-for-each (lambda (port)
    (when (and (not (port-closed? port))
               (file-port? port)
               (string-contains (port-mode port) "w"))
      (pk port))))

>>  (struct-set! (lookup-service 'whatever) 8 new-stop-procedure)
>
> Thanks!
>
> What's the 8? The slot index in the struct?

Yes, for now.

Thanks,
Ludo’.

Reply via email to