diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 01963d43cc1..f5fd818d3c7 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -87,6 +87,12 @@ rm -rf /var/run #rm -rf --one-file-system /tmp/* #echo " done" +# This is a good time to clean up /nix/var/nix/chroots. Doing an `rm +# -rf' on it isn't safe in general because it can contain bind mounts +# to /nix/store and other places. But after rebooting these are all +# gone, of course. +rm -rf /nix/var/nix/chroots # recreated in activate-configuration.sh + if test -n "$safeMode"; then mkdir -m 0755 -p /var/run touch /var/run/safemode diff --git a/system/activate-configuration.sh b/system/activate-configuration.sh index c7b1b412841..6db13c6ab36 100644 --- a/system/activate-configuration.sh +++ b/system/activate-configuration.sh @@ -121,7 +121,8 @@ mkdir -m 0755 -p \ /nix/var/nix/profiles \ /nix/var/nix/db \ /nix/var/log/nix/drvs \ - /nix/var/nix/channel-cache + /nix/var/nix/channel-cache \ + /nix/var/nix/chroots mkdir -m 1777 -p /nix/var/nix/gcroots/per-user mkdir -m 1777 -p /nix/var/nix/profiles/per-user