Skip to content

Commit

Permalink
Revert "nixos/stage2: Check for each special mount individually and m…
Browse files Browse the repository at this point in the history
…ount missing ones. (#21370)"

This reverts commit 712e62c.

This commit broke NixOS containers. Systemd wouldn't detect if a container
started successfully and would kill it again after a grace period.

Additionally this prints mount errors due to already mounted filesystems
at boot.
  • Loading branch information
fpletz committed Jan 10, 2017
1 parent 9d35918 commit e4fb2bb
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions nixos/modules/system/boot/stage-2-init.sh
Expand Up @@ -34,24 +34,20 @@ if [ -z "$container" ]; then
fi


# Likewise, stage 1 mounts /proc, /dev, /sys and /run, so if we don't have a
# Likewise, stage 1 mounts /proc, /dev and /sys, so if we don't have a
# stage 1, we need to do that here.
# We check for each mountpoint separately to avoid esoteric failure modes
# if only a subset was mounted by whatever called us.
specialMount() {
local device="$1"
local mountPoint="$2"
local options="$3"
local fsType="$4"

if mountpoint -q "$mountpoint"; then
return 0
fi

mkdir -m 0755 -p "$mountPoint"
mount -n -t "$fsType" -o "$options" "$device" "$mountPoint"
}
source @earlyMountScript@
if [ ! -e /proc/1 ]; then
specialMount() {
local device="$1"
local mountPoint="$2"
local options="$3"
local fsType="$4"

mkdir -m 0755 -p "$mountPoint"
mount -n -t "$fsType" -o "$options" "$device" "$mountPoint"
}
source @earlyMountScript@
fi


echo "booting system configuration $systemConfig" > /dev/kmsg
Expand Down

1 comment on commit e4fb2bb

@copumpkin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @sh01

Please sign in to comment.