ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.85k stars 902 forks source link

v24.08rc2 - bitcoin-cli not a valid config option #7595

Closed nakoshi-satamoto closed 2 months ago

nakoshi-satamoto commented 2 months ago

I'm trying to test v24.08rc2 When I attempt to start lightningd I get an error message saying that "bitcoin-cli" is an unknown configuration option. This is a valid config option in v24.05 though, my bitcoin-cli is in a specific filepath that needs declared. Was this config changed in 24.08rc2 to something else?

nakoshi-satamoto commented 2 months ago

Example of my current config

bitcoin-cli=/home/satoshi/bitcoin-27.3/bin/bitcoin-cli

nakoshi-satamoto commented 2 months ago

lightningd: Config file /home/user/.lightning/config line 8: bitcoin-cli=/home/satoshi/bitcoin-27.0/bin/bitcoin-cli: unknown option

vincenzopalazzo commented 2 months ago

Can you post your logs? it is possible that some plugin like bcli.c is dying?

nakoshi-satamoto commented 2 months ago

When I go back to version 24.05 it works as normally. In this case the log shows nothing for 24.08rc2, I can re-attempt later in debug mode and post logs here.

nakoshi-satamoto commented 2 months ago

No other data in log file when attempted in debug

`2024-08-21T16:12:35.311Z INFO lightningd: v24.08rc2

2024-08-21T16:12:35.311Z DEBUG lightningd: Opened log file /home/satoshi/.lightning/ln-log.txt

2024-08-21T16:12:35.326Z DEBUG plugin-manager: started(1446405) /home/satoshi/apps/peerswap/peerswap

2024-08-21T16:12:35.341Z DEBUG lightningd: io_break: check_plugins_manifests

2024-08-21T16:12:35.341Z DEBUG lightningd: io_loop_with_timers: plugins_init `

standard output shows lightningd: Config file /home/satoshi/.lightning/config line 8: bitcoin-cli=/home/satoshi/apps/bitcoin-core/bitcoin-27.0/bin/bitcoin-cli: unknown option

nakoshi-satamoto commented 2 months ago

v24.08rc2 is not accepting required config settings necessary to work with Bitcoin Core.

Lagrang3 commented 2 months ago

When lightningd starts you should see a lot of plugin-maganer lines indicating the PID of the default plugins. bitcoin-cli is an option defined within bcli plugin. In your logs there is only peerswap being started. Usually you should see:

2024-08-27T15:31:30.965Z INFO    lightningd: v24.08rc3-1-g48fa438-modded
2024-08-27T15:31:30.994Z INFO    lightningd: Creating configuration directory /tmp/l1/regtest
2024-08-27T15:31:30.994Z DEBUG   lightningd: Opened log file /tmp/l1/log
2024-08-27T15:31:30.996Z DEBUG   plugin-manager: started(508405) /home/lagrange/lightning/plugins/autoclean
2024-08-27T15:31:30.997Z DEBUG   plugin-manager: started(508408) /home/lagrange/lightning/plugins/chanbackup
2024-08-27T15:31:30.999Z DEBUG   plugin-manager: started(508413) /home/lagrange/lightning/plugins/bcli
2024-08-27T15:31:31.000Z DEBUG   plugin-manager: started(508416) /home/lagrange/lightning/plugins/commando
2024-08-27T15:31:31.002Z DEBUG   plugin-manager: started(508420) /home/lagrange/lightning/plugins/funder
2024-08-27T15:31:31.003Z DEBUG   plugin-manager: started(508424) /home/lagrange/lightning/plugins/topology
2024-08-27T15:31:31.004Z DEBUG   plugin-manager: started(508427) /home/lagrange/lightning/plugins/keysend
2024-08-27T15:31:31.005Z DEBUG   plugin-manager: started(508430) /home/lagrange/lightning/plugins/offers
2024-08-27T15:31:31.006Z DEBUG   plugin-manager: started(508433) /home/lagrange/lightning/plugins/pay
2024-08-27T15:31:31.008Z DEBUG   plugin-manager: started(508436) /home/lagrange/lightning/plugins/recklessrpc
2024-08-27T15:31:31.009Z DEBUG   plugin-manager: started(508441) /home/lagrange/lightning/plugins/recover
2024-08-27T15:31:31.010Z DEBUG   plugin-manager: started(508444) /home/lagrange/lightning/plugins/txprepare
2024-08-27T15:31:31.011Z DEBUG   plugin-manager: started(508447) /home/lagrange/lightning/plugins/cln-renepay
2024-08-27T15:31:31.012Z DEBUG   plugin-manager: started(508449) /home/lagrange/lightning/plugins/spenderp
2024-08-27T15:31:31.013Z DEBUG   plugin-manager: started(508453) /home/lagrange/lightning/plugins/cln-askrene
2024-08-27T15:31:31.014Z DEBUG   plugin-manager: started(508456) /home/lagrange/lightning/plugins/sql
2024-08-27T15:31:31.015Z DEBUG   plugin-manager: started(508459) /home/lagrange/lightning/plugins/bookkeeper
2024-08-27T15:31:31.017Z DEBUG   plugin-manager: started(508460) /home/lagrange/lightning/plugins/clnrest/clnrest
2024-08-27T15:31:31.018Z DEBUG   plugin-manager: started(508461) /home/lagrange/lightning/plugins/wss-proxy/wss-proxy
2024-08-27T15:31:31.226Z UNUSUAL plugin-bookkeeper: topic 'utxo_deposit' is not a known notification topic
2024-08-27T15:31:31.226Z UNUSUAL plugin-bookkeeper: topic 'utxo_spend' is not a known notification topic
2024-08-27T15:31:31.226Z DEBUG   lightningd: io_break: check_plugins_manifests
2024-08-27T15:31:31.226Z DEBUG   lightningd: io_loop_with_timers: plugins_init
...

To me it seems lightningd is not finding the path to the builtin plugins in your setup.

nakoshi-satamoto commented 2 months ago

so what is the path to bcli then @Lagrang3 ? I never had to declare the path to that in the earlier versions.

Lagrang3 commented 2 months ago

I am looking into the code, it seems that lightningd searches for the builtin plugins relative to his own path ../plugins. Do you use make install?

nakoshi-satamoto commented 2 months ago

I found it

corelightning-24.05/usr/libexec/c-lightning/plugins/bcli

I'll test today when I get a chance with this path declared as a plugin in the config

nakoshi-satamoto commented 2 months ago

I am looking into the code, it seems that lightningd searches for the builtin plugins relative to his own path ../plugins. Do you use make install?

I am just using the signed binaries. I did not compile.

grubles commented 2 months ago

Couldn't you symlink the binary to somewhere in your PATH?

nakoshi-satamoto commented 2 months ago

Declaring the path of the plugin does not work either, I get this error starting plugin '/home/satoshi/clightning/corelightning-v24.08rc3/usr/libexec/c-lightning/plugins': opening pipe: Permission denied

nakoshi-satamoto commented 2 months ago

Couldn't you symlink the binary to somewhere in your PATH?

And what would be the proper way to do that? This seems like a hack work around. Would users of core lightning be expected to do the same?

nakoshi-satamoto commented 2 months ago

Declaring the path of the plugin does not work either, I get this error starting plugin '/home/satoshi/clightning/corelightning-v24.08rc3/usr/libexec/c-lightning/plugins': opening pipe: Permission denied

I see I made an error by not including /bcli at the end of that path. I did so and now I get this

lightningd: Could not run /usr/libexec/c-lightning/lightning_channeld: No such file or directory

nakoshi-satamoto commented 2 months ago

So Core Lightning now only works if it is installed system-wide rather than from a local filepath, and only works if it is the same for Bitcoin Core?

nakoshi-satamoto commented 2 months ago

I have been running this under a filepath of /home/satoshi/clightning/corelightning-v24.08rc3/ (an example)

Lagrang3 commented 2 months ago

So Core Lightning now only works if it is installed system-wide rather than from a local filepath, and only works if it is the same for Bitcoin Core?

No. It's not that. My node's binaries are in a custom path. And you shouldn't have to hack your way around.

grubles commented 2 months ago

Yes I just meant symlinking as a temporary workaround to get your node back up.

nakoshi-satamoto commented 2 months ago

Thanks everyone. If I need to do symlinking I can, although not ideal. @Lagrang3 I'm curious what you are doing differently than me. Are you using bitcoin core in a custom path also? I'm using both Bitcoin Core and Core Lightning in a custom path.

I'm hopeful that this pre-release might also fix the payment issues I was having, why I was wanting to test this.

Lagrang3 commented 2 months ago

yes. I have core lightning and bitcoin binaries in custom paths. To upgrade I go through the steps ./configure --prefix=MYCUSTOMPATH && make && make install that produce a directory structure like this:

$ tree /opt/lightning/24.08/
/opt/lightning/24.08/
├── bin
│   ├── lightning-cli
│   ├── lightningd
│   ├── lightning-hsmtool
│   └── reckless
├── libexec
│   └── c-lightning
│       ├── lightning_channeld
│       ├── lightning_closingd
│       ├── lightning_connectd
│       ├── lightning_dualopend
│       ├── lightning_gossipd
│       ├── lightning_hsmd
│       ├── lightning_onchaind
│       ├── lightning_openingd
│       ├── lightning_websocketd
│       └── plugins
│           ├── autoclean
│           ├── bcli
│           ├── bookkeeper
│           ├── chanbackup
│           ├── cln-askrene
│           ├── cln-renepay
...

which is exactly what you get when you extract the release binaries.

Then I have a script in a cron job that calls lightningd, eg

/opt/lightning/24.08/bin/lightningd --daemon ...

lightningd uses the path of the executable to figure out the path to the other binaries.

Lagrang3 commented 2 months ago

I think we should add log messages to inform that builtin plugins are not loaded and also inform where are we trying to look for them. We don't have those as far as I can tell from testing now.

nakoshi-satamoto commented 2 months ago

I think we should add log messages to inform that builtin plugins are not loaded and also inform where are we trying to look for them. We don't have those as far as I can tell from testing now.

Great idea

Lagrang3 commented 2 months ago

I hit it locally with the release binaries:

$ /home/lagrange/tmp/cln-24.08-release/bin/lightningd "--network=$network" "--lightning-dir=$LIGHTNING_DIR/l1" "--bitcoin-datadir=$BITCOIN_DIR" "--database-upgrade=true"
lightningd: Config file /tmp/lightning/l1/config line 1: bitcoin-cli=/opt/bitcoin/bin/bitcoin-cli: unknown option

Instead I had no issues with binaries compiled from source.

rustyrussell commented 2 months ago

I have been running this under a filepath of /home/satoshi/clightning/corelightning-v24.08rc3/ (an example)

Right. CLN has two modes, one is that it expects to be in the build directory (good for developers), the other in the --prefix directory it was configured with.

I'm surprised that this used to work! But thanks for the report, I'll make it work!

nakoshi-satamoto commented 2 months ago

I compiled and it returns the same error. Can we bring back the bitcoin-cli= config option to declare a custom path for bitcoin-cli? Right now the new version of CLN only supports bitcoin core if it is installed system wide at a specific filepath.

nakoshi-satamoto commented 2 months ago

I made a softlink of /usr/local/bin/bitcoin-cli to the bitcoin-cli in my custom path. Yeah this still does not work when I run lightningd I get error lightningd: Could not run /usr/local/libexec/c-lightning/lightning_channeld: Permission denied

I am trying to run v24.08rc3 that I compiled.

nakoshi-satamoto commented 2 months ago

The last issue "permission denied" is a different issue. I think it resulted from me installing with "sudo make install" while my umask was set to 027 instead of 022. I fixed the permissions with chmod.

I am now running v24.08rc3.

How easy would it be to bring back the bitcoin-cli= option in the lightning config file? This would eliminate the need of people to have to make symbolic links or compile with a custom path.