m/n/installer: reboot on fatal errors

Currently irrecoverable errors are handled by log.Fatal, which calls
os.Exit after printing the error message. As this kills the init
process, it leads the kernel to panic and print a long call trace,
obscuring the true cause of trouble. The kernel then reboots
immediately, as it is configured to do so, making it impossible to
read the logs off the screen when using a graphical console.

This patch makes the installer hang after displaying status
information.

Change-Id: Ib6a7582b621fd5072e636242f8279be2a831c3f3
Reviewed-on: https://review.monogon.dev/c/monogon/+/488
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/metropolis/test/installer/main.go b/metropolis/test/installer/main.go
index dafa288..cd0873b 100644
--- a/metropolis/test/installer/main.go
+++ b/metropolis/test/installer/main.go
@@ -84,7 +84,11 @@
 
 	// Copy the stdout and stderr output to a single channel of lines so that they
 	// can then be matched against expectedOutput.
-	lineC := make(chan string)
+
+	// Since LineBuffer can write its buffered contents on a deferred Close,
+	// after the reader loop is broken, avoid deadlocks by making lineC a
+	// buffered channel.
+	lineC := make(chan string, 2)
 	outBuffer := logbuffer.NewLineBuffer(1024, func(l *logbuffer.Line) {
 		lineC <- l.Data
 	})
@@ -219,7 +223,7 @@
 	// No block devices are passed to QEMU aside from the install medium. Expect
 	// the installer to fail at the device probe stage rather than attempting to
 	// use the medium as the target device.
-	expectedOutput := "couldn't find a suitable block device"
+	expectedOutput := "Couldn't find a suitable block device"
 	result, err := runQemuWithInstaller(ctx, nil, expectedOutput)
 	if err != nil {
 		t.Error(err.Error())
@@ -242,7 +246,7 @@
 	}
 
 	// Run QEMU. Expect the installer to fail with a predefined error string.
-	expectedOutput := "couldn't find a suitable block device"
+	expectedOutput := "Couldn't find a suitable block device"
 	result, err := runQemuWithInstaller(ctx, qemuDriveParam(imagePath), expectedOutput)
 	if err != nil {
 		t.Error(err.Error())