Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Asaf1993 on June 13, 2018, 09:47:47 AM



Title: CLI issues in linux
Post by: Asaf1993 on June 13, 2018, 09:47:47 AM
Hey!
I am using both bitcoin-cli and litecoin-cli on different VM's (Ubuntu) on both of them I have node (Bitcoin core & Litecoin core).
Within the VM's the blockcahin is stored on 1 partition and the CLI on a different one.
The blockchain partition is mounted to the main partition (where the CLI is stored).
I placed both .conf files in the corresponding dirs -> ~/.bitcoin & ~/.litecoin.
.conf:
testnet=1
rpcuser=user
rpcpassword=password
rpcallowip=0.0.0.0/0
rpcbind=0.0.0.0
daemon=1
For some reason I can't get access to CLI commands.
When running normal CLI call this is the output:
command: bitcoin-cli getnetworkinfo
output:  error: Could not connect to the server 127.0.0.1:18332
Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
when running:
command: bitcoin-cli -rpcport=8332 getnetworkinfo
output: error: Authorization failed: Incorrect rpcuser or rpcpassword
There r two users in the system:
root and bitcoinuser/litecoinuser (in sudoers group)

Can someone point out what am I doing wrong?

TNX!


Title: Re: CLI issues in linux
Post by: pebwindkraft on June 13, 2018, 12:49:31 PM
Ok, just to understand further: your root is on one partition, containing e.g. /usr/local/bin, with the binaries of bitcoin, and there is a separate home Partition, which is mounted into root? Maybe show us fstab? And the full path to the bitcoin.conf file. And which user executes bitcoin-cli?
Btw: Ubuntu/Debian/SuSE/Redhat?
Who is running he bitcoin daemon? (Show how you started bitcoin...). Anything you could see in the log files? Is „ps aux“ showing bitcoind is running?
If testnet =1, then ports are correct (Default RPC connection port is 18332). However 8332 doesn‘t look like testnet, it would be mainnet. Maybe the executables don’t find the path to the correct conf file(s)...


Title: Re: CLI issues in linux
Post by: aleksej996 on June 13, 2018, 08:42:55 PM
I thought that you need to run "-testnet" when you start bitcoin-cli, since I don't think it is aware of the configurations for the daemon on it's own.
Although I don't understand why it would connect to 18332 then.

Make sure you have a bitcoin.conf file with right permissions in .bitcoin and run "bitcoin-cli -testnet -rpcuser=user -rpcpassword=password".
Other than that you might want to check out debug.log file if you are still having issues. It is in the .bitcoin directory as well.


Title: Re: CLI issues in linux
Post by: Asaf1993 on June 17, 2018, 12:37:42 PM
Got it figured eventually,
There was a problem with the location of the .conf file.

TNX any way for the help!