From 08cd8ab8b6782d9f48cdccd127a12d82257e1b3d Mon Sep 17 00:00:00 2001 From: Janne Heß Date: Sat, 29 Jan 2022 23:21:42 +0100 Subject: nixos/switch-to-configuration: Don't stop swaps in dry-activate --- nixos/modules/system/activation/switch-to-configuration.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index 2fe78634d627..2ea871626e20 100644 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -507,8 +507,12 @@ foreach my $device (keys %$prevSwaps) { # "systemctl stop" here because systemd has lots of alias # units that prevent a stop from actually calling # "swapoff". - print STDERR "stopping swap device: $device\n"; - system("@utillinux@/sbin/swapoff", $device); + if ($action ne "dry-activate") { + print STDERR "would stop swap device: $device\n"; + } else { + print STDERR "stopping swap device: $device\n"; + system("@utillinux@/sbin/swapoff", $device); + } } # FIXME: update swap options (i.e. its priority). } -- cgit 1.4.1