From 77b7d29bf83b40defe90c02e346665dc4a69721f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Giraudeau Date: Thu, 11 Mar 2021 11:09:50 +0100 Subject: [PATCH] nixos/switch-to-configuration: don't try restart deleted sockets --- .../system/activation/switch-to-configuration.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index b82d69b3bb85..0445f39a8279 100644 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -243,9 +243,13 @@ while (my ($unit, $state) = each %{$activePrev}) { foreach my $socket (@sockets) { if (defined $activePrev->{$socket}) { $unitsToStop{$socket} = 1; - $unitsToStart{$socket} = 1; - recordUnit($startListFile, $socket); - $socketActivated = 1; + # Only restart sockets that actually + # exist in new configuration: + if (-e "$out/etc/systemd/system/$socket") { + $unitsToStart{$socket} = 1; + recordUnit($startListFile, $socket); + $socketActivated = 1; + } } } }