From 7b549222273c0b2cfab21fe86ce7bd53d175dff0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jun 2012 11:39:27 -0400 Subject: [PATCH 1/6] Don't include klibc in the installation CD --- modules/installer/cd-dvd/installation-cd-base.nix | 2 +- modules/installer/cd-dvd/system-tarball-pc.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/installer/cd-dvd/installation-cd-base.nix b/modules/installer/cd-dvd/installation-cd-base.nix index ae227dbcb80..aff46fbac34 100644 --- a/modules/installer/cd-dvd/installation-cd-base.nix +++ b/modules/installer/cd-dvd/installation-cd-base.nix @@ -66,5 +66,5 @@ in # To speed up installation a little bit, include the complete stdenv # in the Nix store on the CD. - isoImage.storeContents = [ pkgs.stdenv pkgs.klibc pkgs.klibcShrunk ]; + isoImage.storeContents = [ pkgs.stdenv ]; } diff --git a/modules/installer/cd-dvd/system-tarball-pc.nix b/modules/installer/cd-dvd/system-tarball-pc.nix index 035b6dd6c0a..ddad520c446 100644 --- a/modules/installer/cd-dvd/system-tarball-pc.nix +++ b/modules/installer/cd-dvd/system-tarball-pc.nix @@ -123,7 +123,7 @@ in # To speed up further installation of packages, include the complete stdenv # in the Nix store of the tarball. - tarball.storeContents = pkgs2storeContents [ pkgs.stdenv pkgs.klibc pkgs.klibcShrunk ]; + tarball.storeContents = pkgs2storeContents [ pkgs.stdenv ]; tarball.contents = [ { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile; From 598adfee3ee9c5fa4409c9cd8f571f71a4f0c112 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jun 2012 11:55:23 -0400 Subject: [PATCH 2/6] Fix booting from the CD-ROM So it turns out that BusyBox doesn't auto-load modules for filesystems that have type "auto", e.g. it doesn't figure out that it should load the "iso9660" module should be loaded when mounting the CD-ROM. We don't want to give the root FS on the CD type "iso9660", because that breaks booting from a USB stick created by unetbootin. So make sure the "iso9660" module is loaded. --- modules/installer/cd-dvd/iso-image.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/installer/cd-dvd/iso-image.nix b/modules/installer/cd-dvd/iso-image.nix index cf76151c2ae..7b050f8dd6a 100644 --- a/modules/installer/cd-dvd/iso-image.nix +++ b/modules/installer/cd-dvd/iso-image.nix @@ -205,9 +205,7 @@ in else [ config.boot.kernelPackages.aufs ]; - boot.initrd.availableKernelModules = [ "aufs" "squashfs" "iso9660" ]; - - boot.initrd.kernelModules = [ "loop" ]; + boot.initrd.kernelModules = [ "aufs" "squashfs" "iso9660" "loop" ]; boot.kernelModules = pkgs.stdenv.lib.optional config.isoImage.makeEfiBootable "efivars"; From 980ba4d5a527d0e011ad9410d3873dd28292a8c6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jun 2012 13:51:42 -0400 Subject: [PATCH 3/6] stage-1: mount /proc, /sys, /dev in the target root The switch_root in BusyBox doesn't do this (while the one in util-linux does). So we have to do this ourselves. --- modules/system/boot/stage-1-init.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 83300b0d2b8..33eaee826aa 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -336,8 +336,7 @@ echo /sbin/modprobe > /proc/sys/kernel/modprobe # Start stage 2. `switch_root' deletes all files in the ramfs on the -# current root. It also moves the /proc, /sys and /dev mounts over to -# the new root. Note that $stage2Init might be an absolute symlink, +# current root. Note that $stage2Init might be an absolute symlink, # in which case "-e" won't work because we're not in the chroot yet. if ! test -e "$targetRoot/$stage2Init" -o -L "$targetRoot/$stage2Init"; then echo "stage 2 init script ($targetRoot/$stage2Init) not found" @@ -346,7 +345,9 @@ fi mkdir -m 0755 -p $targetRoot/proc $targetRoot/sys $targetRoot/dev $targetRoot/run -# `switch_root' doesn't move /run yet, so we have to do it ourselves. +mount --bind /proc $targetRoot/proc +mount --bind /sys $targetRoot/sys +mount --bind /dev $targetRoot/dev mount --bind /run $targetRoot/run exec switch_root "$targetRoot" "$stage2Init" From 1da7cea2230cfef072a67cc34250818a86d1c0be Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jun 2012 14:16:55 -0400 Subject: [PATCH 4/6] Add Busybox to the installation CD This is mostly to get the automated tests to succeed. --- modules/installer/cd-dvd/installation-cd-base.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/installer/cd-dvd/installation-cd-base.nix b/modules/installer/cd-dvd/installation-cd-base.nix index aff46fbac34..375941d2447 100644 --- a/modules/installer/cd-dvd/installation-cd-base.nix +++ b/modules/installer/cd-dvd/installation-cd-base.nix @@ -66,5 +66,5 @@ in # To speed up installation a little bit, include the complete stdenv # in the Nix store on the CD. - isoImage.storeContents = [ pkgs.stdenv ]; + isoImage.storeContents = [ pkgs.stdenv pkgs.busybox ]; } From 82019c01bb638b0ce243f14ed74a62c8e5312140 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jun 2012 14:31:07 -0400 Subject: [PATCH 5/6] Test driver: exit when all VMs have exited rather than sleeping forever --- lib/test-driver/test-driver.pl | 8 ++++++++ lib/testing.nix | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/test-driver/test-driver.pl b/lib/test-driver/test-driver.pl index 0fdcf97af67..43f74cf404b 100644 --- a/lib/test-driver/test-driver.pl +++ b/lib/test-driver/test-driver.pl @@ -68,6 +68,14 @@ sub startAll { } +# Wait until all VMs have terminated. +sub joinAll { + $log->nest("waiting for all VMs to finish", sub { + $_->waitForShutdown foreach values %vms; + }); +} + + # In interactive tests, this allows the non-interactive test script to # be executed conveniently. sub testScript { diff --git a/lib/testing.nix b/lib/testing.nix index 704ee4025a5..6a39df8c865 100644 --- a/lib/testing.nix +++ b/lib/testing.nix @@ -157,7 +157,7 @@ rec { ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms wrapProgram $out/bin/nixos-run-vms \ --add-flags "$vms" \ - --set tests '"startAll; sleep 1e9;"' \ + --set tests '"startAll; joinAll;"' \ --set VLANS '"${toString vlans}"' ''; # " From 6bd32f0a27df5e9d7c349cc0955c5bec03a77e1a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jun 2012 15:37:22 -0400 Subject: [PATCH 6/6] Drop the socat wrapper --- modules/testing/test-instrumentation.nix | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/modules/testing/test-instrumentation.nix b/modules/testing/test-instrumentation.nix index 5e40cf215b7..830f1744fa0 100644 --- a/modules/testing/test-instrumentation.nix +++ b/modules/testing/test-instrumentation.nix @@ -5,20 +5,6 @@ with pkgs.lib; -let - - # Urgh, `socat' sets the SIGCHLD to ignore. This wreaks havoc with - # some programs. - rootShell = pkgs.writeScript "shell.pl" - '' - #! ${pkgs.perl}/bin/perl - $SIG{CHLD} = 'DEFAULT'; - print "\n"; - exec "/bin/sh"; - ''; - -in - { config = @@ -41,7 +27,8 @@ in exec < /dev/hvc0 > /dev/hvc0 2> /dev/ttyS0 echo "connecting to host..." >&2 stty -F /dev/hvc0 raw -echo # prevent nl -> cr/nl conversion - ${pkgs.socat}/bin/socat stdio exec:${rootShell} + echo + PS1= /bin/sh ''; respawn = false;