feat: show why units failed, with their last journal lines
Failed jobs keep their kind: units that broke or timed out get a failure panel entry with the reason systemd reports (exit status, signal, timeout, start limit, status text) and their last journal lines read through libsystemd. Units that failed only through a dependency are dimmed and left out of the panel, and units that crash after starting count as failed. Restructure the repository around this: - move the library and binary into bootvine/ and the scripted demos into their own unpublished scripted-demos crate, with their VHS tapes - move the crane builds and NixOS module into nix/ - group each sample VM with its check under vm-tests/, adding text-console, scripted-initrd, encrypted-volume and failures machines and a vm-failures check - add docs/guide.md walking through the screen with every recording, keep one recording in the README, and re-render all recordings
This commit is contained in:
1 parent
f2544a964a
commit
7e95cbd8e9
96 files changed
+2027
-462
No files matched your search
@@ -0,0 +1,45 @@
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
system.stateVersion = "26.05";
|
||||
|
||||
boot.consoleLogLevel = lib.mkForce 3;
|
||||
|
||||
services.bootvine = {
|
||||
enable = true;
|
||||
settings.colors = {
|
||||
tree.current-stage = "light-yellow";
|
||||
tree.running-marker = "light-yellow";
|
||||
timeline.running = "light-yellow";
|
||||
footer.running = "light-yellow";
|
||||
password.frame = "light-yellow";
|
||||
};
|
||||
};
|
||||
|
||||
console = {
|
||||
colors = [
|
||||
"1d2021"
|
||||
"fb4934"
|
||||
"b8bb26"
|
||||
"fabd2f"
|
||||
"83a598"
|
||||
"d3869b"
|
||||
"8ec07c"
|
||||
"d5c4a1"
|
||||
"665c54"
|
||||
"fb4934"
|
||||
"b8bb26"
|
||||
"fabd2f"
|
||||
"83a598"
|
||||
"d3869b"
|
||||
"8ec07c"
|
||||
"fbf1c7"
|
||||
];
|
||||
earlySetup = true;
|
||||
font = "${pkgs.terminus_font}/share/consolefonts/ter-v20n.psf.gz";
|
||||
};
|
||||
|
||||
users.users.sample-user = {
|
||||
isNormalUser = true;
|
||||
password = "sample-user";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import base64
|
||||
|
||||
BOOTVINE_TERMINAL = 12
|
||||
|
||||
|
||||
def read_terminal():
|
||||
attributed, characters = machine.succeed(
|
||||
f"base64 -w0 /dev/vcsa{BOOTVINE_TERMINAL}; echo; "
|
||||
f"base64 -w0 /dev/vcsu{BOOTVINE_TERMINAL}"
|
||||
).split()
|
||||
attributed = base64.b64decode(attributed)
|
||||
columns = attributed[1]
|
||||
attributes = attributed[5::2]
|
||||
text = base64.b64decode(characters).decode("utf-32-le")
|
||||
return columns, text, attributes
|
||||
|
||||
|
||||
def as_rows(text, columns):
|
||||
return "\n".join(text[start : start + columns] for start in range(0, len(text), columns))
|
||||
|
||||
|
||||
def screen():
|
||||
columns, text, _ = read_terminal()
|
||||
return as_rows(text, columns)
|
||||
|
||||
|
||||
def colours(attribute, font_has_512_glyphs):
|
||||
if font_has_512_glyphs:
|
||||
return (attribute >> 1) & 0x0F, (attribute >> 5) & 0x07
|
||||
return attribute & 0x0F, (attribute >> 4) & 0x07
|
||||
|
||||
|
||||
def assert_text_visible(font_has_512_glyphs=False):
|
||||
columns, text, attributes = read_terminal()
|
||||
|
||||
def is_hidden(character, attribute):
|
||||
foreground, background = colours(attribute, font_has_512_glyphs)
|
||||
return character != " " and foreground == background
|
||||
|
||||
hidden = "".join(
|
||||
"#" if is_hidden(character, attribute) else " "
|
||||
for character, attribute in zip(text, attributes)
|
||||
)
|
||||
assert "#" not in hidden, (
|
||||
f"text drawn in its background colour, marked #:\n{as_rows(hidden, columns)}\n{as_rows(text, columns)}"
|
||||
)
|
||||
|
||||
|
||||
def wait_for_screen(*fragments):
|
||||
def shows_all(last_try):
|
||||
text = screen()
|
||||
if last_try:
|
||||
print(text)
|
||||
print(bootvine_journal())
|
||||
return all(fragment in text for fragment in fragments)
|
||||
|
||||
retry(shows_all, timeout_seconds=60)
|
||||
|
||||
|
||||
def foreground_terminal():
|
||||
return machine.succeed("cat /sys/class/tty/tty0/active").strip()
|
||||
|
||||
|
||||
def assert_bootvine_in_front():
|
||||
active = foreground_terminal()
|
||||
assert active == f"tty{BOOTVINE_TERMINAL}", f"bootvine is not in front: {active}"
|
||||
|
||||
|
||||
def bootvine_journal():
|
||||
return machine.succeed("journalctl -b -u bootvine -o cat")
|
||||
@@ -0,0 +1,20 @@
|
||||
machineName: {
|
||||
boot.loader.grub.enable = false;
|
||||
|
||||
services.getty.autologinUser = "root";
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
virtualisation.vmVariant.virtualisation = {
|
||||
memorySize = 2048;
|
||||
cores = 2;
|
||||
graphics = true;
|
||||
diskImage = "\${XDG_CACHE_HOME:-$HOME/.cache}/bootvine-${machineName}.qcow2";
|
||||
qemu.options = [
|
||||
"-vga none"
|
||||
"-device virtio-vga,xres=1920,yres=1080"
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user