mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-27 15:40:18 +02:00
Fix a hang during shutdown
Subtle: dhcpcd.service would call resolvconf during shutdown, which in turn would start invalidate-nscd.service, causing the shutdown to be cancelled. Instead, give nscd.service a proper reload action, and do "systemctl reload --no-block nscd.service". The --no-block is necessary to prevent that command from waiting until a timeout occurs (bug in systemd?).
This commit is contained in:
parent
88bfdca8e0
commit
4475294f57
|
@ -67,7 +67,7 @@ in
|
|||
'' + optionalString config.services.nscd.enable ''
|
||||
# Invalidate the nscd cache whenever resolv.conf is
|
||||
# regenerated.
|
||||
libc_restart='${pkgs.systemd}/bin/systemctl start invalidate-nscd.service'
|
||||
libc_restart='${pkgs.systemd}/bin/systemctl reload --no-block nscd.service'
|
||||
'' + optionalString config.services.bind.enable ''
|
||||
# This hosts runs a full-blown DNS resolver.
|
||||
name_servers='127.0.0.1'
|
||||
|
|
|
@ -92,7 +92,8 @@ in
|
|||
config = mkIf config.networking.useDHCP {
|
||||
|
||||
jobs.dhcpcd =
|
||||
{ startOn = "started network-interfaces";
|
||||
{ wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-interfaces.service" ];
|
||||
|
||||
path = [ dhcpcd pkgs.nettools pkgs.openresolv ];
|
||||
|
||||
|
|
|
@ -58,18 +58,11 @@ in
|
|||
|
||||
daemonType = "fork";
|
||||
|
||||
serviceConfig = "PIDFile=/run/nscd/nscd.pid";
|
||||
};
|
||||
|
||||
# Flush nscd's ‘hosts’ database when the network comes up or the
|
||||
# system configuration changes to get rid of any negative entries.
|
||||
jobs.invalidate_nscd =
|
||||
{ name = "invalidate-nscd";
|
||||
description = "Invalidate NSCD cache";
|
||||
startOn = "ip-up or config-changed";
|
||||
after = [ "nscd.service" ];
|
||||
task = true;
|
||||
exec = "${pkgs.glibc}/sbin/nscd --invalidate hosts";
|
||||
serviceConfig =
|
||||
''
|
||||
PIDFile=/run/nscd/nscd.pid
|
||||
ExecReload=${pkgs.glibc}/sbin/nscd --invalidate hosts
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -21,5 +21,5 @@ with pkgs.lib;
|
|||
ExecStart=${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -179,4 +179,4 @@ fi
|
|||
echo "starting systemd..."
|
||||
PATH=/run/current-system/systemd/lib/systemd \
|
||||
MODULE_DIR=/run/current-system/kernel-modules/lib/modules \
|
||||
exec systemd --log-target journal # --log-level debug --crash-shell
|
||||
exec systemd --log-target=journal # --log-level=debug --log-target=console --crash-shell
|
||||
|
|
Loading…
Reference in a new issue