Closed irishismyname closed 6 years ago
lighting-rpc
has a spelling error in it. Its lightning-rpc (with an N) and can be found in the directory defined as --lightning-dir
Good catch, that turned out to be my careless spelling in the post (which I corrected just now).
It was not my intention to correct your spelling of your post :) I had hoped this spelling mistake was also the reason of the "file that can not be found" error.
Could you share with us the command you're using to startup the daemon?
Yes I was also hopeful of that haha.
I think (or hope) I'm starting cdecker's lightning image in the same namespace that amacneil's bitcoin image is running.
docker run --rm --name lightning --network container:bitcoind_mainnet -v /scratch/bitcoin/mainnet/bitcoind:/root/.bitcoin -v /scratch/bitcoin/mainnet/clightning:/root/.lightning --entrypoint /usr/bin/lightningd cdecker/lightningd:master --network=bitcoin --log-level=debug
I also wrapped the cli per the tutorial:
#!/usr/bin/env bash
docker run --rm -v /scratch/bitcoin/mainnet/clightning:/root/.lightning --entrypoint /usr/bin/lightning-cli cdecker/lightningd:master "$@"
running this script with getinfo as the argument returns the error in the title.
I tried to reproduce this, but couldn't. I usually use exec
to execute something inside of a running container. In this case I'd use
docker exec lightning lightning-cli getinfo
This sidesteps any problems that might appear due to wrong paths and does not leave containers around in case of failures :-)
I'm not getting any other console messages from lightning other than what's in the screenshot above. I was expecting to see "adding block", etc. per the tutorial. Is the lack of additional output caused by bitcoind still attempting to sync and download blocks? Should I wait for it to finish before attempting to run the daemon or CLI?
Oh, I see, that might indeed be the issue, that you're not syncing with the blockchain. Can you try the following:
docker exec lightning bitcoin-cli getblockchaininfo
That tests that bitcoin-cli
is able to talk to bitcoind
from inside the lightningd
container.
Seems to be working, the "blocks" count matches the current count reported by the bitcoin daemon.
Well I started over using:
https://medium.com/@dougvk/run-your-own-mainnet-lightning-node-2d2eab628a8b
as a reference, and it seems to be working now. Now to figure out the difference...
Hi, actually I am getting this issue currently, I am running bitcoin on regtest
and getting lightning-cli: Connecting to 'lightning-rpc': No such file or directory
no commands are working except -h
and -V
, every other command is giving this error. My lightningd
seems to be running fine. An lightning-rpc file has also been generated at .lightning/regtest/
What is the command line that you are try to running?
Solved, Actually I was passing the terminal modifier to the daemon but not the cli, that's why lightningd was running but lightning-cli was giving error. I just set regtest
as default network in config and problem fixed.
When using custom directory for lightning instead of default one ~/.lightning , ... this is absolutely NOT WORKING as documented and described in official documentation at https://docs.corelightning.org/docs/configuration
Documentation says you can set rpc-file=/path/to/lightning/bitcoin/lightning-rpc inside your config fild and it should work ... but it does not work. The lightning deamon gets started without problems and creates lightning-rpc socket file in the location you set in config's rpc-file setting ... BUT when you run ANY lightning-cli command you will get: "lightning-cli: Connecting to 'lightning-rpc': No such file or directory"
... UNLESS you provide a command line argument for rpc-file EVERY single time you run any command like this: lightning-cli --rpc-file=/path/to/lightning/bitcoin/lightning-rpc getinfo
Is there no better way to do this ?
Shouldn't the lightning-cli command read the lightning-rpc socket location from the config file's setting "rpc-file" ?
My use-case and reason for using custom lightning directory location: I am using Raspberry Pi to host Lightning. I have to put the lightning folder in custom location on the mounted SSD Drive in order to preserve the disc space on the tiny 32 gb SD card that Raspberry runs off. Since the default location for lightning is in ~/.lightning that is located on SD card, that is not acceptable.
@VexTatarevic impossible that it is not working, I am using a custom path on my system.
I think what you want is --data-dir
and not rpc-file
?
Shouldn't the lightning-cli command read the lightning-rpc socket location from the config file's setting "rpc-file" ?
It does, you are just overriding it with the command line argument
@vincenzopalazzo --data-dir is not even a core lightning configuration argument as far as I can see on this documentation page : https://docs.corelightning.org/docs/configuration
Did you mean "datadir" setting in bitcoin.conf ? ... I have that set up and my bitcoin node runs as expected or did you mean "bitcoin-datadir" setting in lightning config file ? ...I have that set up fine or did you mean "lightning-dir" setting in lightning config file ? ... I have that set up as well pointing to the root folder of lightning
I will describe here my full structure and give the full config file and how I run it. Maybe that helps figure out what is the problem:
My bitcoin location: /home/ssd/crypto/bitcoin/
My lightning location : /home/ssd/crypto/lightning/
My lightning config file location: /home/ssd/crypto/lightning/config
I run lightning like this: lightningd --conf=/home/ssd/crypto/lightning/config
Then I run tail command to see what's going on: tail -f /home/ssd/crypto/lightning/debug.log
I get the following output which indicates that lightning is running fine:
2023-07-31T06:13:02.218Z INFO connectd: Static Tor service onion address: "jhgjhgjhgjhgjhgjhgjhgjhgjhgjhgjhgjhgjhg.onion:9735,127.0.0.1:9734" bound from extern port 9735
2023-07-31T06:13:02.915Z INFO plugin-bcli: bitcoin-cli initialized and connected to bitcoind.
2023-07-31T06:13:03.572Z UNUSUAL lightningd: Waiting for bitcoind to catch up (801005 blocks of 801025)
2023-07-31T06:13:04.674Z INFO lightningd: --------------------------------------------------
2023-07-31T06:13:04.674Z INFO lightningd: Server started with public key 987987987987987987999...., alias vexit (color #000000) and lightningd v23.05-154-g7a57f70
2023-07-31T06:13:25.455Z UNUSUAL plugin-bookkeeper: Snapshot balance does not equal ondisk reported 0msat, off by (+0msat/-0msat) (account wallet) Logging journal entry.
Then I try to stop the lightning: lightning-cli stop
And I get this lightning-cli: Connecting to 'lightning-rpc': No such file or directory
Then I run the same command with rpc-file path provided in full: lightning-cli --rpc-file=/home/ssd/crypto/lightning/bitcoin/lightning-rpc stop
And I get a correct response: "Shutdown complete"
This is what my config file looks like and I basically copied the sample from official lightning source contrib folder on github: https://github.com/ElementsProject/lightning/blob/master/contrib/config-example , and I just added my custom arguments at the bottom:
##------------------------------------------------------------
# General Settings
##------------------------------------------------------------
## Give your node a name
alias=vexit
## Pick your favorite color as a hex code
rgb=000000
## Set the network for Core Lightning to sync to, Bitcoin Mainnet for most users
## Not required if the config file is in a network directory e.g. ~/.lightning/bitcoin/
network=bitcoin
## Run `lightningd` as a background daemon instead of in the terminal
## Requires `log-file` path
daemon
## Log output to specified file instead of the terminal
## Required for `daemon`
log-file=/home/ssd/crypto/lightning/debug.log
## Set to debug for more verbose log output
#log-level=info
## Password encrypt your `hsm_secret`
## You must supply the password on startup if you choose to do this
#encrypted-hsm
##------------------------------------------------------------
# Network Settings
##------------------------------------------------------------
##------------------ TOR Settings -------------
## INBOUND connections - default PORT 9735
## 0.0.0.0 for clearnet | localhost+torhiddenservice for tor
#addr=<IP ADDRESS>:9735
addr=statictor:127.0.0.1:9051/torport=9735
## OUTBOUND connections - Configure proxy/tor for
proxy=127.0.0.1:9050
## Set all outbound connections to go through the proxy/tor - true/false
## Set false for Hybrid, Set true to route all through Tor. Default is unspecified is false
## “Hybrid” mode means that outgoing connections to Tor nodes are routed through the Tor proxy,
## while outgoing connections to clearnet nodes are routed directly over the normal “clearnet” network.
## To make your node a "Routing Node" you must set this to false in order to accept incoming connections and make your node findable by other nodes.
always-use-proxy=false
##------------------ Clearnet Settings -------------
##
## This is only relevant if always-use-proxy=false
## Peers can find your node here
announce-addr=45.133.4.18:9735
## Bind Core Lightning RPC server to localhost PORT 9734
bind-addr=127.0.0.1:9734
##------------------------------------------------------------
# Channel Settings
#
# !! Please read the manual before editing these !!
# !! and for a full list of available options !!
##------------------------------------------------------------
## Removes capacity limit for channel creation
#large-channels
## Base fee to charge for every payment which passes through in MILLISATOSHI (1/1000 of a satoshi)
#fee-base=1000
## In millionths (10 is 0.001%, 100 is 0.01%, 1000 is 0.1% etc.)
#fee-per-satoshi=10
## Minimum value, in SATOSHI, to accept for channel open requests
#min-capacity-sat=10000
## Sets the minimum HTLC value for new channels
#htlc-minimum-msat=0
## Blockchain confirmations required for channel to be considered valid
#funding-confirms=3
## Max number of HTLC channels can handle in each direction
#max-concurrent-htlcs=30
##------------------------------------------------------------
# Plugins
#
# Plugins allow you to extend Core Lightnings functionality
# For a community curated list of available plugins visit:
# "https://github.com/lightningd/plugins"
##------------------------------------------------------------
## Load your plugins from a directory
#plugin-dir=/path/to/your/.lightning/plugins
## Load plugins individually
#plugin=path/to/plugin
##------------------------------------------------------------
# Custom
##------------------------------------------------------------
# Sets the working directory. All files (except –conf and –lightning-dir on the command line) are relative to this.
lightning-dir=/home/ssd/crypto/lightning
# Path to "lightning-rpc" socket file that is called by lightning-cli command
rpc-file=/home/ssd/crypto/lightning/bitcoin/lightning-rpc
# -datadir argument to supply to bitcoin-cli
bitcoin-datadir=/home/ssd/crypto/bitcoin
# The RPC username for talking to bitcoind
bitcoin-rpcuser=**************
# The RPC password for talking to bitcoind
bitcoin-rpcpassword=************
Sorry I did not remember the correct name
➜ ~ lightningd --help | grep dir
--lightning-dir=<dir> Set base directory: network-specific
subdirectory is under here
--plugin-dir <arg> Add a directory to load plugins from
directory. This option may be specified
--bitcoin-datadir <arg> -datadir arg for bitcoin-cli
--bookkeeper-dir <arg> Location for bookkeeper records.
--fetchinvoice-noconnect Don't try to connect directly to fetch
➜ ~
@vincenzopalazzo thanks for your effort, but none of that helps because as I clearly described in the message above, I have already set lightning-dir and bitcoin-datadir in my config file. If you scroll down on my large post above you will see these settings in my lightning config that I provided.
It would be nice if you can do what I did in my message above and post here your config file and describe where your lightning data dir and bitcoin data dir are placed. If your setup is really working properly then there is no reason why it shouldn't work for me if I follow your setup description.
Cheers
Please do not blame me to did not read your comment, in your message before you says
And I get this lightning-cli: Connecting to 'lightning-rpc': No such file or directory
Then I run the same command with rpc-file path provided in full: lightning-cli --rpc-file=/home/ssd/crypto/lightning/bitcoin/lightning-rpc stop
And I get a correct response: "Shutdown complete"
Now, my question for you in previous posts before is, can you tell my how lightning-cli can now that your configuration file is in the /home/ssd/crypto/lightning/
?
If you apply my suggestion [here](https://github.com/ElementsProject/lightning/issues/795#issuecomment-1658187799 and apply the lightning-cli
works you should provide or --lightning-dir=
or --rpc-file
The problem is that you are assuming that lightning-cli know your path, but it does not and you need to specify it each time that you use it.
ofc you can create an alias in your machine
The Lightning-cli should know where my config file is because I run the daemon with —conf argument like this : lightningd --conf=/home/ssd/crypto/lightning/config
and because I have set both lightning-dir and rpc-file inside the config.
The whole point of config file is to provide settings in it, so you don’t have to keep typing them in the command line every time you run lightning-cli command
This is also exactly how bitcoin-cli works. It reads settings from bitcoin.conf
If what you are saying is correct and I have to type —rpc-file argument every time I run lightning-cli command, then that’s obviously a bad program design by core Lightning. Cli is meant to be short and convenient for running commands.
Anyway thanks for trying to help. I’ll leave this issue at this and just use whatever works.
Cheers
If what you are saying is correct and I have to type —rpc-file argument every time I run lightning-cli command, then that’s obviously a bad program design by core Lightning. Cli is meant to be short and convenient for running commands.
PR are welcome if you are able to do better
You have a point :-) I didn’t mean to sound ungrateful. I guess it’s just a point for improvement or a feature request 😅 Thanks again
Trying to start up a mainnet lightning node, used this as a reference:
https://interfect.github.io/#!/posts/009-Ride-the-Lightning.md
bitcoin cli seems to work without a hitch (although it's still syncing), but I can't seem to get lightning to go.
Here's the output from starting the lightningd:
I should mention I have no idea what I'm doing here, but I want to get involved.