summary refs log tree commit diff
path: root/host/rootfs
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-04-28 11:12:56 +0000
committerAlyssa Ross <hi@alyssa.is>2022-04-28 11:30:48 +0000
commite04434c1e90a1441ad3dc02893ab98ef3be71ffb (patch)
tree5579e50ed57ed278d381ac092efe98b7af9d09fd /host/rootfs
parent4adae7e7cd86b2f8e2cc140c02760922ee8258a9 (diff)
downloadspectrum-e04434c1e90a1441ad3dc02893ab98ef3be71ffb.tar
spectrum-e04434c1e90a1441ad3dc02893ab98ef3be71ffb.tar.gz
spectrum-e04434c1e90a1441ad3dc02893ab98ef3be71ffb.tar.bz2
spectrum-e04434c1e90a1441ad3dc02893ab98ef3be71ffb.tar.lz
spectrum-e04434c1e90a1441ad3dc02893ab98ef3be71ffb.tar.xz
spectrum-e04434c1e90a1441ad3dc02893ab98ef3be71ffb.tar.zst
spectrum-e04434c1e90a1441ad3dc02893ab98ef3be71ffb.zip
Switch stage1 init to s6-linux-init
The main improvement things brings is that it should resolve a rare
race condition in early boot, where s6-rc-init would run before
s6-svscan, and so the boot would hang because s6-rc would never end up
properly running.
Diffstat (limited to 'host/rootfs')
-rw-r--r--host/rootfs/default.nix6
-rwxr-xr-xhost/rootfs/etc/init19
2 files changed, 6 insertions, 19 deletions
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 1968282..bb82374 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -5,7 +5,7 @@
 
 { lib, stdenv, runCommand, writeReferencesToFile, s6-rc, tar2ext4
 , busybox, cloud-hypervisor, cryptsetup, execline, jq, kmod, mdevd, s6
-, s6-portable-utils, socat, util-linuxMinimal, xorg
+, s6-linux-init, s6-portable-utils, socat, util-linuxMinimal, xorg
 }:
 
 let
@@ -20,8 +20,8 @@ let
   foot = pkgsGui.foot.override { allowPgo = false; };
 
   packages = [
-    cloud-hypervisor execline jq kmod mdevd s6 s6-portable-utils s6-rc
-    socat start-vm
+    cloud-hypervisor execline jq kmod mdevd s6 s6-linux-init s6-portable-utils
+    s6-rc socat start-vm
 
     (cryptsetup.override {
       programs = {
diff --git a/host/rootfs/etc/init b/host/rootfs/etc/init
index 0dff005..9ccb18f 100755
--- a/host/rootfs/etc/init
+++ b/host/rootfs/etc/init
@@ -1,18 +1,5 @@
-#!/bin/execlineb -P
+#!/bin/execlineb -s0
 # SPDX-License-Identifier: EUPL-1.2
-# SPDX-FileCopyrightText: 2020-2022 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
 
-/bin/export PATH /bin
-/bin/s6-setsid -qb --
-
-umask 022
-if { mount -t tmpfs -o mode=0755 tmpfs /run }
-if { s6-dumpenv /run/param }
-if { s6-hiercopy /etc/s6-linux-init/run-image /run }
-emptyenv -p
-
-background { s6-setsid -- /etc/s6-linux-init/scripts/rc.init }
-
-unexport !
-cd /run/service
-s6-svscan
+/bin/s6-linux-init -Bc /etc/s6-linux-init -s /run/param -- $@