mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-03 03:23:17 +00:00
stage-1: mount /proc, /sys, /dev in the target root
The switch_root in BusyBox doesn't do this (while the one in util-linux does). So we have to do this ourselves.
This commit is contained in:
parent
598adfee3e
commit
980ba4d5a5
@ -336,8 +336,7 @@ echo /sbin/modprobe > /proc/sys/kernel/modprobe
|
||||
|
||||
|
||||
# Start stage 2. `switch_root' deletes all files in the ramfs on the
|
||||
# current root. It also moves the /proc, /sys and /dev mounts over to
|
||||
# the new root. Note that $stage2Init might be an absolute symlink,
|
||||
# current root. Note that $stage2Init might be an absolute symlink,
|
||||
# in which case "-e" won't work because we're not in the chroot yet.
|
||||
if ! test -e "$targetRoot/$stage2Init" -o -L "$targetRoot/$stage2Init"; then
|
||||
echo "stage 2 init script ($targetRoot/$stage2Init) not found"
|
||||
@ -346,7 +345,9 @@ fi
|
||||
|
||||
mkdir -m 0755 -p $targetRoot/proc $targetRoot/sys $targetRoot/dev $targetRoot/run
|
||||
|
||||
# `switch_root' doesn't move /run yet, so we have to do it ourselves.
|
||||
mount --bind /proc $targetRoot/proc
|
||||
mount --bind /sys $targetRoot/sys
|
||||
mount --bind /dev $targetRoot/dev
|
||||
mount --bind /run $targetRoot/run
|
||||
|
||||
exec switch_root "$targetRoot" "$stage2Init"
|
||||
|
Loading…
Reference in New Issue
Block a user