Subject: bug#78356: Broken system and home containers

From: Rutherther <[email-masked]>
Date: Sat, 10 May 2025 18:09:24 +0200

Seems that the recent commit 'Lock mounts by default'
a57ed987ffd1452ba5a4d70feb54893e99b8e076 has broken both guix system
container and guix home container. For system container, the system
container command finishes fine, but then running the run-container
script fails. For home container the command itself errors out, since
it's what is starting the container as well.

Here are the backtraces:
guix system:
```
Backtrace:
           7 (primitive-load "/gnu/store/p3m2srwhv49gv1lk2yi4i73b9mn…")
In gnu/build/linux-container.scm:
    368:8  6 (call-with-temporary-directory #<procedure 7f02cddd1af0…>)
   476:16  5 (_ "/tmp/guix-directory.DGavex")
     62:6  4 (call-with-clean-exit #<procedure 7f02ce52ab80 at gnu/b…>)
   323:22  3 (_)
    215:2  2 (initialize-user-namespace 1 65536 #:host-uid _ # _ # _ …)
In ice-9/ports.scm:
    435:6  1 (call-with-output-file _ _ #:binary _ #:encoding _)
In unknown file:
           0 (close-port #<output: /proc/1/uid_map 6>)

ERROR: In procedure close-port:
In procedure fport_write: Operation not permitted
system container is running as PID #f
Run 'sudo guix container exec #f /run/current-system/profile/bin/bash --login'
or run 'sudo nsenter -a -t #f' to get a shell into it.

Backtrace:
           3 (primitive-load "/gnu/store/p3m2srwhv49gv1lk2yi4i73b9mn…")
In gnu/build/linux-container.scm:
    368:8  2 (call-with-temporary-directory #<procedure 7f02cddd1af0…>)
    485:7  1 (_ "/tmp/guix-directory.DGavex")
In unknown file:
           0 (waitpid #f #<undefined>)
```

guix home:
```
Backtrace:
In ice-9/boot-9.scm:
  1752:10 14 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
          13 (apply-smob/0 #<thunk 7fe026e942a0>)
In ice-9/boot-9.scm:
    724:2 12 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
In ice-9/eval.scm:
    619:8 11 (_ #(#(#<directory (guile-user) 7fe026e99c80>)))
In ice-9/command-line.scm:
   185:19 10 (_ #<input: string 7fe026e93850>)
In unknown file:
           9 (eval (begin (use-modules (guix build utils) (# ?)) # ?) ?)
In ice-9/eval.scm:
    619:8  8 (_ #f)
In unknown file:
           7 (primitive-load "/gnu/store/9kr07956x74cs9cql5jj3kdvb7f?")
In ice-9/eval.scm:
    619:8  6 (_ #(#(#(#(#(#(#(#(#(#(#<?> ?) ?) ?) ?) ?) ?) ?) ?) ?) ?))
   626:19  5 (_ #(#(#(#(#(#(#(#(#(#(#<?> ?) ?) ?) ?) ?) ?) ?) ?) ?) ?))
    619:8  4 (_ #(#(#(#(#(#(#(#(#(#(#<?> ?) ?) ?) ?) ?) ?) ?) ?) ?) ?))
In unknown file:
           3 (primitive-load "/gnu/store/j7v0sgg2grb9x8n6h2xh2cyvyf7?")
In ice-9/eval.scm:
   293:34  2 (_ #(#(#(#(#(#(#<directory (guile-use?> ?) ?) ?) ?) ?) ?))
In ice-9/ports.scm:
   450:11  1 (call-with-input-file _ #<procedure 7fe01d5b3a60 at ic?> ?)
In unknown file:
           0 (open-file #<unspecified> "r" #:encoding #f # #f)

ERROR: In procedure open-file:
Wrong type (expecting string): #<unspecified>
```

Additionally at one moment I was able to get an error message with guix
home that unshare has gotten an invalid argument, the argument was just
a number.

Unfortunately I was not able to understand what the issue is to fix it.

Regards
Rutherther