1

Hello fellow bitcoiners,

I have a very annoying and mysterious issue with a bitcoind install. I had a blockchain corruption/stuck at some point. I deleted the old blockchain and copied an up-to-date blockchain from another machine. And now bitcoind does not succeed to run. When launched it complains about: "Cannot obtain a lock on wallet directory". I have deleted the .lock file, bitcoind obviously not running. After relaunch, the file gets created again. ps -aux | grep bitcoin returns no running process. bitoind starts (as a systemd service, which wasn't modified and run perfectly before, not in question). After the blockchain copy I chown the blockchain directory to the correct user on the target machine. I have enven tried chown 777 giving all possible rights on the blockchain directory. Still have the lock issue.

Here is the debug log:

2019-12-22T21:26:19Z Using data directory /usr/local/bitc/blockchain
2019-12-22T21:26:19Z Config file: /usr/local/bitc/blockchain/bitcoin.conf
2019-12-22T21:26:19Z Using at most 125 automatic connections (1024 file descriptors available)
2019-12-22T21:26:19Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-12-22T21:26:19Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-12-22T21:26:19Z Using 4 threads for script verification
2019-12-22T21:26:19Z scheduler thread start
2019-12-22T21:26:20Z HTTP: creating work queue of depth 16
2019-12-22T21:26:20Z No rpcpassword set - using random cookie authentication.
2019-12-22T21:26:20Z Generated RPC authentication cookie /usr/local/bitc/blockchain/.cookie
2019-12-22T21:26:20Z HTTP: starting 4 worker threads
2019-12-22T21:26:20Z Using wallet directory /usr/local/bitc/blockchain
2019-12-22T21:26:20Z init message: Verifying wallet(s)...
2019-12-22T21:26:20Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2019-12-22T21:26:20Z Using wallet /usr/local/bitc/blockchain
2019-12-22T21:26:20Z ERROR: Error while attempting to lock directory /usr/local/bitc/blockchain: Permission denied
2019-12-22T21:26:20Z Cannot obtain a lock on wallet directory /usr/local/bitc/blockchain. Another instance of bitcoin may be using it.
2019-12-22T21:26:20Z Error: Error initializing wallet database environment "/usr/local/bitc/blockchain"!
2019-12-22T21:26:20Z Shutdown: In progress...
2019-12-22T21:26:20Z scheduler thread interrupt
2019-12-22T21:26:20Z Shutdown: done

Does anyone has a clue?

Best regards, cr!ptal.

1 Answer 1

1

Make sure that there is no other instance of Bitcoin Core running on your system. Once you are absolutely sure that nothing else is using the data directory, delete the files named .lock and .walletlock within it. Then start Bitcoin Core.

3
  • As I wrote, ps -aux | grep bitcoin retuns no running bitcoind process. It is not a simple problem. I think it might come from a side effect of some issue and it reporteed as a lock problem, when it makes no sense - the .lock file is created. I delete it, restart, it is created again. There must be some silent error in the background. I have no idea where is the root problem...
    – sugarman
    Commented Dec 22, 2019 at 23:32
  • The .lock file is supposed to be created by bitcoind which will then remove it during the shut down process. The issue comes from the lock file being there when bitcoind is not running. You also need to remove the .walletlock file too.
    – Ava Chow
    Commented Dec 23, 2019 at 1:32
  • After looking at your debug.log snippet more closely, your error is actually due to the .walletlock file.
    – Ava Chow
    Commented Dec 23, 2019 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.