Bitcoin Forum
May 08, 2024, 10:42:32 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Cannot obtain a lock on data directory /home/ywn/btc_data.  (Read 132 times)
ywnasdzkd (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 4


View Profile
October 09, 2022, 04:01:05 AM
Merited by NotATether (2), ABCbits (1)
 #1

-------------------------------------------------------------------------------------------------------------------------------
ywn@ywn-virtual-machine:~/bitcoin/bin$ bitcoind -connect="18.214.92.184"
Error: Cannot obtain a lock on data directory /home/ywn/btc_data. Bitcoin Core is probably already running.
ywn@ywn-virtual-machine:~/bitcoin/bin$
------------------------------------------------------------------------------------------------------------------------------

The bitcoin node I deployed is running, and I use “ bitcoind -connect="18.214.92.184" ” command to connect to the new node,
 but the above error occurs. what do I do?
I know that connect can be set via config file bitcoin.conf, but I want to set connect dynamically with command.




Ubuntu18
Bitcoin Core version v0.20.1
It is a common myth that Bitcoin is ruled by a majority of miners. This is not true. Bitcoin miners "vote" on the ordering of transactions, but that's all they do. They can't vote to change the network rules.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5591


Self-proclaimed Genius


View Profile
October 09, 2022, 05:10:27 AM
Merited by hugeblack (2), NotATether (2), ABCbits (1)
 #2

Either close bitcoind first and start it with that -connect command line option...

Or use addnode RPC, use bitcoin-cli instead of bitcoind to use the command:
Code:
bitcoin-cli addnode "18.214.92.184:8333" "add"

But take note that addnode works differently than connect,
connect will exclusively use the selected node(s) while addnode will still enable your node to connect to other peers.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
October 09, 2022, 04:18:01 PM
 #3

I suggest redacting the IP address from your post if it belongs to a public network and isn't some loopback address like 127.0.0.1, or anything starting with 192.168.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
serhack
Member
**
Offline Offline

Activity: 107
Merit: 168

Security Researcher and Writer


View Profile WWW
October 09, 2022, 04:27:49 PM
 #4

-------------------------------------------------------------------------------------------------------------------------------
ywn@ywn-virtual-machine:~/bitcoin/bin$ bitcoind -connect="18.214.92.184"
Error: Cannot obtain a lock on data directory /home/ywn/btc_data. Bitcoin Core is probably already running.
ywn@ywn-virtual-machine:~/bitcoin/bin$
------------------------------------------------------------------------------------------------------------------------------

Identify all the Bitcoin core processes, kill those "gracely" and then follow the steps that other users indicated. Your device can not obtain a lock on the folder because another process is using it.

NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
October 09, 2022, 05:33:44 PM
 #5

Identify all the Bitcoin core processes, kill those "gracely" and then follow the steps that other users indicated. Your device can not obtain a lock on the folder because another process is using it.

Simply running bitcoin-cli stop in a terminal will shut it down. No process identification necessary.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
serhack
Member
**
Offline Offline

Activity: 107
Merit: 168

Security Researcher and Writer


View Profile WWW
October 09, 2022, 07:55:28 PM
Merited by NotATether (2), ABCbits (1)
 #6

Identify all the Bitcoin core processes, kill those "gracely" and then follow the steps that other users indicated. Your device can not obtain a lock on the folder because another process is using it.

Simply running bitcoin-cli stop in a terminal will shut it down. No process identification necessary.

Yes, another possibility. I think you should specify the custom datadir for that.

By the way, if I have more than one Bitcoin node running in the same machine, using that command, which node will be stopped?

NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
October 10, 2022, 03:32:36 AM
Merited by serhack (3), ABCbits (2)
 #7

Identify all the Bitcoin core processes, kill those "gracely" and then follow the steps that other users indicated. Your device can not obtain a lock on the folder because another process is using it.

Simply running bitcoin-cli stop in a terminal will shut it down. No process identification necessary.

Yes, another possibility. I think you should specify the custom datadir for that.

By the way, if I have more than one Bitcoin node running in the same machine, using that command, which node will be stopped?

The daemon which is listening on the RPC port that got the shutdown message.

Lets say that you have two daemons running, A and B, and you have the bitcoin.conf of node A listening on the default ports 8332/8333, and since you can't reuse the same config file for two different nodes (they must have different address/port combos) you set node B to listen on 9332/9333 through another Bitcoin.conf or you just pass those arguments on the command line. If you don't do this then it won't be able to bind the P2P & RPC ports in the first place.

- So you have a particular bitcoin-cli (possibly from another binary distribution)...
- ...hooked up to a particular RPC server port...
- ...that shuts down the Bitcoind daemon that spawned the RPC server on that port in the first place.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
serhack
Member
**
Offline Offline

Activity: 107
Merit: 168

Security Researcher and Writer


View Profile WWW
October 10, 2022, 01:45:44 PM
 #8

Identify all the Bitcoin core processes, kill those "gracely" and then follow the steps that other users indicated. Your device can not obtain a lock on the folder because another process is using it.

Simply running bitcoin-cli stop in a terminal will shut it down. No process identification necessary.

Yes, another possibility. I think you should specify the custom datadir for that.

By the way, if I have more than one Bitcoin node running in the same machine, using that command, which node will be stopped?

The daemon which is listening on the RPC port that got the shutdown message.

Lets say that you have two daemons running, A and B, and you have the bitcoin.conf of node A listening on the default ports 8332/8333, and since you can't reuse the same config file for two different nodes (they must have different address/port combos) you set node B to listen on 9332/9333 through another Bitcoin.conf or you just pass those arguments on the command line. If you don't do this then it won't be able to bind the P2P & RPC ports in the first place.

- So you have a particular bitcoin-cli (possibly from another binary distribution)...
- ...hooked up to a particular RPC server port...
- ...that shuts down the Bitcoind daemon that spawned the RPC server on that port in the first place.

Thanks for the explanation!

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!