Open seberm opened 1 year ago
Can you see in the bitcoind logs that it takes long to start? Are there any errors in bitcoind logs?
Hello Jonas, I finally found the problem which is causing this issue.
1) I run krops-deploy
, which does rsync of my secrets to a remote node with my local permissions. These are:
$ ls -alh /var/src/secrets/
total 80K
drwx------ 2 root root 4.0K Mar 3 19:38 .
drwxr-xr-x 6 root root 4.0K Mar 3 13:48 ..
-rw------- 1 root root 32 Mar 3 19:23 backup-encryption-env
-rw------- 1 root root 21 Mar 3 19:23 backup-encryption-password
-rw-r--r-- 1 bitcoin bitcoin 98 Aug 25 2022 bitcoin-HMAC-btcpayserver
-rw-r--r-- 1 bitcoin bitcoin 98 Aug 25 2022 bitcoin-HMAC-privileged
-rw-r--r-- 1 bitcoin bitcoin-exporter 98 Dec 30 14:32 bitcoin-HMAC-prometheus
-rw-r--r-- 1 bitcoin bitcoin 98 Aug 25 2022 bitcoin-HMAC-public
-rw-r--r-- 1 bitcoin nbxplorer 21 Aug 24 2022 bitcoin-rpcpassword-btcpayserver
-rw-r--r-- 1 bitcoin bitcoin 21 Aug 24 2022 bitcoin-rpcpassword-privileged
-rw-r--r-- 1 bitcoin bitcoin-exporter 21 Dec 30 12:38 bitcoin-rpcpassword-prometheus
-rw-r--r-- 1 bitcoin bitcoinrpc-public 21 Aug 24 2022 bitcoin-rpcpassword-public
-rw------- 1 clightning clightning 21 Mar 3 19:38 clightning-replication-password
-rw------- 1 nginx nginx 692 Nov 15 13:17 nginx-btcpayserver-cert
-rw-r--r-- 1 root root 1 Nov 15 13:17 nginx-btcpayserver-cert-alt-names
-rw------- 1 nginx nginx 241 Nov 15 13:17 nginx-btcpayserver-key
-rw-r--r-- 1 root root 662 Dec 26 22:49 README.md
-rw-r--r-- 1 root root 26 Jan 31 23:04 root_password
-rw-r--r-- 1 rtl rtl 21 Aug 23 2022 rtl-password
-rw-r--r-- 1 root root 241 Dec 25 20:18 tor-bridges
2) Because I do stop all of the services before the deployment using krops writeCommand
, I need to reboot the remote machine.
krops.pkgs.krops.writeCommand "deploy-boot" {
inherit target;
source = import ./sources.nix { inherit extraSources krops; };
command = targetPath: ''
systemctl stop btcpayserver
systemctl stop mempool
systemctl stop electrs
systemctl stop clightning
systemctl stop bitcoind
sync
nixos-rebuild -I ${targetPath} boot
'';
...
}
3) Machine is rebooted and you were correct, there are erros in journalctl -u bitcoind
:
Mar 04 22:01:39 nix-bitcoin systemd[1]: Starting bitcoind.service...
Mar 04 22:01:39 nix-bitcoin bitcoind-pre-start[1003]: cat: /var/src/secrets/bitcoin-HMAC-btcpayserver: Permission denied
Mar 04 22:01:39 nix-bitcoin bitcoind-pre-start[1004]: cat: /var/src/secrets/bitcoin-HMAC-privileged: Permission denied
Mar 04 22:01:39 nix-bitcoin bitcoind-pre-start[1005]: cat: /var/src/secrets/bitcoin-HMAC-prometheus: Permission denied
Mar 04 22:01:39 nix-bitcoin bitcoind-pre-start[1006]: cat: /var/src/secrets/bitcoin-HMAC-public: Permission denied
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: 2023-03-04T21:01:39Z Ignoring unknown configuration value rpcconnect
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: Bitcoin Core version v24.0.1 (release build)
...
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: Using rpcauth authentication.
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: Invalid -rpcauth argument.
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: Error: Unable to start HTTP server. See debug log for details.
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: Error: Unable to start HTTP server. See debug log for details.
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: Shutdown: In progress...
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: scheduler thread exit
Mar 04 22:01:39 nix-bitcoin bitcoind[1010]: Shutdown: done
Mar 04 22:01:39 nix-bitcoin systemd[1]: bitcoind.service: Main process exited, code=exited, status=1/FAILURE
Mar 04 22:01:39 nix-bitcoin systemd[1]: bitcoind.service: Failed with result 'exit-code'.
Mar 04 22:01:39 nix-bitcoin systemd[1]: Failed to start bitcoind.service.
That is why all the dependent units fail. These errors are caused because the setup-secrets.service
probably hasn't finished before the bitcoind
was started.
The reason I have overlooked the error is because the bitcoind service is automatically restarted and then it's running without any errors.
It's running without any issues, because the setup-secrets.service
unit has finished meanwhile.
Then the permissions are set to:
$ ls -alh /var/src/secrets/
total 80K
drwxr-x--x 2 root root 4.0K Mar 3 19:38 .
drwxr-xr-x 6 root root 4.0K Mar 3 13:48 ..
-r--r----- 1 root root 32 Mar 3 19:23 backup-encryption-env
-r--r----- 1 root root 21 Mar 3 19:23 backup-encryption-password
-r--r----- 1 bitcoin bitcoin 98 Aug 25 2022 bitcoin-HMAC-btcpayserver
-r--r----- 1 bitcoin bitcoin 98 Aug 25 2022 bitcoin-HMAC-privileged
-r--r----- 1 bitcoin bitcoin-exporter 98 Dec 30 14:32 bitcoin-HMAC-prometheus
-r--r----- 1 bitcoin bitcoin 98 Aug 25 2022 bitcoin-HMAC-public
-r--r----- 1 bitcoin nbxplorer 21 Aug 24 2022 bitcoin-rpcpassword-btcpayserver
-r--r----- 1 bitcoin bitcoin 21 Aug 24 2022 bitcoin-rpcpassword-privileged
-r--r----- 1 bitcoin bitcoin-exporter 21 Dec 30 12:38 bitcoin-rpcpassword-prometheus
-r--r----- 1 bitcoin bitcoinrpc-public 21 Aug 24 2022 bitcoin-rpcpassword-public
-r--r----- 1 clightning clightning 21 Mar 3 19:38 clightning-replication-password
-r--r----- 1 nginx nginx 692 Nov 15 13:17 nginx-btcpayserver-cert
-r--r----- 1 root root 1 Nov 15 13:17 nginx-btcpayserver-cert-alt-names
-r--r----- 1 nginx nginx 241 Nov 15 13:17 nginx-btcpayserver-key
-r--r----- 1 root root 662 Dec 26 22:49 README.md
-r--r----- 1 root root 26 Jan 31 23:04 root_password
-r--r----- 1 rtl rtl 21 Aug 23 2022 rtl-password
-r--r----- 1 root root 241 Dec 25 20:18 tor-bridges
Is it possible that bitcoind is started before the setup-secrets.service
/nix-bitcoin-secrets.target
hasn't finished?
My current workaround is just to restart the setup-secrets.service
right after the deployment in the krops writeCommand
, so the correct permissions are set before the machine reboots.
Thanks!
I have a similar problem: bitcoind
crashes from time to time (unreliable fs cache, need to fix) and clightning
stops but starts again, but clightning-rest
, rtl
and spark-wallet
stay in the "dependency failed" state.
Hello, when I reboot the VM with nix-bitcoin, most of the services which depend on a
bitcoind.service
fail with the "Dependency failed for 'service_name'" error and they are not started/restarted at all.It's a pain especially when the
clightning.service
is not started because most of other services depend on it:This behavior is reproducible in 90% of reboots. I am running latest nix-bitcoin (v0.0.87) on:
I think it could be possible that it just takes too long to start bitcoind unit and initialize the Tor network which results in dependent units timing out. What do you think?
My current workaround is just to manually restart of all the failed units.