rust-teos icon indicating copy to clipboard operation
rust-teos copied to clipboard

Plugin will not load

Open JWBurgers opened this issue 1 year ago • 7 comments

The watchtower-client will not load. In my Core Lightning log file, I see the following two lines:

"plugin-manager: started(..) path/plugins/watchtower-client" "plugin-watchtower-client: Killing plugin: exited before replying to init"

Any idea why I might be getting this error? I'm attempting to run just the plugin, not the server application. The plugin is run from a custom path and from the same service account as the rest of Core Lightning. I set the TOWERS_DATA_DIR environment variable to the right custom directory, so that the service account can access it (the service acct has no permissions in the home directory).

JWBurgers avatar Dec 22 '23 13:12 JWBurgers

It be useful if you could include what your setup looks like in terms of OS and CLN version so we can try to reproduce this.

Also, if you can walk us trough the steps you went both for installing and adding the plugin to CLN that may help.

sr-gi avatar Dec 22 '23 15:12 sr-gi

Thank you for the response.

System details

  • OS: Debian 12.3
  • Core Lightning: v23.11.1
  • Bitcoin Core: V25.1
  • Bitcoin server applications are run from a dedicated, mounted drive (separate from the OS); each server app has its own dedicated service account.

CLN installation details

  • Installed directly from the binary releases (for Ubuntu 22.04)
  • Running CLN on a dedicated service account

Plugin installation details

  • I built the plugin from source code in the home directory for the server administrator
  • Original build failed. I was missing the “rustfmt” package so installed that via the APT. Rebuilding gave success, though there were a few warnings.
  • As the LN Core service account has no home directory, I have a custom plugin directory for Lightning plugins. I simply placed the plugin binary for the watchtower into that directory.
  • I set a custom path for the watchtower data directory in /etc/environment, so that the TOWERS_DATA_DIR variable is set for all users, including the service account. ($ export TOWERS_DATA_DIR="/[path]/watchtower-data"
  • Permissions were set for the Core LN service account on the plugin and the watchtower data directory.
  • I did not yet install the watchtower server application.

The watchtower plugin is acknowledged on startup. But then it is killed a little while later: “plugin-watchtower-client: Killing plugin: exited before replying to init”. I can’t see any data being written to the watchtower data directory. So it looks like it is killed before doing anything.

JWBurgers avatar Jan 02 '24 11:01 JWBurgers

Been able to isolate the problem after some troubleshooting.

  • I created a home directory for the lightningd service and a login ability for the account.
  • Plugin seems to run fine after that: { "name": "/btc-server/core-lightning/plugins/watchtower-client", "active": true, "dynamic": false }
  • See the data directory being created in the home directory for the Lightningd service account. So it turns out the default path for the data directory is NOT being overwritten by the custom path specified in the environment variable.

What I tried to solve the problem.

  • Checked the spelling of the ENV variable and the syntax of the export command thoroughly. Also double checked the source code to make sure there was no misspelling of the ENV variable in the instructions.
  • The ENV variable is loaded for the lightning service account (as well as every other account).
  • The lightningd service account has full access to the custom data directory.

Not sure what could be the problem.

JWBurgers avatar Jan 02 '24 16:01 JWBurgers

Hey @JWBurgers, I'm unable to reproduce this atm given my current setup refuses to install CoreLN.

I'll give this a go as soon as I can fix it, or switch to my old dev setup and report back

sr-gi avatar Jan 02 '24 21:01 sr-gi

Thanks @sr-gi . Will let you know if I successfully troubleshoot it myself.

JWBurgers avatar Jan 03 '24 14:01 JWBurgers

@JWBurgers I've tried to replicate your issue unsuccessfully. If I set the TOWERS_DATA_DIR it does create a folder to the specified location.

I have tried it within the same user though. Would you mind trying to set the ENV within the lightningd directory but on a different path? I want to double-check it's not a permission issue or ENV variable not being available when you try to read it from another user.

sr-gi avatar Jan 04 '24 21:01 sr-gi

Any updates on this?

sr-gi avatar Mar 20 '24 19:03 sr-gi

Yes @sr-gi , thank you for your patience.

In the end, I ended up settling on creating a service account for CLN with a home directory included. That way I could just allow all the default paths for binary and data installations. The main motivation was that other CLN plugins would cause similar configuration challenges. So this would just be a very impractical way of managing plugins. With that approach, everything seems to work well.

I was looking into it for the purposes of creating a node-building guide for students. The instructions for the TEOS plugin are found here (https://github.com/JWBurgers/Bitcoin_Server/blob/main/Chapter_17_Backups_liquidity_plugins_and_watchtowers.md#watchtowers).

My guess is that indeed there would have also been an unidentified permission issue somewhere in attempting to set the custom directory. But I was unable to find it.

JWBurgers avatar Apr 30 '24 11:04 JWBurgers

I'll close the issue then, since it seems related to how the plugin system work, and not a teos specific issue. Feel free to reopen if you see fit

sr-gi avatar May 06 '24 18:05 sr-gi