runInLinuxVM: Ensure tools requiring /etc/passwd work
This includes, but is not limited to: * whoami * nix >= 2.3.1 See * https://github.com/NixOS/nixpkgs/issues/71157 * https://github.com/NixOS/nixops/issues/1216 * https://github.com/nix-community/nixops-libvirtd/issues/5
This commit is contained in:
parent
e2b4abe3c8
commit
687e2195d8
@ -126,6 +126,10 @@ rec {
|
||||
mkdir -p /fs/etc
|
||||
ln -sf /proc/mounts /fs/etc/mtab
|
||||
echo "127.0.0.1 localhost" > /fs/etc/hosts
|
||||
# Ensures tools requiring /etc/passwd will work (e.g. nix)
|
||||
if [ ! -e /fs/etc/passwd ]; then
|
||||
echo "root:x:0:0:System administrator:/root:/bin/sh" > /fs/etc/passwd
|
||||
fi
|
||||
|
||||
echo "starting stage 2 ($command)"
|
||||
exec switch_root /fs $command $out
|
||||
|
Loading…
Reference in New Issue
Block a user