Sync after installing the boot loader
Previously we synced just before calling switch-to-configuration. That prevents corruption of the Nix store, but it can leave the boot loader configuration and kernel files in /boot corrupted. So do the sync after installing the boot loader.
This commit is contained in:
parent
9000fd81d5
commit
fbde5e027e
@ -191,9 +191,6 @@ fi
|
|||||||
# If we're not just building, then make the new configuration the boot
|
# If we're not just building, then make the new configuration the boot
|
||||||
# default and/or activate it now.
|
# default and/or activate it now.
|
||||||
if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
|
if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
|
||||||
# Just in case the new configuration hangs the system, do a sync now.
|
|
||||||
sync
|
|
||||||
|
|
||||||
$pathToConfig/bin/switch-to-configuration "$action"
|
$pathToConfig/bin/switch-to-configuration "$action"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -33,9 +33,13 @@ openlog("nixos", "", LOG_USER);
|
|||||||
# Install or update the bootloader.
|
# Install or update the bootloader.
|
||||||
if ($action eq "switch" || $action eq "boot") {
|
if ($action eq "switch" || $action eq "boot") {
|
||||||
system("@installBootLoader@ $out") == 0 or exit 1;
|
system("@installBootLoader@ $out") == 0 or exit 1;
|
||||||
exit 0 if $action eq "boot";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Just in case the new configuration hangs the system, do a sync now.
|
||||||
|
system("sync") unless ($ENV{"NIXOS_NO_SYNC"} // "") eq "1";
|
||||||
|
|
||||||
|
exit 0 if $action eq "boot";
|
||||||
|
|
||||||
# Check if we can activate the new configuration.
|
# Check if we can activate the new configuration.
|
||||||
my $oldVersion = read_file("/run/current-system/init-interface-version", err_mode => 'quiet') // "";
|
my $oldVersion = read_file("/run/current-system/init-interface-version", err_mode => 'quiet') // "";
|
||||||
my $newVersion = read_file("$out/init-interface-version");
|
my $newVersion = read_file("$out/init-interface-version");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user