1 Commits
6 changed files with 4 additions and 102 deletions

No files matched your search

+3 -5
View File
@@ -78,10 +78,9 @@ default target is reached, and the text login on `tty1` comes forward.
### Without a systemd initrd ### Without a systemd initrd
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/scripted-initrd.webp" width="640" alt="The same boot with NixOS's scripted initrd: the kernel and initrd lines scroll past before bootvine starts in stage 2"> An initrd without systemd, such as one built by initramfs-tools, has no units
for bootvine to follow. The initrd's lines scroll past as usual, and bootvine
The `scripted-initrd` machine uses NixOS's older scripted initrd, which has no starts in
systemd. The initrd's lines scroll past as usual, and bootvine starts in
stage 2, from `sysinit.target` on. stage 2, from `sysinit.target` on.
## Resuming from hibernation ## Resuming from hibernation
@@ -214,7 +213,6 @@ shows the shutdown.
| --- | --- | --- | | --- | --- | --- |
| `nix run .#sample-vm-slow-services` | slow units in the initrd and stage 2, one failing unit, and the handover to a tuigreet login | [booting through the initrd](#booting-through-the-initrd) | | `nix run .#sample-vm-slow-services` | slow units in the initrd and stage 2, one failing unit, and the handover to a tuigreet login | [booting through the initrd](#booting-through-the-initrd) |
| `nix run .#sample-vm-text-console` | the same units without a display manager, handing over at the default target | [without a display manager](#without-a-display-manager) | | `nix run .#sample-vm-text-console` | the same units without a display manager, handing over at the default target | [without a display manager](#without-a-display-manager) |
| `nix run .#sample-vm-scripted-initrd` | the same units with NixOS's scripted initrd, so bootvine starts in stage 2 only | [without a systemd initrd](#without-a-systemd-initrd) |
| `nix run .#sample-vm-encrypted-volume` | a LUKS volume unlocked in the initrd; the passphrase is `sample passphrase` | [passphrase prompts](#passphrase-prompts) | | `nix run .#sample-vm-encrypted-volume` | a LUKS volume unlocked in the initrd; the passphrase is `sample passphrase` | [passphrase prompts](#passphrase-prompts) |
| `nix run .#sample-vm-hibernate-resume` | a swap disk to hibernate to; run `systemctl hibernate`, then start the machine again | [resuming from hibernation](#resuming-from-hibernation) | | `nix run .#sample-vm-hibernate-resume` | a swap disk to hibernate to; run `systemctl hibernate`, then start the machine again | [resuming from hibernation](#resuming-from-hibernation) |
| `nix run .#sample-vm-failures` | a firmware failure in the initrd, then units that exit with an error, crash, time out, cannot be run, restart too often, report a status, die after starting, and one that fails only through its dependency | [failures](#failures) | | `nix run .#sample-vm-failures` | a firmware failure in the initrd, then units that exit with an error, crash, time out, cannot be run, restart too often, report a status, die after starting, and one that fails only through its dependency | [failures](#failures) |
-1
View File
@@ -12,7 +12,6 @@ let
machineDescriptions = { machineDescriptions = {
slow-services = "slow and failing units, a held initrd probe and a tuigreet login"; slow-services = "slow and failing units, a held initrd probe and a tuigreet login";
text-console = "the slow units without a display manager, handing over at the default target"; text-console = "the slow units without a display manager, handing over at the default target";
scripted-initrd = "the slow units with the scripted initrd, so bootvine starts in stage 2";
encrypted-volume = "a LUKS volume unlocked in the initrd with the passphrase 'sample passphrase'"; encrypted-volume = "a LUKS volume unlocked in the initrd with the passphrase 'sample passphrase'";
failures = "units that fail in every way systemd reports, each with journal messages"; failures = "units that fail in every way systemd reports, each with journal messages";
hibernate-resume = "a swap disk to hibernate to, showing the kernel's image loading progress on resume"; hibernate-resume = "a swap disk to hibernate to, showing the kernel's image loading progress on resume";
+1 -4
View File
@@ -5,10 +5,7 @@
nodes.machine = nodes.machine =
{ lib, ... }: { lib, ... }:
{ {
imports = [ imports = [ machine ];
machine
(pkgs.path + "/nixos/tests/common/auto-format-root-device.nix")
];
boot.resumeDevice = "/dev/vdc"; boot.resumeDevice = "/dev/vdc";
swapDevices = lib.mkOverride 0 [ swapDevices = lib.mkOverride 0 [
-36
View File
@@ -1,36 +0,0 @@
{ machine, ... }:
{
name = "bootvine-scripted-initrd";
nodes.machine =
{ lib, ... }:
let
waitFor = flag: "/bin/sh -c 'until [ -e /run/${flag} ]; do sleep 0.1; done'";
in
{
imports = [
machine
../shared/recorded-display.nix
];
systemd = {
settings.Manager.ShowStatus = lib.mkForce true;
services = {
sample-database.serviceConfig.ExecStop = lib.mkForce (waitFor "release-sample-database");
backdoor.before = [ "sample-database.service" ];
late-sensor-probe = {
wantedBy = [ "graphical.target" ];
after = [ "greetd.service" ];
serviceConfig = {
Type = "oneshot";
ExecStart = waitFor "release-late-sensor-probe";
};
};
};
};
};
testScript =
builtins.readFile ../shared/console.py
+ builtins.readFile ../shared/screen_recording.py
+ builtins.readFile ./check.py;
}
-50
View File
@@ -1,50 +0,0 @@
def unit_state(unit):
return machine.succeed(f"systemctl is-active {unit} || true").strip()
recording = ScreenRecording(machine)
machine.start()
recording.start()
wait_for_screen("Stage 2", "sample-database")
assert_bootvine_in_front()
assert_text_visible(font_has_512_glyphs=True)
machine.succeed("timeout 10 systemctl stop bootvine")
machine.succeed("systemctl start --no-block bootvine")
retry(lambda _: foreground_terminal() == f"tty{BOOTVINE_TERMINAL}", timeout_seconds=30)
wait_for_screen("Stage 2")
machine.send_chars("q")
retry(lambda _: unit_state("bootvine") == "inactive", timeout_seconds=10)
assert foreground_terminal() != f"tty{BOOTVINE_TERMINAL}", "the quit key left bootvine in front"
show_status = machine.succeed("systemctl show -p ShowStatus --value").strip()
assert show_status == "yes", f"the quit key did not restore the status output: {show_status}"
machine.succeed("systemctl start --no-block bootvine")
retry(lambda _: foreground_terminal() == f"tty{BOOTVINE_TERMINAL}", timeout_seconds=30)
machine.wait_for_unit("greetd.service")
retry(lambda _: "another program took the console" in bootvine_journal(), timeout_seconds=60)
assert unit_state("late-sensor-probe") == "activating", "the boot finished before the display manager took over"
assert unit_state("bootvine") == "active", "bootvine left before the boot finished"
machine.succeed("timeout 10 systemctl stop bootvine")
assert unit_state("bootvine") == "inactive", "stopping bootvine during the boot did not end it"
show_status = machine.succeed("systemctl show -p ShowStatus --value").strip()
assert show_status == "yes", f"stopping bootvine did not restore the status output: {show_status}"
machine.succeed("touch /run/release-late-sensor-probe")
machine.wait_for_unit("graphical.target")
journal = bootvine_journal()
print(journal)
watched = [line for line in journal.splitlines() if line.startswith("bootvine: watching")]
assert watched, "bootvine never started"
assert not any(" in Initrd " in line for line in watched), "bootvine ran in a scripted initrd"
assert "handing the console over" in journal, "never handed the console over"
machine.succeed("systemctl poweroff --no-block")
retry(lambda _: unit_state("sample-database") == "deactivating", timeout_seconds=60)
wait_for_screen("Shutdown", "sample-database")
assert_bootvine_in_front()
machine.succeed("touch /run/release-sample-database")
machine.wait_for_shutdown()
recording.stop()
-6
View File
@@ -1,6 +0,0 @@
{ lib, ... }:
{
imports = [ ../slow-services/machine.nix ];
boot.initrd.systemd.enable = lib.mkForce false;
}