kristapsk/raspibolt-extras

jmclient.jsonrpc.JsonRpcConnectionError: authentication for JSON-RPC failed

Closed this issue · 8 comments

I am was trying to update from Joinmarket 0.6.1 to 0.6.2. The previous version was running fine. It was set up on an older version of RaspiBolt, where the symbolic links to the external HDD were a bit different, and there were some differences to the current version regarding the "admin" user, but I don't recall the details, just mentioning it here in case it is important in solving my issue. In any case, I wasn't able to adjust the JM update to my older version of RaspiBolt and decided to follow the Joinmarket setup guide just as it is (assuming that in the worst case I can just re-import my JM wallet backup into the new installation)

The installation itself seemed to went fine, but my issue now is that at the step of "first run" after installation I am encountering the following errors:

$ python wallet-tool.py generate

User data location: /home/pi/.joinmarket/
Traceback (most recent call last):
File "wallet-tool.py", line 6, in
jmprint(wallet_tool_main("wallets"), "success")
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/wallet_utils.py", line 1191, in wallet_tool_main
load_program_config(config_path=options.datadir)
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/configure.py", line 505, in load_program_config
global_singleton.config)
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/configure.py", line 570, in get_blockchain_interface_instance
bc_interface = BitcoinCoreInterface(rpc, network)
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/blockchaininterface.py", line 166, in init
blockchainInfo = self.jsonRpc.call("getblockchaininfo", [])
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/jsonrpc.py", line 145, in call
response = self.queryHTTP(request)
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/jsonrpc.py", line 103, in queryHTTP
raise exc
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/jsonrpc.py", line 91, in queryHTTP
"authentication for JSON-RPC failed")
jmclient.jsonrpc.JsonRpcConnectionError: authentication for JSON-RPC failed

I manually created a new joinmarket.cfg file in the /home/bitcoin/.joinmarket folder, entering my RPC user and password (doublechecked that it is correct), but the issue persists. Any ideas how to proceed would be much appreciated :)

User data location: /home/pi/.joinmarket/, but you created new joinmarket.cfg in the /home/bitcoin/.joinmarket, I think that's the issue. You should run JM tools from bitcoin user, not pi user.

The problem when I am installing JM from bitcoin user (as in says in the guide), I encounter the error bitcoin is not in the sudoers file. This incident will be reported.. So I installed JM as pi user, but then always used JM as bitcoin user, which worked fine until now. I guess that's the general issue of having the older version of Raspibolt.

But your hint was actually on point! I got it to work now simply by editing the joinmarket.cfg file in the /home/pi/.joinmarket/ path appropriately, and I could get JM to start and also to recover my wallet. Phew! :)

The next issue now is that I cannot start the yield generator from the bitcoin user anymore (it worked in the past):

$ python yg-privacyenhanced.py wallet.jmdat
User data location: /home/bitcoin/.joinmarket/
Traceback (most recent call last):
File "yg-privacyenhanced.py", line 95, in
minsize=minsize, gaplimit=gaplimit)
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/yieldgenerator.py", line 240, in ygmain
load_program_config(config_path=options.datadir)
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/configure.py", line 438, in load_program_config
os.makedirs(os.path.join(global_singleton.datadir, "wallets"))
File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmvenv/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/bitcoin/.joinmarket/wallets'

But I still can start it from the pi user. Is there any potential danger in doing so?

I guess the alternative to that workaround is to set up the whole Raspibolt from scratch following the current version of the guide (so I won't have the issues with different accounts anymore), but this would be a bit of a bigger project and quite time intensive, I guess...

Many thanks for your help in any case, much appreciated :)

The problem when I am installing JM from bitcoin user (as in says in the guide), I encounter the error bitcoin is not in the sudoers file. This incident will be reported.

You probably didn't run required sudo apt-get install ... commands from admin user. Or there is some missins dependency in the list, that should be added to the guide. That error just says that bitcoin user is not allowed to install system wide pakages and it is right way from the security perspective.

PermissionError: [Errno 13] Permission denied: '/home/bitcoin/.joinmarket/wallets'

It means JM does not have permissions to access wallets directory. Probably related with you mixing together various users. Try from admin user: sudo chown -R bitcoin:bitcoin /home/bitcoin/.joinmarket/.

The problem when I am installing JM from bitcoin user (as in says in the guide), I encounter the error bitcoin is not in the sudoers file. This incident will be reported.

You probably didn't run required sudo apt-get install ... commands from admin user. Or there is some missins dependency in the list, that should be added to the guide.

No, I used the sudo command when installing (otherwise there were some errors), so probably it's more an issue of missing dependency or something else.

Try from admin user: sudo chown -R bitcoin:bitcoin /home/bitcoin/.joinmarket/.

Yes, that helped, thank you! FWIW, when I ran that command and tried to open my wallet, it resulted in the error message Exception: Failed to open wallet at '/home/bitcoin/.joinmarket/wallets/wallet.jmdat': not a file, but after recovering the wallet once again everything seems to run smoothly now, so I guess my issue is fixed.

Many thanks :)

After leaving the yieldgenerator running for a while, I came back to it displaying these error messages:

File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmvenv/lib/python3.5/site-packages/twisted/protocols/amp.py", line 1166, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmvenv/lib/python3.5/site-packages/twisted/python/failure.py", line 460, in ttrap self.raiseException() File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmvenv/lib/python3.5/site-packages/twisted/python/failure.py", line 488, in rraiseException raise self.value.with_traceback(self.tb) File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmvenv/lib/python3.5/site-packages/twisted/internet/defer.py", line 151, in mmaybeDeferred result = f(*args, **kw) File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmdaemon/jmdaemon/daemon_protocol.py", line 312, in on_JM_IOAUTH check_utxo_blacklist(self.active_orders[nick]["commit"], persist=True) File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmdaemon/jmdaemon/daemon_protocol.py", line 79, in check_utxo_blacklist with open(fname, "wb") as f: builtins.PermissionError: [Errno 13] Permission denied: 'commitmentlist'

Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commannds! Traceback (most recent call last): --- <exception caught here> --- File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmvenv/lib/python3.5/site-packages/twisted/internet/defer.py", line 654, in __runCallbacks current.result = callback(current.result, *args, **kw) File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmclient/jmclient/client_protocol.py", line 50, in defaultErrback ConnectionLost) #pragma: no cover File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmvenv/lib/python3.5/site-packages/twisted/python/failure.py", line 460, in ttrap self.raiseException() File "/home/bitcoin/joinmarket-clientserver-0.6.2/jmvenv/lib/python3.5/site-packages/twisted/python/failure.py", line 488, in rraiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error

I restarted it and it looks like it's running as usual now. Is this something to worry about, and can it be caused by the different accounts (seeing that there is a line saying something about "permission denied"), or is it something Joinmarket specific?

It's another issue related to mixed permissions of your setup, but also minor bug in latest release of JM. Fast fix for you now will be to do from admin user sudo chown -R bitcoin:bitcoin /home/bitcoin/joinmarket-clientserver-0.6.2/scripts.

Closing this, assuming everything is ok now.

Yep, everything looks fine now, thanks again for your help :)