3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #80680 from samueldr/fix/71157

runInLinuxVM: Ensure tools requiring /etc/passwd work
This commit is contained in:
Samuel Dionne-Riel 2020-02-23 16:05:21 -05:00 committed by GitHub
commit 972678ec74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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