Title: [solved] bitcoind upstart problem Post by: whywefight on March 22, 2018, 03:52:11 PM Not 100% if this is the right section but lets see.
I am running the latest BTC daemon on a Raspberry Pi 3 with Stretch Lite and i followed this guide: https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_30_bitcoin.md Basically, everything works except for one strange thing: If i reboot the system, bitcoind starts up on boot, runs and is "doing" something but if i want to use bitcoin-cli i get: Code: bitcoin@pinode:/home/admin $ bitcoin-cli getblockchaininfo If i kill the btc daemon and wait till it gets upstarted by systemd again, everything is fine and working. i am sure the service config is good. Otherwise it shouldnt work with my hard kill. I changed my conf to: After=network-online.target Wants=network-online.target Cause i assumed the network stack is not ready but still the same. I have no clue why its not working from boot, well lets say why its only working half. Any suggestions? Title: Re: bitcoind upstart problem Post by: starmyc on March 22, 2018, 04:17:10 PM bitcoin-cli is not able to reach the bitcoind's rpc port, which should be located at port 8332. You should try the following to check the port is correctly opened:
Code: # netstat -nap|grep bitcoin|grep LISTEN Also, make sure that bitcoind is started with the "-server" flag: Code: # ps auxw|grep -i bitcoind|grep -v grep Title: Re: bitcoind upstart problem Post by: whywefight on March 22, 2018, 04:20:31 PM bitcoin-cli is not able to reach the bitcoind's rpc port, which should be located at port 8332. You should try the following to check the port is correctly opened: Code: # netstat -nap|grep bitcoin|grep LISTEN Also, make sure that bitcoind is started with the "-server" flag: Code: # ps auxw|grep -i bitcoind|grep -v grep Thats all correct. As i said, if i kill the daemon and let systemd start it up again it works as it should. Config is set accodring to https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_30_bitcoin.md Everything is working except when its starting during system boot. Title: Re: bitcoind upstart problem Post by: starmyc on March 22, 2018, 04:42:47 PM Thats all correct. As i said, if i kill the daemon and let systemd start it up again it works as it should. Config is set accodring to https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_30_bitcoin.md Everything is working except when its starting during system boot. Ok sorry, I read too much quickly. What's the state of listening ports of bitcoind after the boot (before killing it) ? Did you try to force to bind, say, 127.0.0.1 with -rpcbind ? Did you check debug.log of bitcoind after the boot for any suspicious related messages ? Did you try to replace bitcoind by a shellscript to dump the network state at the bitcoind startup ? I'm thinking the network started by the dhcp process could not be completed yet. Title: Re: bitcoind upstart problem Post by: whywefight on March 22, 2018, 05:15:45 PM After boot:
Code: tcp 0 0 127.0.0.1:29000 0.0.0.0:* LISTEN - After kill: Code: tcp 0 0 127.0.0.1:29000 0.0.0.0:* LISTEN - Ahhhhh, what i now see is there is a binding on 18333 after boot (i am on testnet) and after my kill it switches to 18332. EDIT: Okay, i dont see why but somehow btcd is binding it self to 18333 for some reason. ill check my configs again Title: Re: bitcoind upstart problem Post by: starmyc on March 22, 2018, 06:04:30 PM After boot: Code: tcp 0 0 0.0.0.0:18333 0.0.0.0:* LISTEN - After kill: Code: tcp 0 0 127.0.0.1:18332 0.0.0.0:* LISTEN - Ahhhhh, what i now see is there is a binding on 18333 after boot (i am on testnet) and after my kill it switches to 18332. I'm reproducing the exact same problem on a raspberry pi. Interesting. I'll take a deeper look at it. Code: root@r01:/home/mycroft# netstat -nap|grep bitcoin|grep LISTEN Relevant debug lines: Code: 2018-03-22 18:02:25 libevent: getaddrinfo: address family for nodename not supported EDIT: Okay, i dont see why but somehow btcd is binding it self to 18333 for some reason. ill check my configs again It should listen both 18332 & 18333 ports on both ipv4 & ipv6. I think this is not a configuration problem, but a bug somewhere. Title: Re: bitcoind upstart problem Post by: whywefight on March 22, 2018, 06:15:00 PM After boot: Code: tcp 0 0 0.0.0.0:18333 0.0.0.0:* LISTEN - After kill: Code: tcp 0 0 127.0.0.1:18332 0.0.0.0:* LISTEN - Ahhhhh, what i now see is there is a binding on 18333 after boot (i am on testnet) and after my kill it switches to 18332. I'm reproducing the exact same problem on a raspberry pi. Interesting. I'll take a deeper look at it. Code: root@r01:/home/mycroft# netstat -nap|grep bitcoin|grep LISTEN Relevant debug lines: Code: 2018-03-22 18:02:25 libevent: getaddrinfo: address family for nodename not supported EDIT: Okay, i dont see why but somehow btcd is binding it self to 18333 for some reason. ill check my configs again It should listen both 18332 & 18333 ports on both ipv4 & ipv6. I think this is not a configuration problem, but a bug somewhere. Yeah you are correct, it should ofc bind to both. I just took a break and checked again and then i noticed rpc isnt binding it self. At least someone confirms the issue thanks :) this issue drives me crazy Title: Re: bitcoind upstart problem Post by: starmyc on March 22, 2018, 06:24:32 PM Yeah you are correct, it should ofc bind to both. I just took a break and checked again and then i noticed rpc isnt binding it self. At least someone confirms the issue thanks :) this issue drives me crazy You are not alone. This is a bug in libevent, but it seems the debian package on raspberry pi doesn't have the fix. Other people already reported it: * https://github.com/litecoin-project/litecoin/issues/351 * https://bitcointalk.org/index.php?topic=2345585.0 (that crontab fix is ... well ... kinda shitty). * .. and a lot of other links I already closed. :) Try this, in /etc/systemd/system/bitcoind.service: Code: [Unit] Instead of "After=network.target", use "After=multi-user.target". It will start the service after the boot sequence. Not sure it will work on your raspberry pi, but it worked on mine: Code: root@r01:/home/mycroft# netstat -nap|grep bitcoind|grep LISTEN Title: Re: bitcoind upstart problem Post by: whywefight on March 22, 2018, 06:37:07 PM Yeah you are correct, it should ofc bind to both. I just took a break and checked again and then i noticed rpc isnt binding it self. At least someone confirms the issue thanks :) this issue drives me crazy You are not alone. This is a bug in libevent, but it seems the debian package on raspberry pi doesn't have the fix. Other people already reported it: * https://github.com/litecoin-project/litecoin/issues/351 * https://bitcointalk.org/index.php?topic=2345585.0 (that crontab fix is ... well ... kinda shitty). * .. and a lot of other links I already closed. :) Try this, in /etc/systemd/system/bitcoind.service: Code: [Unit] Instead of "After=network.target", use "After=multi-user.target". It will start the service after the boot sequence. Not sure it will work on your raspberry pi, but it worked on mine: Code: root@r01:/home/mycroft# netstat -nap|grep bitcoind|grep LISTEN AWESOME! That did it! Thanks for helping me out :) |