From 828cd4c89520f177158c7504af3f3aa092bd8e90 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 2 Nov 2022 12:02:52 +0100 Subject: [PATCH] nixos/bitcoind: fix rare startup error Previously, dhcpcd and bitcoind starting up in parallel could lead to the following error in bitcoind: ``` bitcoind: libevent: getaddrinfo: address family for nodename not supported bitcoind: Binding RPC on address 127.0.0.1 port 8332 failed. bitcoind: Unable to bind any endpoint for ``` After the initial failure, the bitcoind service would always restart successfully. This race condition, where both applications were simultaneously manipulating network resources, was only triggered under specific hardware conditions. Fix it by running bitcoind after dhcp has started (by running after `network-online.target`). This bug and the fix only affect the default NixOS scripted networking backend. --- nixos/modules/services/networking/bitcoind.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/bitcoind.nix b/nixos/modules/services/networking/bitcoind.nix index e8b0fb65ffcf..6df809a8b764 100644 --- a/nixos/modules/services/networking/bitcoind.nix +++ b/nixos/modules/services/networking/bitcoind.nix @@ -204,7 +204,7 @@ in ''; in { description = "Bitcoin daemon"; - after = [ "network.target" ]; + after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { User = cfg.user;