systemd: reduce shutdown timeout from "20" to "10" sec (40s IRL)

This commit is contained in:
Colin 2024-03-07 01:01:06 +00:00
parent b36d224b85
commit 219fe67f34
1 changed files with 10 additions and 3 deletions

View File

@ -1,13 +1,20 @@
{ pkgs, ... }:
let
# N.B.: systemd doesn't like to honor its timeout settings.
# a timeout of 20s is actually closer to 70s,
# because it allows 20s, then after the 20s passes decides to allow 40s, then 60s,
# finally it peacefully kills stuff, and then 10s later actually kills shit.
haltTimeout = 10;
in
{
systemd.extraConfig = ''
# DefaultTimeoutStopSec defaults to 90s, and frequently blocks overall system shutdown.
DefaultTimeoutStopSec=20
DefaultTimeoutStopSec=${builtins.toString haltTimeout}
'';
systemd.user.extraConfig = ''
# DefaultTimeoutStopSec defaults to 90s, and frequently blocks overall system shutdown.
DefaultTimeoutStopSec=20
DefaultTimeoutStopSec=${builtins.toString haltTimeout}
'';
services.journald.extraConfig = ''
@ -46,7 +53,7 @@
Delegate = [ "pids" "memory" "cpu" ];
DelegateSubgroup = "init.scope";
TasksMax = "infinity";
TimeoutStopSec = "20s"; #< default: 120s
TimeoutStopSec = "${builtins.toString haltTimeout}s"; #< default: 120s
KeyringMode = "inherit";
OOMScoreAdjust = 100;
MemoryPressureWatch = "skip";