Title: Cannot run bitcoin-cli Post by: notooth on October 27, 2017, 06:22:35 AM Hi everyone,
I cannot get the bitcoin-cli work. Here is what I did: Quote Content of bitcoin.conf: daemon=1 server=1 rpcuser=myusername rpcpassword=mypassword12345 rpcport=8332 rpcconnect=127.0.0.1 Quote $ bitcoind Bitcoin server starting $ bitcoin-cli getblockchaininfo error: couldn't connect to server: unknown (code -1) (make sure server is running and you are connecting to the correct RPC port) Can anyone help? :) Title: Re: Cannot run bitcoin-cli Post by: mattxlee on October 27, 2017, 06:28:51 AM You have setup a password for your RPC connection, that means you need provide the same username/password to run bitcoin-cli in command line. You just simply remove your bitcoin.conf or rename it then shutdown bitcoind and start it again.
[move bitcoin.conf to another name] bitcoin-cli stop bitcoind --daemon [wait a while when the program warm up] bitcoin-cli getblockchaininfo Title: Re: Cannot run bitcoin-cli Post by: notooth on October 27, 2017, 07:53:48 AM I renamed bitcoin.conf to bitcoin.conf1, reboot the system, and I still got the same error:
Quote $ bitcoind --daemon Bitcoin server starting [The server started immediately] $ bitcoin-cli getblockchaininfo error: couldn't connect to server: unknown (code -1) (make sure server is running and you are connecting to the correct RPC port) Title: Re: Cannot run bitcoin-cli Post by: mattxlee on October 27, 2017, 08:16:07 AM Maybe you need to check debug.log and see what happened.
I renamed bitcoin.conf to bitcoin.conf1, reboot the system, and I still got the same error: Quote $ bitcoind --daemon Bitcoin server starting [The server started immediately] $ bitcoin-cli getblockchaininfo error: couldn't connect to server: unknown (code -1) (make sure server is running and you are connecting to the correct RPC port) Title: Re: Cannot run bitcoin-cli Post by: lucas2008 on October 27, 2017, 08:39:22 AM Take a look at your debug.log. :'( :'( :'( :'( :'( Title: Re: Cannot run bitcoin-cli Post by: mocacinno on October 27, 2017, 08:43:35 AM execute following commands, and post the outcome(exept from the last command, you'll have to use ctrl-c to stop it), remove the password from the bitcoin.conf output :
Code: ps -ef | grep bitcoind normally, you do not have to enter any credentials when using bitcoin-cli, as long as you're using the same user that was used to run the daemon. Unless, offcourse, you changed your bitcoin.conf AFTER you started the daemon. In this case, the daemon will run with the old bitcoin.conf parameters, while bitcoin-cli will use the new parameters. If you enter daemon=1 in your bitcoin.conf, the startup parameter --daemon is no longer needed (but i does no harm). If you use the default rpc port, there is no need to redefine it in your bitcoin.conf (but it does no harm) Title: Re: Cannot run bitcoin-cli Post by: notooth on October 27, 2017, 08:56:42 AM I forgot to mention that the OS is OpenBSD. Here is the output:
Quote $ ps -ef | grep bitcoind ps: unknown option -- f usage: ps [-AaceHhjkLlmrSTuvwx] [-M core] [-N system] [-O fmt] [-o fmt] [-p pid] [-t tty] [-U username] [-W swap] notooth@Z220.my.domain /home/notooth $ netstat -tulpn | grep 8332 netstat: n: unknown protocol notooth@Z220.my.domain /home/notooth $ tail -n 100 ~/.bitcoin/debug.log 2017-10-27 05:08:37 Bitcoin version v0.15.0.1-gfb7b5293844 2017-10-27 05:08:37 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1 2017-10-27 05:08:37 Assuming ancestors of block 0000000000000000003b9ce759c2a087d52abc4266f8f4ebd6d768b89defa50a have valid signatures. 2017-10-27 05:08:37 Using the 'standard' SHA256 implementation 2017-10-27 05:08:37 Default data directory /home/notooth/.bitcoin 2017-10-27 05:08:37 Using data directory /home/notooth/.bitcoin 2017-10-27 05:08:37 Using config file /home/notooth/.bitcoin/bitcoin.conf 2017-10-27 05:08:37 Using at most 125 automatic connections (512 file descriptors available) 2017-10-27 05:08:37 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements 2017-10-27 05:08:37 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements 2017-10-27 05:08:37 Using 4 threads for script verification 2017-10-27 05:08:37 scheduler thread start 2017-10-27 05:08:37 HTTP: creating work queue of depth 16 2017-10-27 05:08:37 Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation. 2017-10-27 05:08:37 HTTP: starting 4 worker threads 2017-10-27 05:08:37 Cache configuration: 2017-10-27 05:08:37 * Using 2.0MiB for block index database 2017-10-27 05:08:37 * Using 8.0MiB for chain state database 2017-10-27 05:08:37 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space) 2017-10-27 05:08:37 init message: Loading block index... 2017-10-27 05:08:37 Opening LevelDB in /home/notooth/.bitcoin/blocks/index 2017-10-27 05:08:37 Opened LevelDB successfully 2017-10-27 05:08:37 Using obfuscation key for /home/notooth/.bitcoin/blocks/index: 0000000000000000 2017-10-27 05:08:37 LoadBlockIndexDB: last block file = 0 2017-10-27 05:08:37 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01) 2017-10-27 05:08:37 Checking all blk files are present... 2017-10-27 05:08:37 LoadBlockIndexDB: transaction index disabled 2017-10-27 05:08:37 Initializing databases... 2017-10-27 05:08:37 Pre-allocating up to position 0x1000000 in blk00000.dat 2017-10-27 05:08:37 Opening LevelDB in /home/notooth/.bitcoin/chainstate 2017-10-27 05:08:37 Opened LevelDB successfully 2017-10-27 05:08:37 Using obfuscation key for /home/notooth/.bitcoin/chainstate: 91009803d3a76d45 2017-10-27 05:08:37 init message: Rewinding blocks... 2017-10-27 05:08:37 block index 188ms 2017-10-27 05:08:37 No wallet support compiled in! 2017-10-27 05:08:37 UpdateTip: new best=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2009-01-03 18:15:05' progress=0.000000 cache=0.0MiB(0txo) 2017-10-27 07:32:05 2017-10-27 07:32:05 Bitcoin version v0.15.0.1-gfb7b5293844 2017-10-27 07:32:05 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1 2017-10-27 07:32:05 Assuming ancestors of block 0000000000000000003b9ce759c2a087d52abc4266f8f4ebd6d768b89defa50a have valid signatures. 2017-10-27 07:32:05 Using the 'standard' SHA256 implementation 2017-10-27 07:32:05 Default data directory /home/notooth/.bitcoin 2017-10-27 07:32:05 Using data directory /home/notooth/.bitcoin 2017-10-27 07:32:05 Using config file /home/notooth/.bitcoin/bitcoin.conf 2017-10-27 07:32:05 Using at most 125 automatic connections (512 file descriptors available) 2017-10-27 07:32:05 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements 2017-10-27 07:32:05 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements 2017-10-27 07:32:05 Using 4 threads for script verification 2017-10-27 07:32:05 scheduler thread start 2017-10-27 07:32:05 HTTP: creating work queue of depth 16 2017-10-27 07:32:05 No rpcpassword set - using random cookie authentication 2017-10-27 07:32:05 Generated RPC authentication cookie /home/notooth/.bitcoin/.cookie 2017-10-27 07:32:05 HTTP: starting 4 worker threads 2017-10-27 07:32:05 Cache configuration: 2017-10-27 07:32:05 * Using 2.0MiB for block index database 2017-10-27 07:32:05 * Using 8.0MiB for chain state database 2017-10-27 07:32:05 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space) 2017-10-27 07:32:05 init message: Loading block index... 2017-10-27 07:32:05 Opening LevelDB in /home/notooth/.bitcoin/blocks/index 2017-10-27 07:32:05 Opened LevelDB successfully 2017-10-27 07:32:05 Using obfuscation key for /home/notooth/.bitcoin/blocks/index: 0000000000000000 2017-10-27 07:32:05 LoadBlockIndexDB: last block file = 0 2017-10-27 07:32:05 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01) 2017-10-27 07:32:05 Checking all blk files are present... 2017-10-27 07:32:05 LoadBlockIndexDB: transaction index disabled 2017-10-27 07:32:05 Initializing databases... 2017-10-27 07:32:05 Pre-allocating up to position 0x1000000 in blk00000.dat 2017-10-27 07:32:06 Opening LevelDB in /home/notooth/.bitcoin/chainstate 2017-10-27 07:32:06 Opened LevelDB successfully 2017-10-27 07:32:06 Using obfuscation key for /home/notooth/.bitcoin/chainstate: 91009803d3a76d45 2017-10-27 07:32:06 init message: Rewinding blocks... 2017-10-27 07:32:06 block index 136ms 2017-10-27 07:32:06 No wallet support compiled in! 2017-10-27 07:32:06 UpdateTip: new best=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2009-01-03 18:15:05' progress=0.000000 cache=0.0MiB(0txo) notooth@Z220.my.domain /home/notooth $ id uid=1000(notooth) gid=1000(notooth) groups=1000(notooth), 0(wheel) notooth@Z220.my.domain /home/notooth $ who notooth ttyC0 Oct 27 14:31 notooth@Z220.my.domain /home/notooth $ whoami notooth notooth@Z220.my.domain /home/notooth $ which bitcoind /usr/local/bin/bitcoind notooth@Z220.my.domain /home/notooth $ which bitcoin-cli /usr/local/bin/bitcoin-cli notooth@Z220.my.domain /home/notooth $ tail -f ~/.bitcoin/debug.log 2017-10-27 07:32:05 LoadBlockIndexDB: transaction index disabled 2017-10-27 07:32:05 Initializing databases... 2017-10-27 07:32:05 Pre-allocating up to position 0x1000000 in blk00000.dat 2017-10-27 07:32:06 Opening LevelDB in /home/notooth/.bitcoin/chainstate 2017-10-27 07:32:06 Opened LevelDB successfully 2017-10-27 07:32:06 Using obfuscation key for /home/notooth/.bitcoin/chainstate: 91009803d3a76d45 2017-10-27 07:32:06 init message: Rewinding blocks... 2017-10-27 07:32:06 block index 136ms 2017-10-27 07:32:06 No wallet support compiled in! 2017-10-27 07:32:06 UpdateTip: new best=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2009-01-03 18:15:05' progress=0.000000 cache=0.0MiB(0txo) ^C Title: Re: Cannot run bitcoin-cli Post by: mocacinno on October 27, 2017, 08:58:31 AM Sorry, i tought you were running linux (not many people on this forum run openBSD, so i wrongfully assumed you ran linux), but most of my commands don't work on BSD... I'll update this post in a couple of minutes with compatible commands.
What i already see is that since you first posted a debug.log, it seems your daemon stopped synchronising. My best guess would be that bitcoind was killed for some reason. Edit The FreeBSD (hopefully also openBSD) alternative of my question: Code: ps -auxw | grep bitcoind Title: Re: Cannot run bitcoin-cli Post by: notooth on October 27, 2017, 09:20:49 AM The output exceeds the maximum allowed length of this forum, so I upload the output to this file:
http://www.mediafire.com/?1v9640mgq9a9w (http://www.mediafire.com/?1v9640mgq9a9w) Title: Re: Cannot run bitcoin-cli Post by: mocacinno on October 27, 2017, 09:33:13 AM The output exceeds the maximum allowed length of this forum, so I upload the output to this file: http://www.mediafire.com/?1v9640mgq9a9w (http://www.mediafire.com/?1v9640mgq9a9w) Seems like sockstat doesn't exist on openBSD either ;D Doesn't matter, this is all we need to know: Quote $ ps -auxw | grep bitcoind notooth 6491 0.0 0.0 308 1308 p0 S+p 4:08PM 0:00.00 grep bitcoind bitcoind is no longer running... I already had the gut feeling we would see this output, since there were no new lines in your debug.log However, as to why it stopped... That's a different question... I don't see anything significant in dmesg. Is there still space on your disk? df -g => look for the partition that holds your home Other than that, you can look at the system logs, and see if there's something in there Or, maybe you can run bitcoind on the foreground in a different terminal, and see if there is output when/if it's killed (just put a # in front of daemon=1 in your bitcoin.conf and start the daemon without the --daemon option) Title: Re: Cannot run bitcoin-cli Post by: achow101 on October 27, 2017, 06:44:03 PM Use multiple terminals and remove daemon=1 from your bitcoin.conf file. When bitcoind crashes (probably a segmentation fault), the error will be printed to the terminal that it is running in. With daemon=1, we won't be able to see what that error is.
Also, did you compile this yourself? If you did, what exactly were the commands that you ran? If you did, did you make any changes to the code, and if so, what were they? Title: Re: Cannot run bitcoin-cli Post by: notooth on October 28, 2017, 03:13:43 AM I did exactly the steps in bitcoin-master/doc/build-openbsd.md. I did not change any code. Here is the output on the terminal:
Quote $ bitcoind bitcoind(67438) in free(): chunk is already free 0xdc658915450 bitcoind(67438) in unknown(): bogus pointer (double free?) 0xdfdfdfdfdfdfdfdf Abort trap (core dumped) |