summary refs log tree commit diff
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
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.
-rw-r--r--host/rootfs/default.nix6
-rwxr-xr-xhost/rootfs/etc/init19
-rw-r--r--vm/app/catgirl/default.nix5
-rwxr-xr-xvm/app/catgirl/etc/init18
-rw-r--r--vm/app/lynx/default.nix5
-rwxr-xr-xvm/app/lynx/etc/init18
-rw-r--r--vm/sys/net/default.nix4
-rwxr-xr-xvm/sys/net/etc/init18
8 files changed, 23 insertions, 70 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 -- $@
diff --git a/vm/app/catgirl/default.nix b/vm/app/catgirl/default.nix
index bf35d04..55cccf0 100644
--- a/vm/app/catgirl/default.nix
+++ b/vm/app/catgirl/default.nix
@@ -9,14 +9,15 @@ pkgs.pkgsStatic.callPackage (
 
 { lib, stdenv, runCommand, writeReferencesToFile, buildPackages
 , s6-rc, tar2ext4
-, busybox, cacert, catgirl, execline, kmod, mdevd, s6, s6-portable-utils
+, busybox, cacert, catgirl, execline, kmod, mdevd, s6, s6-linux-init
+, s6-portable-utils
 }:
 
 let
   inherit (lib) cleanSource cleanSourceWith concatMapStringsSep;
 
   packages = [
-    catgirl execline kmod mdevd s6 s6-portable-utils s6-rc
+    catgirl execline kmod mdevd s6 s6-linux-init s6-portable-utils s6-rc
 
     (busybox.override {
       extraConfig = ''
diff --git a/vm/app/catgirl/etc/init b/vm/app/catgirl/etc/init
index 9ead7ab..d67ecd1 100755
--- a/vm/app/catgirl/etc/init
+++ b/vm/app/catgirl/etc/init
@@ -1,17 +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-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 -- $@
diff --git a/vm/app/lynx/default.nix b/vm/app/lynx/default.nix
index b188794..e74a96f 100644
--- a/vm/app/lynx/default.nix
+++ b/vm/app/lynx/default.nix
@@ -9,14 +9,15 @@ pkgs.pkgsStatic.callPackage (
 
 { lib, stdenv, runCommand, writeReferencesToFile, buildPackages
 , s6-rc, tar2ext4
-, busybox, cacert, execline, kmod, lynx, mdevd, s6, s6-portable-utils
+, busybox, cacert, execline, kmod, lynx, mdevd, s6, s6-linux-init
+, s6-portable-utils
 }:
 
 let
   inherit (lib) cleanSource cleanSourceWith concatMapStringsSep;
 
   packages = [
-    execline kmod lynx mdevd s6 s6-portable-utils s6-rc
+    execline kmod lynx mdevd s6 s6-linux-init s6-portable-utils s6-rc
 
     (busybox.override {
       extraConfig = ''
diff --git a/vm/app/lynx/etc/init b/vm/app/lynx/etc/init
index 9ead7ab..d67ecd1 100755
--- a/vm/app/lynx/etc/init
+++ b/vm/app/lynx/etc/init
@@ -1,17 +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-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 -- $@
diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
index 55ae9cb..097ce0e 100644
--- a/vm/sys/net/default.nix
+++ b/vm/sys/net/default.nix
@@ -10,7 +10,7 @@ pkgs.pkgsStatic.callPackage (
 { lib, stdenv, runCommand, writeReferencesToFile, buildPackages
 , s6-rc, tar2ext4, xorg
 , busybox, connmanMinimal, dbus, execline, kmod, mdevd, nftables, s6
-, s6-portable-utils
+, s6-linux-init, s6-portable-utils
 }:
 
 let
@@ -19,7 +19,7 @@ let
   connman = connmanMinimal;
 
   packages = [
-    connman dbus execline kmod mdevd s6 s6-portable-utils s6-rc
+    connman dbus execline kmod mdevd s6 s6-linux-init s6-portable-utils s6-rc
 
     (busybox.override {
       extraConfig = ''
diff --git a/vm/sys/net/etc/init b/vm/sys/net/etc/init
index 9ead7ab..d67ecd1 100755
--- a/vm/sys/net/etc/init
+++ b/vm/sys/net/etc/init
@@ -1,17 +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-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 -- $@