longer timeout for container stops
This commit is contained in:
parent
5339721b50
commit
9fe9f12014
1 changed files with 26 additions and 9 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
{ self, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
boot.enableContainers = true;
|
boot.enableContainers = true;
|
||||||
|
|
@ -22,13 +27,25 @@
|
||||||
# };
|
# };
|
||||||
# };
|
# };
|
||||||
|
|
||||||
# # Global DefaultTimeoutStopSec is 10s (modern-desktop.nix), which kills systemd-nspawn
|
# Global DefaultTimeoutStopSec is 10s (modern-desktop.nix), which kills systemd-nspawn
|
||||||
# # before it finishes halting, leaving cgroups busy and breaking restarts.
|
# before it finishes halting, leaving cgroups busy and breaking restarts.
|
||||||
# systemd.services."container@damocles".serviceConfig = {
|
systemd.services =
|
||||||
# TimeoutStopSec = "60s";
|
let
|
||||||
# # After a SIGKILL of nspawn, the kernel needs a moment to reap its cgroups.
|
# The imperative template plus every declarative container: nixos-containers
|
||||||
# # Without this, the immediate restart attempt fails with "Device or resource busy".
|
# generates each one as its own unit, so an override on "container@" alone
|
||||||
# RestartSec = "5s";
|
# would not reach them.
|
||||||
# };
|
containerUnits = [
|
||||||
|
"container@"
|
||||||
|
]
|
||||||
|
++ map (name: "container@${name}") (lib.attrNames config.containers);
|
||||||
|
in
|
||||||
|
lib.genAttrs containerUnits (_: {
|
||||||
|
serviceConfig = {
|
||||||
|
TimeoutStopSec = "2min";
|
||||||
|
# After a SIGKILL of nspawn, the kernel needs a moment to reap its cgroups.
|
||||||
|
# Without this, the immediate restart attempt fails with "Device or resource busy".
|
||||||
|
RestartSec = "5s";
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue