lightningd / plugins

Community curated plugins for core-lightning
BSD 3-Clause "New" or "Revised" License
269 stars 129 forks source link

feeadjuster: error when trying to run c-lightning with feeadjuster plugin #174

Closed billygarrison closed 3 years ago

billygarrison commented 3 years ago

When I try to run lightningd with the feeadjuster plugin I get the following error

billy@AcerUbuntu:~/.lightning$ lightningd
import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/408.
import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/408.
from: can't read /var/mail/pyln.client
/home/billy/.lightning/plugins/feeadjuster.py: 8: Syntax error: "(" unexpected

Not sure if related, but the python alias is for Python 2 and I use python3 for Python 3.

Also not sure if there is supposed to be something in /var/mail/ but that directory is empty. When I run pip3 install pyln-client I get the following message:

Requirement already satisfied: pyln-client in /home/billy/.local/lib/python3.8/site-packages (0.8.2)
m-schmoock commented 3 years ago

@billygarrison This may sound like your python setup is messed up. Do you only have troubles using the feeadjuster or any other plugin or even just the daemon without plugins? What baffles me is that it tries to read pyln.client code from /var/mail from: can't read /var/mail/pyln.client. Try the following:

billygarrison commented 3 years ago

Thank you for the advice @m-schmoock but unfortunately none of that worked.

I use the eye of satoshi watchtower plugin which uses the same from pyln.client import Plugin, although it doesn't import RpcError. When I run python in the console and try doing the same imports they work fine.

billygarrison commented 3 years ago

I figured out the issue...

I had copy + pasted the code for feeadjuster.py from GitHub to a new file and saved it + modified the permissions as directed. But something went wrong... Maybe I copied incorrectly and made the script invalid, or maybe I made a mistake when trying to do chmod a+x. Either way, cloning the repo and using that script instead fixed the problem.

I tried re-doing my steps of copy + paste + chmod and can't reproduce the error so I'm assuming I just did something wrong the first time.

For anyone interested (@m-schmoock) - the reason it tried looking in /var/mail is because it didn't run the code as Python code but instead ran it as a shell command. For example, if you try running in the terminal from blahblahblah you'll get from: can't read /var/mail/blahblahblah. Something to do with checking mail from that address/account or something.

m-schmoock commented 3 years ago

@billygarrison Good to know. Maybe you missed to copy the first comment line which tells the shell to use python interpreter (#!/usr/bin/env python"). In this case it would try to execute it as shell