summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--guix/scripts/system.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index d2be0cf8fb..9ba9428a08 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -235,6 +235,13 @@ When INSTALL-BOOTLOADER? is true, install bootloader using BOOTCFG."
 the ownership of '~a' may be incorrect!~%")
                target))
 
+  ;; If a previous installation was attempted, make sure we start anew; in
+  ;; particular, we don't want to keep a store database that might not
+  ;; correspond to what we're actually putting in the store.
+  (let ((state (string-append target "/var/guix")))
+    (when (file-exists? state)
+      (delete-file-recursively state)))
+
   (chmod target #o755)
   (let ((os-dir   (derivation->output-path os-drv))
         (format   (lift format %store-monad))