Author

Topic: Lnd.exe error: 'loadConfig: Failed to create lnd directory: mkdir ...' (Read 269 times)

jr. member
Activity: 34
Merit: 6
It would be great if you could share your experience of running a Lightning Network node after 1 month in this thread. Nobody has shared statistics of a node which is hidden behind the Tor network, yet. Would you mind if ask you a few questions regarding the setup of such node? I would like to write a tutorial so that other people could easily setup their LN node which would connect through the Tor network on Windows.

Absolutely! Let's talk!
legendary
Activity: 1876
Merit: 3132
I started this journey to a Lightning Node on November 24th, and now have a fully working Lnd Node running over the Tor network! I had never used Tor before.

It would be great if you could share your experience of running a Lightning Network node after 1 month in this thread. Nobody has shared statistics of a node which is hidden behind the Tor network, yet. Would you mind if ask you a few questions regarding the setup of such node? I would like to write a tutorial so that other people could easily setup their LN node which would connect through the Tor network on Windows.
jr. member
Activity: 34
Merit: 6
(renaming the file to lnd.conf from lnd.conf.txt will do the trick once you change that setting)

This worked great, got rid of the warning! Thanks!

Your machine refuses the connection at port 9051.

Can you verify that the tor service is running at this port ?

I believe the standard port for tor is 9001 and 9051. But this can be freely changed. It is just important that you connect to the same port where tor is listening.

I got it working!

Here is what I did in case anybody in the future runs into the same issues that I do  Grin



I was able to confirm my tor service was running by launching run and typing 'services.msc'. I then scrolled down to confirm that 'Tor Win32 Service' was running.

Tor is running. Is my port open? Let's see!

I launched cmd as Administrator and ran the command
Code:
netstat -anb

I confirmed the port was open by scrolling up to my desired port number (127.0.0.1:9051) and ensuring the port's state was set to 'LISTENING'

So I confirmed the port was listening properly, so why was I still getting this error?

Code:
2018-12-02 18:14:38.452 [INF] LTND: Shutdown complete
unable to connect to Tor server: dial tcp 127.0.0.1:9051: connectex: No connection could be made because the target machine actively refused it.

I launched my Bitcoin Core Full Node launch using run with the commands/flags:

"C:\Program Files\Bitcoin\bitcoin-qt.exe" -txindex=1 -zmqpubrawblock=tcp://127.0.0.1:9051 -zmqpubrawtx=tcp://127.0.0.1:18504 -rpcuser=ezra -rpcpassword=Bignoodles -server=1 -rpcallowip=127.0.0.1

I then launched Powershell as administrator and started lnd.exe using this command with flags:

.\lnd.exe --bitcoin.active --bitcoin.mainnet --bitcoin.node=bitcoind --bitcoind.rpchost=127.0.0.1 --bitcoind.rpcuser=ezra --bitcoind.rpcpass=Bignoodles --bitcoind.zmqpubrawblock=tcp://127.0.0.1:9051 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:18504 --debuglevel=info --rpclisten=localhost:10012


I can now connect to the Lightning Network & connect to peers!

However, lncli freezes when I try to open a channel with a peer. I believe this is due to the fact that I didn't receive a 'Uris' ID

To fix this, I went into %localappdata% and found my lnd.conf, and added the flag:

Code:
externalip=7p70tghbgasedo0.onion

MyIP is the same as my Bitcoin Core Full Node's IP address

Unfortunately at this point my lncli through Powershell would not be able to open a channel and would freeze every time I attempted.
I went over to the LND dev Slack, and they let me know I should be using Command Line instead of Powershell, and guess what!

It WORKS!



I started this journey to a Lightning Node on November 24th, and now have a fully working Lnd Node running over the Tor network! I had never used Tor before. Because of Lightning and the Bitcoin Core Full Node I learned so much about my computer (I thought I knew so much, I now know how much I have to learn Shocked) Thank you to @bob123 & @BitCryptex for helping me out, you are great! Also couldn't have done it without the LND Slack or Pierre Rochard on Twitter

legendary
Activity: 1624
Merit: 2481
Code:
2018-12-02 18:14:38.450 [ERR] SRVR: unable to start server: unable to connect to Tor server: dial tcp 127.0.0.1:9051: connectex: No connection could be made because the target machine actively refused it.

2018-12-02 18:14:38.452 [INF] LTND: Shutdown complete
unable to connect to Tor server: dial tcp 127.0.0.1:9051: connectex: No connection could be made because the target machine actively refused it.


Your machine refuses the connection at port 9051.

Can you verify that the tor service is running at this port ?

I believe the standard port for tor is 9001 and 9051. But this can be freely changed. It is just important that you connect to the same port where tor is listening.
jr. member
Activity: 34
Merit: 6
As for the Tor connection error, try disabling Windows firewall for a moment. If it works, you will have to add proper exceptions.

I disabled my Firewall, still the same result

Code:
2018-12-02 18:14:38.450 [ERR] SRVR: unable to start server: unable to connect to Tor server: dial tcp 127.0.0.1:9051: connectex: No connection could be made because the target machine actively refused it.

2018-12-02 18:14:38.452 [INF] LTND: Shutdown complete
unable to connect to Tor server: dial tcp 127.0.0.1:9051: connectex: No connection could be made because the target machine actively refused it.

I am continuing my search now
legendary
Activity: 1876
Merit: 3132
I went into that directory and created a new txt file named 'lnd.conf', But I believe the computer saves it as lnd.conf.txt, resulting in this warning.

Download Notepad++ or Sublime Text 3 if you don't want to change the visibility of known extensions in the explorer settings (renaming the file to lnd.conf from lnd.conf.txt will do the trick once you change that setting). As for the Tor connection error, try disabling Windows firewall for a moment. If it works, you will have to add proper exceptions.
jr. member
Activity: 34
Merit: 6

I was not, I have been using the browser meaning the browser had to be open for traffic to be routed, which is not recommended according to @cellard from this post (6th reply)

So, you are trying to use the bundled Tor from Tor Browser rather than a dedicated Tor daemon?  This is not recommended.

IIRC, the default TCP port for Tor Browser’s Tor’s SOCKSPort is 127.0.0.1:9150, which explains why Bitcoin could not connect to port 9050.  On Linux, at least, recent versions of Tor Browser may even use a UNIX domain socket rather than a TCP socket.  But I’m not even sure what it does by default, since I use Tor Browser with an external Tor daemon on a network-isolating gateway.  I would need to search—I recommend that you do so, if you really want to use Tor Browser’s Tor.

If you want to add another SOCKSPort to Tor Browser, look for Browser/TorBrowser/Data/Tor/torrc.  See the Tor manual page for documentation of SOCKSPort.  Be aware that this will probably (?) be wiped out when you upgrade Tor Browser.

It is strongly recommended that you set up a separate Tor daemon for your Bitcoin.  I recommend doing so on a gateway which isolates the internal network; this affirmatively prevents all leaks of your “real” IP address, whether malicious or accidental.  Many applications leak horribly, doing direct DNS lookups even when they purport to accept SOCKS proxy settings.  You can set up a Tor gateway on a cheap computer with two Ethernet ports, or using VMs within the same physical machine.  On FreeBSD, the jail subsystem provides a lightweight means to achieve this.  N.b. that if you use a separate Tor daemon with Tor Browser, it requires some muttered incantations to disable Tor Browser’s bundled Tor; and you must do this to avoid “Tor-over-Tor”, which will harm your anonymity as well as killing performance.


I followed the guide you linked, and my method was a little bit different than in the guide. I had to open up command prompt as administrator, and change directory to my Tor file
Code:
cd C:\Users\Ezra\Desktop\Tor Browser\Browser\TorBrowser\Tor

and THEN I was able to create the tor service
Code:
tor.exe -install service

For me it did not work unless I was running cmd as administrator

Don't forget to actually run tor.exe before launching the Full Node

Thank you for the link, that helped me solve a problem I would eventually run into.

Are you running the commands with an administrator account?
It can't find lnd.exe because it is not in the current directory. Navigate to the directory where the .exe is placed (seems to be C:\Users\Ezra\), then try it again.

Lol, duh. Thank you Smiley Helped me fix that pretty quickly. Running Powershell as admin, and going to the correct directory got rid of all the mkdir issues I was getting.

New Errors

So it seems my initial two errors are fixed. Now I have one error and a warning that I am worried about

Currently I am hung up on this error

My lnd.exe command with flags:

Code:
.\lnd.exe --bitcoin.active --bitcoin.mainnet --bitcoin.node=bitcoind --bitcoind.rpchost=127.0.0.1 --bitcoind.rpcuser=ezra --bitcoind.rpcpass=Bignoodles --bitcoind.zmqpubrawblock=tcp://127.0.0.1:18503 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:18504 --debuglevel=info --listen=localhost --tor.active --tor.streamisolation --tor.v3 listen=localhost

It catches up to the block hashes fine, but when (what I assume is) getting Lightning Network channel information, it gets hung up with the error message:

Code:
2018-12-02 16:50:39.861 [ERR] SRVR: unable to start server: unable to connect to Tor server: dial tcp 127.0.0.1:9051: connectex: No connection could be made because the target machine actively refused it.

I haven't looked into it too much, I will start googling after this post, just wanna update with the progress you guys are helping with.

The warning message happens in the lnd.exe console right after I press Enter using these flags:
Code:
.\lnd.exe --bitcoin.active --bitcoin.mainnet --bitcoin.node=bitcoind --bitcoind.rpchost=127.0.0.1 --bitcoind.rpcuser=ezra --bitcoind.rpcpass=Bignoodles --bitcoind.zmqpubrawblock=tcp://127.0.0.1:18503 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:18504 --debuglevel=info --listen=localhost --tor.active --tor.streamisolation --tor.v3 listen=localhost

The warning message is:
Code:
2018-12-02 16:46:16.575 [WRN] LTND: open C:\Users\Ezra\AppData\Local\Lnd\lnd.conf: The system cannot find the file specified.


I went into that directory and created a new txt file named 'lnd.conf', But I believe the computer saves it as lnd.conf.txt, resulting in this warning. Unfortunate because it would be great to have a log of all this crap  Grin

I'm off to try and find a solution, when I find one I will update the thread Smiley
legendary
Activity: 1624
Merit: 2481
Are you running the commands with an administrator account?


The only message I get after pressing enter is: https://imgur.com/a/zed0TvP

Access denied means you don't have enough privileges to create that folder.



Next I tried running PowerShell as Administer, giving me a whole new error: https://imgur.com/a/NYNuNo6

It can't find lnd.exe because it is not in the current directory. Navigate to the directory where the .exe is placed (seems to be C:\Users\Ezra\), then try it again.




Finally, I moved my Lnd folder back into %localappdata% and tried to launch lnd.exe through PowerShell (non-administrator) using all the same commands/flags as before, resulting in this error message: https://imgur.com/a/0gTgXrj

Same as the first, Access denied.
You seem to not have enough privileges (which is quite weird). Are you on a 'guest' account? Or an administrator account?
legendary
Activity: 1876
Merit: 3132
I haven't used Tor with Bitcoin Core and LND but I will try to help you. Take a look at this document which describes how to configure Tor for LND. Are you running Tor as a Windows service? As for the error number two, I would check what's going on in that directory (trying to create lnd.log manually and checking the permissions of the mainnet folder).
jr. member
Activity: 34
Merit: 6
Bitcoin Client Software and Version Number: /Satoshi/ 0.17.0.1/ & Lnd 0.5.0-beta (Also happened on 0.5.1-beta)

Operating System: Windows 10

System Hardware Specs: Ryzen 7 1700 CPU, 16GB RAM, 3TB HDD, GTX 960

Description of Problem:
I have two separate errors. I believe error 2 must be dealt with before moving onto error 1. So the story goes I was doing fine running an LND Node v 0.5.0-beta through Windows Powershell. Everything was working as expected. Before funding a channel I decided to use Tor to hide my IP address. (I have never used Tor before) I downloaded the Tor Browser, set up my Bitcoin Core Full node through Run using these flags:

Code:
"C:\Program Files\Bitcoin\bitcoin-qt.exe" -txindex=1 -zmqpubrawblock=tcp://127.0.0.1:18503 -zmqpubrawtx=tcp://127.0.0.1:18504 -rpcuser=ezra -rpcpassword=Bignoodles -server=1 -rpcallowip=127.0.0.1

I added additional flags in my Bitcoin Core Config file:

Code:
proxy=127.0.0.1:9150
bind=127.0.0.1

onlynet=onion
dnsseed=0
dns=0

externalip=qwertyuiop1234.onion

Additionally I went into C:\Users\Ezra\Desktop\Tor Browser\Browser\TorBrowser\Data\Tor\torrc and add the following flags:

Code:
Controlport 9051
CookieAuthentication 1
CookieAuthFileGroupReadable 1

Now, in a Windows Powershell Console, I would launch lnd.exe with these commands/flags:

Code:
.\lnd.exe --bitcoin.active --bitcoin.mainnet --bitcoin.node=bitcoind --bitcoind.rpchost=127.0.0.1 --bitcoind.rpcuser=ezra --bitcoind.rpcpass=Bignoodles --bitcoind.zmqpubrawblock=tcp://127.0.0.1:18503 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:18504 --debuglevel=info --tor.active --tor.streamisolation --tor.v3 listen=localhost

Here is error 1:

Upon unlocking wallet using a separate powershell instance with the command
Code:
.\lndcli unlock
I receive this error message:

Code:
2018-12-01 19:49:27.376 [INF] LNWL: Opened wallet
2018-12-01 19:49:27.456 [INF] LTND: Primary chain is set to: bitcoin
2018-12-01 19:49:27.470 [INF] LNWL: Started listening for bitcoind block notifications via ZMQ on tcp://127.0.0.1:18503
2018-12-01 19:49:27.470 [INF] LTND: Initializing bitcoind backed fee estimator
2018-12-01 19:49:27.470 [INF] LNWL: Started listening for bitcoind transaction notifications via ZMQ on tcp://127.0.0.1:18504
2018-12-01 19:49:28.324 [INF] LNWL: The wallet has been unlocked without a time limit
2018-12-01 19:49:28.327 [INF] LTND: LightningWallet opened
2018-12-01 19:49:28.343 [INF] LNWL: Catching up block hashes to height 552210, this will take a while...
2018-12-01 19:49:28.351 [INF] SRVR: Proxying all network traffic via Tor (stream_isolation=true)! NOTE: Ensure the backend node is proxying over Tor as well
2018-12-01 19:49:28.362 [INF] HSWC: Restoring in-memory circuit state from disk
2018-12-01 19:49:28.375 [INF] LNWL: Done catching up block hashes
2018-12-01 19:49:28.379 [INF] HSWC: Payment circuits loaded: num_pending=0, num_open=0
2018-12-01 19:49:28.387 [INF] LNWL: Started rescan from block 000000000000000000249228113421860caa24fbe0ada757446eefd819f1f07e (height 551100) for 0 addresses
2018-12-01 19:49:28.388 [INF] LNWL: Starting rescan from block 000000000000000000249228113421860caa24fbe0ada757446eefd819f1f07e
2018-12-01 19:49:28.403 [INF] RPCS: RPC server listening on 127.0.0.1:10009
2018-12-01 19:49:28.403 [INF] RPCS: gRPC proxy started at 127.0.0.1:8080
2018-12-01 19:49:28.405 [INF] LTND: Waiting for chain backend to finish sync, start_height=552210
2018-12-01 19:49:28.544 [INF] LNWL: Catching up block hashes to height 551100, this might take a while
2018-12-01 19:49:28.552 [INF] LNWL: Done catching up block hashes
2018-12-01 19:49:28.552 [INF] LNWL: Rescanned through block 000000000000000000203bd4f78b9f1de9e0cc3762c707c2326de1e1a097833c (height 551100)
2018-12-01 19:53:17.498 [INF] LNWL: Rescan finished at 550956 (000000000000000000249228113421860caa24fbe0ada757446eefd819f1f07e)
2018-12-01 19:53:17.580 [INF] LNWL: Catching up block hashes to height 550956, this might take a while
2018-12-01 19:53:17.594 [INF] LNWL: Done catching up block hashes
2018-12-01 19:53:17.594 [INF] LNWL: Finished rescan for 0 addresses (synced to block 000000000000000000249228113421860caa24fbe0ada757446eefd819f1f07e, height 550956)
2018-12-01 19:53:18.569 [INF] LTND: Chain backend is fully synced (end_height=552211)!
2018-12-01 19:53:18.570 [ERR] SRVR: unable to start server: unable to retrieve authentication cookie: open C:\\Users\\Ezra\\Desktop\\Tor: The system cannot find the file specified.
2018-12-01 19:53:18.605 [INF] LTND: Shutdown complete

I waited a while and tried again under the same commands/flags

Code:
2018-12-01 20:25:14.209 [WRN] LTND: open C:\Users\Ezra\AppData\Local\Lnd\lnd.conf: The system cannot find the file specified.
2018-12-01 20:25:14.210 [INF] LTND: Version: 0.5.0-beta commit=, build=production, logging=default
2018-12-01 20:25:14.210 [INF] LTND: Active chain: Bitcoin (network=mainnet)
2018-12-01 20:25:14.211 [INF] CHDB: Checking for schema update: latest_version=6, db_version=6
2018-12-01 20:25:14.220 [INF] RPCS: password RPC server listening on 127.0.0.1:10009
2018-12-01 20:25:14.220 [INF] RPCS: password gRPC proxy started at 127.0.0.1:8080
2018-12-01 20:25:14.221 [INF] LTND: Waiting for wallet encryption password. Use `lncli create` to create a wallet, `lncli unlock` to unlock an existing wallet, or `lncli changepassword` to change the password of an existing wallet and unlock it.
2018-12-01 20:25:28.361 [INF] LNWL: Opened wallet
2018-12-01 20:25:28.445 [INF] LTND: Primary chain is set to: bitcoin
2018-12-01 20:25:28.457 [INF] LTND: Initializing bitcoind backed fee estimator
2018-12-01 20:25:28.457 [INF] LNWL: Started listening for bitcoind block notifications via ZMQ on tcp://127.0.0.1:18503
2018-12-01 20:25:28.457 [INF] LNWL: Started listening for bitcoind transaction notifications via ZMQ on tcp://127.0.0.1:18504
2018-12-01 20:25:29.326 [INF] LNWL: The wallet has been unlocked without a time limit
2018-12-01 20:25:29.330 [INF] LTND: LightningWallet opened
2018-12-01 20:25:29.339 [INF] SRVR: Proxying all network traffic via Tor (stream_isolation=true)! NOTE: Ensure the backend node is proxying over Tor as well
2018-12-01 20:25:29.348 [INF] LNWL: Catching up block hashes to height 552214, this will take a while...
2018-12-01 20:25:29.351 [INF] HSWC: Restoring in-memory circuit state from disk
2018-12-01 20:25:29.359 [INF] HSWC: Payment circuits loaded: num_pending=0, num_open=0
2018-12-01 20:25:29.372 [INF] LNWL: Done catching up block hashes
2018-12-01 20:25:29.384 [INF] LNWL: Started rescan from block 000000000000000000249228113421860caa24fbe0ada757446eefd819f1f07e (height 551100) for 0 addresses
2018-12-01 20:25:29.384 [INF] LNWL: Starting rescan from block 000000000000000000249228113421860caa24fbe0ada757446eefd819f1f07e
2018-12-01 20:25:29.394 [INF] RPCS: RPC server listening on 127.0.0.1:10009
2018-12-01 20:25:29.394 [INF] RPCS: gRPC proxy started at 127.0.0.1:8080
2018-12-01 20:25:29.395 [INF] LTND: Waiting for chain backend to finish sync, start_height=552214
2018-12-01 20:25:29.535 [INF] LNWL: Catching up block hashes to height 551100, this might take a while
2018-12-01 20:25:29.556 [INF] LNWL: Done catching up block hashes
2018-12-01 20:25:29.556 [INF] LNWL: Rescanned through block 000000000000000000203bd4f78b9f1de9e0cc3762c707c2326de1e1a097833c (height 551100)
2018-12-01 20:29:22.512 [INF] LNWL: Rescan finished at 550956 (000000000000000000249228113421860caa24fbe0ada757446eefd819f1f07e)
2018-12-01 20:29:22.520 [INF] LNWL: Catching up block hashes to height 550956, this might take a while
2018-12-01 20:29:22.531 [INF] LNWL: Done catching up block hashes
2018-12-01 20:29:22.531 [INF] LNWL: Finished rescan for 0 addresses (synced to block 000000000000000000249228113421860caa24fbe0ada757446eefd819f1f07e, height 550956)
2018-12-01 20:29:22.547 [INF] LTND: Chain backend is fully synced (end_height=552215)!
2018-12-01 20:29:22.548 [ERR] SRVR: unable to start server: unable to retrieve authentication cookie: read C:\\Users\\Ezra\\Desktop\\Tor: The handle is invalid.
2018-12-01 20:29:22.573 [INF] LTND: Shutdown complete


My Tor Browser is saved under 'C:\Users\Ezra\Desktop\Tor Browser' The file path LND was looking for 'C:\\Users\\Ezra\\Desktop\\Tor' doesn't exist. I tried to rename the folder 'Tor Browser' to 'Tor' and to nobody's surprise that didn't work Roll Eyes Is there a way for me to manually redirect it to the correct folder? I'm kind of at a loss on this one, however it's not the most pressing issue I am having. If we are able to resolve Error #2, the next step would be fixing Error #1

I had been doing lots of closing and opening Lnd.exe & the Full Node so I decided to restart the PC.. Same issue continues.

Next I decided to delete both lnd.exe & lncli.exe from my computer, and install the newest version (0.5.1-beta)

Here is error 2:

I decide to delete my Lnd folder from the %localappdata% (saved to recycle bin) & delete all my tor flags, now running these commands for:

Bitcoin Core Full Node, launched through run

Code:
"C:\Program Files\Bitcoin\bitcoin-qt.exe" -txindex=1 -zmqpubrawblock=tcp://127.0.0.1:18503 -zmqpubrawtx=tcp://127.0.0.1:18504 -rpcuser=ezra -rpcpassword=Bignoodles -server=1 -rpcallowip=127.0.0.1

Commands/flags for Lnd.exe, launched through PowerShell

Code:
.\lnd.exe --bitcoin.active --bitcoin.mainnet --bitcoin.node=bitcoind --bitcoind.rpchost=127.0.0.1 --bitcoind.rpcuser=ezra --bitcoind.rpcpass=Bignoodles --bitcoind.zmqpubrawblock=tcp://127.0.0.1:18503 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:18504 --debuglevel=info -listen=localhost

The only message I get after pressing enter is: https://imgur.com/a/zed0TvP

Code:
loadConfig: Failed to create lnd directory: mkdir C:\Users\Ezra\AppData\Local\Lnd: Access is denied

(Bug info less detailed because it is not being written to the log file)

This issue is my main concern. Suddenly my PowerShell lost privileges to create/access directories? It had this privilege when I first created a node weeks ago, and it had these privileges about 30 minutes ago, before I started setting this stuff up using Tor

Next I tried running PowerShell as Administer, giving me a whole new error: https://imgur.com/a/NYNuNo6


Finally, I moved my Lnd folder back into %localappdata% and tried to launch lnd.exe through PowerShell (non-administrator) using all the same commands/flags as before, resulting in this error message: https://imgur.com/a/0gTgXrj

Code:
failed to create file rotator: open C:\Users\Ezra\AppData\Local\Lnd\logs\bitcoin\mainnet\lnd.log: Access is denied

So yeah, I'm kind of at a loss.

I haven't used much PowerShell before trying to run an Lnd node, haven't used Tor before. Spent too much time learning about and experimenting with Lnd to give up now, I'm very willing to work with anyone who can steer me in the right direction!!!


Thank you to anybody who took the time to go through this!!!!!
Jump to: