Skip to content

Commit

Permalink
nixos-enter: inherit parent PID namespace
Browse files Browse the repository at this point in the history
Removes the creation of a new PID namespace during nixos-enter so that
systemd doesn't detect the child process as being in a "container". In
systemd v257, container detection slightly changed to check if the
process is a part of the root PID namespace (see https://github.com/systemd/systemd/blob/96c4d9d94d06c6c0a8b68be376505f8d8b5eba2b/src/basic/virt.c#L735).
Tooling such as `bootctl` will not perform certain actions if it detects
we are in a container, such as not populating EFI variables. This
results in broken systemd-boot VM tests.
  • Loading branch information
jmbaur committed Dec 17, 2024
1 parent ba2e1bc commit 44853a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkgs/by-name/ni/nixos-enter/nixos-enter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ -z "$NIXOS_ENTER_REEXEC" ]; then
if [ "$(id -u)" != 0 ]; then
extraFlags="-r"
fi
exec unshare --fork --mount --uts --mount-proc --pid $extraFlags -- "$0" "$@"
exec unshare --fork --mount --uts --mount-proc $extraFlags -- "$0" "$@"
else
mount --make-rprivate /
fi
Expand Down

0 comments on commit 44853a3

Please sign in to comment.