From c38f369ee4aa5d4168935aea0f4ce68208c371a0 Mon Sep 17 00:00:00 2001 From: Wim de With Date: Fri, 12 Jan 2024 14:13:18 +0100 Subject: [PATCH] make-disk-image: umount filesystems after install The vmTools in nixpkgs shuts the VM down with poweroff -f, which does not cleanly umount the filesystems. This may lead to filesystem corruption on the newly created image. --- lib/make-disk-image.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/make-disk-image.nix b/lib/make-disk-image.nix index 572a9ef..572daa2 100644 --- a/lib/make-disk-image.nix +++ b/lib/make-disk-image.nix @@ -62,6 +62,7 @@ let ''; installer = '' ${systemToInstall.config.system.build.nixos-install}/bin/nixos-install --system ${systemToInstall.config.system.build.toplevel} --keep-going --no-channel-copy -v --no-root-password --option binary-caches "" + umount -Rv ${systemToInstall.config.disko.rootMountPoint} ''; QEMU_OPTS = lib.concatMapStringsSep " " (disk: "-drive file=${disk.name}.raw,if=virtio,cache=unsafe,werror=report") (lib.attrValues nixosConfig.config.disko.devices.disk); in