about summary refs log tree commit diff
path: root/nixos/modules/system/activation/switch-to-configuration.pl
diff options
context:
space:
mode:
authorDing Xiang Fei <dingxiangfei2009@gmail.com>2018-07-29 20:35:52 +0800
committerDing Xiang Fei <dingxiangfei2009@gmail.com>2018-07-29 20:35:52 +0800
commit3a9d8a1ab43ed9f47e45c8b39d2a00e8ab29e4bd (patch)
tree67390286586ef4af0342cfaf82962cfb96da9435 /nixos/modules/system/activation/switch-to-configuration.pl
parenta998a49ee4f2f0461a93e9c9524654b845a8139e (diff)
parenta2c6dbe370160ffea5537f64dda04489184c5ce1 (diff)
downloadnixlib-3a9d8a1ab43ed9f47e45c8b39d2a00e8ab29e4bd.tar
nixlib-3a9d8a1ab43ed9f47e45c8b39d2a00e8ab29e4bd.tar.gz
nixlib-3a9d8a1ab43ed9f47e45c8b39d2a00e8ab29e4bd.tar.bz2
nixlib-3a9d8a1ab43ed9f47e45c8b39d2a00e8ab29e4bd.tar.lz
nixlib-3a9d8a1ab43ed9f47e45c8b39d2a00e8ab29e4bd.tar.xz
nixlib-3a9d8a1ab43ed9f47e45c8b39d2a00e8ab29e4bd.tar.zst
nixlib-3a9d8a1ab43ed9f47e45c8b39d2a00e8ab29e4bd.zip
Merge branch 'master' into cross-compiling-postgresql
Diffstat (limited to 'nixos/modules/system/activation/switch-to-configuration.pl')
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl18
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 2ce04ed5342c..ecd35767e01d 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -166,6 +166,24 @@ while (my ($unit, $state) = each %{$activePrev}) {
 
     if (-e $prevUnitFile && ($state->{state} eq "active" || $state->{state} eq "activating")) {
         if (! -e $newUnitFile || abs_path($newUnitFile) eq "/dev/null") {
+            # Ignore (i.e. never stop) these units:
+            if ($unit eq "system.slice") {
+                # TODO: This can be removed a few months after 18.09 is out
+                # (i.e. after everyone switched away from 18.03).
+                # Problem: Restarting (stopping) system.slice would not only
+                # stop X11 but also most system units/services. We obviously
+                # don't want this happening to users when they switch from 18.03
+                # to 18.09 or nixos-unstable.
+                # Reason: The following change in systemd:
+                # https://github.com/systemd/systemd/commit/d8e5a9338278d6602a0c552f01f298771a384798
+                # The commit adds system.slice to the perpetual units, which
+                # means removing the unit file and adding it to the source code.
+                # This is done so that system.slice can't be stopped anymore but
+                # in our case it ironically would cause this script to stop
+                # system.slice because the unit was removed (and an older
+                # systemd version is still running).
+                next;
+            }
             my $unitInfo = parseUnit($prevUnitFile);
             $unitsToStop{$unit} = 1 if boolIsTrue($unitInfo->{'X-StopOnRemoval'} // "yes");
         }