nixos/zram-generator: do not restart on switch (#504305)
This commit is contained in:
@@ -36,7 +36,18 @@ in
|
||||
];
|
||||
|
||||
systemd.packages = [ cfg.package ];
|
||||
systemd.services."systemd-zram-setup@".path = [ pkgs.util-linux ]; # for mkswap
|
||||
systemd.services."systemd-zram-setup@" = {
|
||||
path = [ pkgs.util-linux ]; # for mkswap
|
||||
# Restart on switch does swapoff -> reset -> reconfigure -> swapon.
|
||||
# Besides risking OOM when swap is in use, the reset races with udev
|
||||
# still holding /dev/zramN open after swapoff: the kernel rejects the
|
||||
# reset with EBUSY (disk_openers > 0), the device stays initialized,
|
||||
# and the following ExecStart fails to write comp_algorithm/disksize
|
||||
# (systemd/zram-generator#226). The unit only "changes" due to store
|
||||
# path churn, so keep the device across switches; real config changes
|
||||
# need a reboot or manual restart.
|
||||
restartIfChanged = false;
|
||||
};
|
||||
|
||||
environment.etc."systemd/zram-generator.conf".source =
|
||||
settingsFormat.generate "zram-generator.conf" cfg.settings;
|
||||
|
||||
Reference in New Issue
Block a user