modules/nixos/common: reboot on panic
This commit is contained in:
parent
726fe65f86
commit
485a82492b
1 changed files with 20 additions and 0 deletions
|
@ -35,6 +35,26 @@
|
||||||
zramSwap.enable = true;
|
zramSwap.enable = true;
|
||||||
zramSwap.memoryPercent = 100;
|
zramSwap.memoryPercent = 100;
|
||||||
|
|
||||||
|
systemd.services.sysctl-after-boot = {
|
||||||
|
serviceConfig.Restart = "on-failure";
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
path = [
|
||||||
|
pkgs.procps
|
||||||
|
];
|
||||||
|
script = ''
|
||||||
|
sysctl -w kernel.hardlockup_panic=1
|
||||||
|
sysctl -w kernel.hung_task_panic=1
|
||||||
|
sysctl -w kernel.panic_on_oops=1
|
||||||
|
sysctl -w kernel.panic=60
|
||||||
|
sysctl -w kernel.softlockup_panic=1
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.sysctl-after-boot = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig.OnBootSec = "5m";
|
||||||
|
};
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/pull/268121
|
# https://github.com/NixOS/nixpkgs/pull/268121
|
||||||
# https://wiki.archlinux.org/title/Zram#Optimizing_swap_on_zram
|
# https://wiki.archlinux.org/title/Zram#Optimizing_swap_on_zram
|
||||||
boot.kernel.sysctl = {
|
boot.kernel.sysctl = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue