lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.67k stars 2.07k forks source link

LND ignores custom datadir #8285

Closed whatafuiamdoing closed 10 months ago

whatafuiamdoing commented 10 months ago

Discussed in https://github.com/lightningnetwork/lnd/discussions/8284

Originally posted by **mxlison** December 16, 2023 ### **Issue** **First case** When running 2 nodes simultaneously, the second node returns an error: unable to open databases: unable to obtain database backends: error opening bolt DB: timeout Created data directories for both nodes in `C:\Users\****\AppData\Local\Lnd\lnd.conf` & `C:\Users\****\AppData\Local\Lnd-2\lnd.conf,` and 2 directories for lnd node: AppData: Local: lnd-windows-amd64-v0.1-beta: lnd.exe lncli.exe lnd-windows-amd64-v0.1-beta2: lnd.exe lncli.exe Running 1 node `lnd.exe --rpclisten=127.0.0.1:10001 --listen=127.0.0.1:10011 --restlisten=localhost:8001` succesfully, but when i try to run second node `lnd.exe --rpclisten=127.0.0.1:10002 --listen=127.0.0.1:10012 --restlisten=localhost:8002 --datdir="C:\Users\*****\AppData\Local/Lnd-2"`, get an error: **unable to open databases: unable to obtain database backends: error opening bolt DB: timeout**. Lnd ignores ---datadir flag and interact with default LND dir. ``` lnd.conf [Bitcoin] bitcoin.active=1 bitcoin.node=bitcoind bitcoin.regtest=1 [bitcoind] bitcoind.rpcuser=****** bitcoind.rpcpass=****** bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333 [Application Options] externalip=145.145.145.145 color=#FF9900 alias=NodeA datadir=data ``` **Second case** Creating 2 directories ` [Direcotry 1] Lnd: lnd.exe lncli.exe lnd.conf [Directory 2] Lnd-2: lnd.exe lncli.exe lnd.conf ` lnd.conf ` debuglevel=debug alias=NodeA maxpendingchannels=10 color=#eeeeee rpclisten=0.0.0.0:10100 restlisten=0.0.0.0:8090 listen=9736 externalip=127.0.0.1:9736 datadir=./ tlskeypath=./tls.key adminmacaroonpath=./data/chain/regtest/admin.macaroon bitcoin.active=1 bitcoin.regtest=1 bitcoin.node=bitcoind bitcoind.rpcuser=****** bitcoind.rpcpass=****** bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333` running with `lnd --configfile=./lnd.conf` the same issue
hellresistor commented 10 months ago

--datdir="C:\Users*****\AppData\Local/Lnd-2" /\__ datadir?!? ___/\__ ???

'lnd --configfile=./lnd.conf' to me is a linux command.. not wind0s

guggero commented 10 months ago

If you supply --datadir as a command line parameter, you should not also have it in your config file. Try again by removing datadir=./. Also, you shouldn't use relative paths in your lnd.conf, as those will always be relative to the directory you run the lnd.exe command from. You can use ~/ as a placeholder for C:\Users\**** to shorten the paths somewhat.

guggero commented 10 months ago

Since there's already a discussion item created for this and I'm pretty sure this isn't a bug with the --datadir parameter itself, I'm closing this issue and will cross post my answer above on the discussion too.