I want to see if a given string ("hello"
in this case) is accessible via IPFS. I am trying this:
echo hello | ipfs add -nq | ipfs cat
I am getting this:
Error: lock /root/.ipfs/repo.lock: someone else has the lock
What's going on? Is there a global lock, or is IPFS just protecting itself from a race condition that could have happened if I hadn't specified the -n
flag?
This seems to work:
HASH=`echo hithere | ipfs add -nq` && ipfs cat $HASH
However, I wonder whether there is a more idiomatic way. This must be a fairly standard thing to do.
Your daemon is not running, so both
ipfs add
andipfs cat
tries to start an offline daemon at the same time which doesn't work (only one daemon per IPFS_PATH can run).You need to run
ipfs daemon
in the background first, so then the commands will just hitipfs daemon
's API instead of starting their own daemon.Yes because you are using
&&
which schedule them to wait on each other first.