about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2017-01-10 17:29:19 +0100
committerFranz Pletz <fpletz@fnordicwalking.de>2017-01-10 17:35:38 +0100
commite4fb2bb0c51f6e7fadef6f46b2fe50a6f02e0a38 (patch)
tree87c9c829990e6ec28f59bcecfeeb72f79923071e /nixos/modules/system
parent9d35918f1a0a5a9e1805f960f65216d25644ce11 (diff)
Revert "nixos/stage2: Check for each special mount individually and mount missing ones. (#21370)"
This reverts commit 712e62c2608908cfda471cb8fe409ac65c4844e4.

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.
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/stage-2-init.sh30
1 files changed, 13 insertions, 17 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index 7a54bb03e2972..f827e530f877a 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -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