From 66d9650f4811a93a7275b564b250be45f411b4ef Mon Sep 17 00:00:00 2001 From: Clemens Fruhwirth Date: Mon, 25 Mar 2019 14:40:12 +0100 Subject: [PATCH] Create /var/lib/bitcoind/blocks Otherwise: Mar 25 13:33:22 nix-bitcoin systemd[1]: Starting Bitcoin daemon... Mar 25 13:33:22 nix-bitcoin f3ickn20fqrz5gd0zm7hgm247b9ajdl8-unit-script-bitcoind-pre-start[1883]: chmod: cannot access '/var/lib/bitcoind/blocks': No such fi> Mar 25 13:33:22 nix-bitcoin systemd[1]: bitcoind.service: Control process exited, code=exited status=1 Mar 25 13:33:22 nix-bitcoin systemd[1]: bitcoind.service: Failed with result 'exit-code'. --- modules/bitcoind.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index cd2e27f..b8d4aae 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -205,7 +205,11 @@ in { preStart = '' if ! test -e ${cfg.dataDir}; then mkdir -m 0770 -p '${cfg.dataDir}' - chown '${cfg.user}:${cfg.group}' '${cfg.dataDir}' + chown -R '${cfg.user}:${cfg.group}' '${cfg.dataDir}' + fi + if ! test -e ${cfg.dataDir}/blocks; then + mkdir -m 0770 -p '${cfg.dataDir}/blocks' + chown -R '${cfg.user}:${cfg.group}' '${cfg.dataDir}/blocks' fi cp '${cfg.configFileOption}' '${cfg.dataDir}/bitcoin.conf' chmod o-rw '${cfg.dataDir}/bitcoin.conf'