ElementsProject / lightning

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

bitcoin-cli exec failed: No such file or directory #627

Closed kryo2k closed 6 years ago

kryo2k commented 6 years ago

This might be due to my setup, but here's the full log. The bitcoin-cli script is located in the same directory I am calling lightningd from.

./lightningd --network=testnet --log-level=debug --bitcoin-datadir="$HOME/.bitcoin"
2805 bytes, Wed Jan 17 07:00:10 2018
+0.021871853 lightningd(4621):DEBUG: Trying to guess public addresses...
+0.021943165 lightningd(4621):DEBUG: Address *.*.*.*:9735 is not routable
+0.021973197 lightningd(4621):DEBUG: Failed to connect 10 socket: Network is unreachable
+0.022974651 lightningd(4621):DEBUG: testing ~/lightning/lightningd/lightning_channeld
+0.024865263 lightningd(4621):DEBUG: testing ~/lightning/lightningd/lightning_closingd
+0.026722068 lightningd(4621):DEBUG: testing ~/lightning/lightningd/lightning_gossipd
+0.028319916 lightningd(4621):DEBUG: testing ~/lightning/lightningd/lightning_hsmd
+0.029509792 lightningd(4621):DEBUG: testing ~/lightning/lightningd/lightning_onchaind
+0.031377750 lightningd(4621):DEBUG: testing ~/lightning/lightningd/lightning_openingd
+0.074536457 lightningd(4621):DEBUG: HSM TRACE: Client: Received message 11 from client
+0.098804596 lightningd(4621):DEBUG: Loaded 0 invoices from DB
+0.098956937 lightningd(4621):DEBUG: HSM TRACE: Client: Received message 9 from client
+0.099308768 lightning_gossipd(4629):DEBUG: pid 4629, msgfd 12
+0.099475284 lightningd(4621):DEBUG: Loaded 0 channels from DB
+0.111171097 lightningd(4621):BROKEN: bitcoin-cli exec failed: No such file or directory
+0.111329584 lightningd(4621):BROKEN: FATAL SIGNAL 6 RECEIVED
+0.116936853 lightningd(4621):BROKEN: backtrace: lightningd/log.c:436 (log_crash) 0x40ffe9
+0.116971181 lightningd(4621):BROKEN: backtrace: (null):0 ((null)) 0x7f9c5824e4af
+0.116982399 lightningd(4621):BROKEN: backtrace: (null):0 ((null)) 0x7f9c5824e428
+0.116991647 lightningd(4621):BROKEN: backtrace: (null):0 ((null)) 0x7f9c58250029
+0.117001423 lightningd(4621):BROKEN: backtrace: lightningd/log.c:525 (fatal) 0x410423
+0.117268675 lightningd(4621):BROKEN: backtrace: lightningd/bitcoind.c:664 (wait_for_bitcoind) 0x4053be
+0.117586775 lightningd(4621):BROKEN: backtrace: lightningd/chaintopology.c:726 (setup_topology) 0x4079f6
+0.117762875 lightningd(4621):BROKEN: backtrace: lightningd/lightningd.c:326 (main) 0x40e952
+0.117774621 lightningd(4621):BROKEN: backtrace: (null):0 ((null)) 0x7f9c5823982f
+0.117783345 lightningd(4621):BROKEN: backtrace: (null):0 ((null)) 0x403138
+0.117790538 lightningd(4621):BROKEN: backtrace: (null):0 ((null)) 0xffffffffffffffff

 ((null)) 0x7f16179b082f
+0.223667773 lightningd(4377):BROKEN: backtrace: (null):0 ((null)) 0x403138
+0.223676502 lightningd(4377):BROKEN: backtrace: (null):0 ((null)) 0xffffffffffffffff
jb55 commented 6 years ago

+0.111171097 lightningd(4621):BROKEN: bitcoin-cli exec failed: No such file or directory

bitcoin-cli needs to be in your $PATH

kryo2k commented 6 years ago

Thank you for your quick response @jb55! That fixed this error, but now i'm getting the same issue as reported by @ekerstein (https://github.com/ElementsProject/lightning/issues/625).

bitcoin-cli exited with code 1: error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)

lightningd(4817): bitcoin-cli exited with code 1: error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)

My .bitcoin/testnet3/bitcoin.config has:

rpcport=35001
port=8334
jb55 commented 6 years ago

Hans notifications@github.com writes:

Thank you for your quick response @jb55!

No problem. I have some time while I wait to download a 150gb blockchain to buy $3 stickers.

now i'm getting the same issue as reported by @ekerstein (https://github.com/ElementsProject/lightning/issues/625).

Are you running a testnet node? I believe by default it will do testnet unless you specify --network=bitcoin

Cheers,

kryo2k commented 6 years ago

LOL, exactly the same thing i want to do! I am running a testnet locally. I want to play with some test coins before burning real ones.

I just commented out those rpcport & port options in testnet3/bitcoin.conf, and now it started syncing blocks! I believe this is working, and I will be getting stickers soon too!

My guess is that if it works in testnet it should work in mainnet?

Thanks again for help, good luck with downloading the chain!

ekerstein commented 6 years ago

Just to clarify @kryo2k, the lightningd issue went away when you removed those items from your config? I'll try it as well.

EDIT: I don't have either rpcport or port in my config, i.e. I'm running default.

practicalswift commented 6 years ago

To make things more friendly for new c-lightning users we could perhaps add more helpful error messages for the most common failure scenarios:

Any other common failure scenarios for users just getting started with c-lightning? :-)

instagibbs commented 6 years ago
jb55 commented 6 years ago

@practicalswift writes:

To make things more friendly for new c-lightning users we could perhaps add more helpful error messages for the most common failure scenarios

Agreed. Let's open an issue/pr.

kryo2k commented 6 years ago

Just to clarify @kryo2k, the lightningd issue went away when you removed those items from your config? I'll try it as well.

Yes @ekerstein, when I commented out those lines and restarted lightning it worked for me. With those options defined, I could not get it working. Maybe there should be an RPC port config parameter on lightningd (if it couldn't find it in conf file)? I couldn't find one.

Off topic from original issue; but now I am having issues trying to use https://starblocks.acinq.co and https://htlc.me/. I constantly get "Could not find a route" after connecting to and funding a payment channel. I'm probably doing something wrong. Does anyone know which channel(s) should be used for either of the above demos?

cdecker commented 6 years ago

How many confirmations does your channel have? If you are directly connected and have 2 confirmations (might be more depending on the other endpoint's requirements) that should not happen. Can you provide the output from lightning-cli getpeers?

kryo2k commented 6 years ago

Hello @cdecker. I probably did not have enough confirmations after I funded and tested yesterday. Here's the current output:

{
   "peers":[
      {
         "state":"CHANNELD_NORMAL",
         "netaddr":[
            "81.27.36.90:9735"
         ],
         "peerid":"021a45969aea11e8a306defcecf52029628c98f7e900941e2fd4f628ccf2aece28",
         "connected":true,
         "owner":"lightning_channeld",
         "channel":"1259402:280:0",
         "msatoshi_to_us":15000000,
         "msatoshi_total":15000000
      }
   ]
}

I just attempted to pay an invoice on testnet at starblocks, when executing lightning-cli pay <bolt11> it hangs there for a long time. As I'm writing it hasn't ended yet.. I do see output from lightningd, need me to include it?

cdecker commented 6 years ago

Yes, could you upload that to gist.github.com?

cdecker commented 6 years ago

I'm guessing you were using the following route:

021a45969aea11e8a306defcecf52029628c98f7e900941e2fd4f628ccf2aece28 03a2c860079a31f5a0183041c2d8405f4ae4bba651f2ddc5c17ec09b85f054eef5 03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134

Wondering were it is stuck.

kryo2k commented 6 years ago

Interesting, I just tried this again with a new bolt11, but now i'm getting a different error (see below). Included full log here (https://gist.github.com/kryo2k/428cd1fcd91777fac43d1d60dc103876).

lightning_channeld(24241): TRACE: Trying commit
lightning_channeld(24241): TRACE: Can't send commit: nothing to send
lightning_channeld(24241): TRACE: peer_out WIRE_REVOKE_AND_ACK
lightning_channeld(24241): TRACE: Read decrypt 0087d093bdd4f805be875e01928fd81ee7ad6ac4d3fd1ba21557a62af952e0fed1240000000000000000ebe2a52727278884688dad89880aa408963b150adb24d93c52716bff78dc66451007
lightning_channeld(24241): TRACE: peer_in WIRE_UPDATE_FAIL_MALFORMED_HTLC
lightning_channeld(24241): STATUS_FAIL_PEER_BAD: Bad update_fail_malformed_htlc failure code 4103
lightningd(24150): peer 021a45969aea11e8a306defcecf52029628c98f7e900941e2fd4f628ccf2aece28: Peer permanent failure in CHANNELD_NORMAL: lightning_channeld: Bad update_fail_malformed_htlc failure code 4103
lightningd(24150):   (tx 9ca59915b2eacf288445f895d4741c15be6c6318424015eaa841c443a236ccea)
lightningd(24150): sendrawtransaction: 02000000000101d093bdd4f805be875e01928fd81ee7ad6ac4d3fd1ba21557a62af952e0fed1240000000000a37e8c8000040047304402200523b099a3d92778859e03fcd41e8f1b2fe8971e6c07fe13b31fecee021926b902202d70b54bda2a5da5dfe5a3275b6845657556b4ec73d39d7b9489779c9102078b01483045022100f7e9d5eec404f44a95bd028d7629290ef08931129bcc59eb0df8d41886dae6cb022025db2de461a6bf1cff0c96a7fb0ab75953df8b1013878fdb1b3b9a5d4fc65298014752210230067d44029a8f9ca479d33910b14921d6e5bc1d392a71c04cf2130c18fc68a02103eb6c42f3842e6a7e7deda268176661e67f829270fb40787bb09ecdd226fa962d52ae34829b20
lightningd(24150): sendrawtx exit 26, gave error code: -26
error message:
16: bad-txns-vout-empty
kryo2k commented 6 years ago

Going to try this again, as lightning-cli listfunds shows no outputs. Maybe something went thru and debited on my balance. I'll follow-up shortly.

cdecker commented 6 years ago

That's a permanent failure, resulting in the channel being closed. Apparently there weren't enough funds to pay for a close transaction, meaning it created an empty one that is invalid. This is probably the same issue as #632. May I ask how many funds where in the channel and what network this was on?

kryo2k commented 6 years ago

Sure, i put 1500 tsats. I just deposited another 2 tBTC, waiting for funds to appear. Funding address: https://live.blockcypher.com/btc-testnet/address/2MzM7EugYLhNBvqmRRjwKwdfoJaNYCPqTEJ/

jb55 commented 6 years ago

The same thing happened to me on mainnet and it created/broadcasted this transaction (1500 bits input was the funding amount):

https://blockchain.info/tx/fcda029c90e11d4287f8b90a29ffc2ba3863476eec1818a84eaed097672b6781

lightning_channeld(15295): STATUS_FAIL_PEER_IO: peer read failed: Connection timed out
lightningd(11089): peer 02eccebd9ed98f6d267080a58194dbe554a2b33d976eb95bb7c116d00fd64c4a13: Peer transient failure in CHANNELD_NORMAL: Owning subdaemon lightning_channeld died (33792)
lightning_channeld(6861): STATUS_FAIL_PEER_BAD: Bad update_fail_malformed_htlc failure code 4103
lightningd(11089): peer 02eccebd9ed98f6d267080a58194dbe554a2b33d976eb95bb7c116d00fd64c4a13: Peer permanent failure in CHANNELD_NORMAL: lightning_channeld: Bad update_fail_malformed_htlc failure code 4103
lightningd(11089):   (tx fcda029c90e11d4287f8b90a29ffc2ba3863476eec1818a84eaed097672b6781)
lightning_channeld(17795): STATUS_FAIL_PEER_IO: peer read failed: Connection timed out
lightningd(11089): peer 02c0ac82c33971de096d87ce5ed9b022c2de678f08002dc37fdb1b6886d12234b5: Peer transient failure in CHANNELD_NORMAL: Owning subdaemon lightning_channeld died (33792)
lightning_channeld(18084): STATUS_FAIL_PEER_IO: peer read failed: Connection timed out
lightningd(11089): peer 028501e256154aa4aa513acfc1ca498ae3e9f1a305f5c79ec0918b67ebbc78a796: Peer transient failure in CHANNELD_NORMAL: Owning subdaemon lightning_channeld died (33792)
lightningd(11089): peer 02eccebd9ed98f6d267080a58194dbe554a2b33d976eb95bb7c116d00fd64c4a13: Peer permanent failure in CHANNELD_NORMAL: Funding transaction spent
lightningd(11089):   (tx fcda029c90e11d4287f8b90a29ffc2ba3863476eec1818a84eaed097672b6781)
lightningd(11089): peer 02eccebd9ed98f6d267080a58194dbe554a2b33d976eb95bb7c116d00fd64c4a13: state: CHANNELD_NORMAL -> FUNDING_SPEND_SEEN
lightningd(11089): peer 02eccebd9ed98f6d267080a58194dbe554a2b33d976eb95bb7c116d00fd64c4a13: state: FUNDING_SPEND_SEEN -> ONCHAIND_OUR_UNILATERAL

and now my node constantly tries to broadcast:

lightningd(22912): Broadcasting tx 02000000000101e48d445aa94e72d431f1f03abffaebf2f27deb72e819c6ff2633796ad84390aa000000000053ff6d80000400483045022100dff4505b2d9021f61e73eb9d24761f65ab59fd772efaaadec22e338ac239f0c6022025e95f58f42ab3d7270513f2500de4f5ed7ad0a669300e5d4f77c3347ba59ba20147304402204007dfb516336ff2fe03f959acb49b4175a726fc5eb4d3010eb836a1dfcae4000220126e795bafea7cbd099a1aca19c234c804734ea7948ae66db1ad65c9cf9ad8160147522102373c252a6bfe128d94af1a3b63be66915021b4d76b078a2ae441fb1d13004fed2102c122dd01b786eb805fdfa81c082fbd601e169f887ea6083de381daed611a4dfd52ae3f7e7c20: 26 error code: -26
error message:
16: bad-txns-vout-empty

unrelated question if anyone could help me out: how do I view p2wsh witness scripts? decoderawtransaction and decodescript don't seem to work?

kryo2k commented 6 years ago

Managed to get back to the "could not find route" problem, after filling up my deposit address. Here's what I got:

$ ./lightning-cli listfunds
{
  "outputs": [
    {
      "txid": "4d5f890432554835af25b3f11c96f90c2167dfac02effd9d483a647765d76f75",
      "output": 0,
      "value": 6875000
    },
    {
      "txid": "4745f77476e71ac87cfad2e013d9c94fea556878d23069b5781e82c38b36567d",
      "output": 0,
      "value": 27500000
    },
    {
      "txid": "14c98bf9d6506df6f41ab6ec1ae2c5b526e6527994adbdbe51332db6a1947ee1",
      "output": 0,
      "value": 55000000
    },
    {
      "txid": "d51059e86e4c33b044d8df7e3c15cfe179e93e1c8de0ea5cadf06206e46badfb",
      "output": 0,
      "value": 13750000
    },
    {
      "txid": "9266fd54721829550048320ee3d941eb8c3ba2f9c1a0e78eb95c01fd71e8e6f9",
      "output": 0,
      "value": 110000000
    }
  ]
}

Funds are credited here. Currently 1/6 confirmations.

$ ./lightning-cli getpeers
{
  "peers": [
    {
      "state": "CHANNELD_NORMAL",
      "netaddr": [
        "81.27.36.90:9735"
      ],
      "peerid": "021a45969aea11e8a306defcecf52029628c98f7e900941e2fd4f628ccf2aece28",
      "connected": false,
      "channel": "1259402:280:0",
      "msatoshi_to_us": 15000000,
      "msatoshi_total": 15000000
    }
  ]
}

Still connected from before

$ ./lightning-cli fundchannel 021a45969aea11e8a306defcecf52029628c98f7e900941e2fd4f628ccf2aece28 50000000
"Funding satoshi must be <= 16777215"

Just curious, why?

$ ./lightning-cli fundchannel 021a45969aea11e8a306defcecf52029628c98f7e900941e2fd4f628ccf2aece28 16777215
"Peer already CHANNELD_NORMAL"

I guess this is because I'm already connected to this peer?

$ ./lightning-cli pay lntb15u1pdxz86hpp5ax87jmw2fqclzq6pdlmpayx3dqf4q0zgj9ptx400rujcp7x33duqdq4xysyymr0vd4kzcmrd9hx7uhr5an8rnkezqzpa95t229v2jkqh9hhef3g4eh3hq2af9mvmf4p9sxdl29nrue3rw9j2ymympxqugjtsa2gxqfuy2upncqjqlce8jwspa9qt4r
"Could not find a route"

Meanwhile in lightningd log:

lightning_gossipd(5505): TRACE: req: type WIRE_GOSSIP_GETROUTE_REQUEST len 78
lightning_gossipd(5505): TRACE: Trying to find a route from 036bbe5043d439c8cf8cc665af216adaf1a085541fa9ea027333a41386b14870dc to 035b55e3e08538afeef6ff9804e3830293eec1c4a6a9570f1e96a478dad1c86fed for 1500000 msatoshi
lightning_gossipd(5505): TRACE: find_route: cannot find 035b55e3e08538afeef6ff9804e3830293eec1c4a6a9570f1e96a478dad1c86fed
lightning_gossipd(5505): REPLY WIRE_GOSSIP_GETROUTE_REPLY with 0 fds

I also just noticed that all payments are pending?

$ ./lightning-cli listpayments
[
  {
    "id": 1,
    "incoming": false,
    "payment_hash": "bc437e7c50403e24dcc477d0ff6231747182d8d37050d1fdbedd34f5f97ead8f",
    "destination": "035b55e3e08538afeef6ff9804e3830293eec1c4a6a9570f1e96a478dad1c86fed",
    "msatoshi": 1500000,
    "timestamp": 1516309743,
    "status": "pending"
  },
  {
    "id": 2,
    "incoming": false,
    "payment_hash": "5bd0a57398f164d1964c91d250cd4590949c5ffe1cb8d92e86217850825813b9",
    "destination": "035b55e3e08538afeef6ff9804e3830293eec1c4a6a9570f1e96a478dad1c86fed",
    "msatoshi": 1500000,
    "timestamp": 1516310664,
    "status": "pending"
  },
  {
    "id": 3,
    "incoming": false,
    "payment_hash": "a039a026efc49c5e6572fed0ad7c91b2db58691f2f2e804b6e36892d284bb762",
    "destination": "035b55e3e08538afeef6ff9804e3830293eec1c4a6a9570f1e96a478dad1c86fed",
    "msatoshi": 1500000,
    "timestamp": 1516311074,
    "status": "pending"
  }
]

I will try this invoice again once I have 2 confs.

EDIT: Now with 2 confs, tried again and still reponse with "Could not find a route".

cdecker commented 6 years ago

Just curious, why?

We don't want people create large channels until we are confident about the stability, and people have some experience with the clients, foot-gunning protection.

"Could not find a route"

Are you sure that there actually is a path from you to your destination? Otherwise it could be gossip is not sync'd just yet.

brmdbr commented 6 years ago

I'm having the same issue as op, bitcoin-cli is in PATH and bitcoind is running.

user:/mnt/d/lightning$ lightningd/lightningd --network=testnet --log-level=debug --bitcoin-datadir="/mnt/d/Bitcoin"

lightningd(93): Trying to guess public addresses...
lightningd(93): Address 192.168.0.108:9735 is not routable
lightningd(93): Failed to connect 10 socket: Invalid argument
lightningd(93): testing /mnt/d/lightning/lightningd/lightning_channeld
lightningd(93): testing /mnt/d/lightning/lightningd/lightning_closingd
lightningd(93): testing /mnt/d/lightning/lightningd/lightning_gossipd
lightningd(93): testing /mnt/d/lightning/lightningd/lightning_hsmd
lightningd(93): testing /mnt/d/lightning/lightningd/lightning_onchaind
lightningd(93): testing /mnt/d/lightning/lightningd/lightning_openingd
lightningd(93): HSM TRACE: Client: Received message 11 from client
lightningd(93): Loaded 0 invoices from DB
lightningd(93): HSM TRACE: Client: Received message 9 from client
lightning_gossipd(101): pid 101, msgfd 12
lightningd(93): Loaded 0 channels from DB
bitcoin-cli exec failed: No such file or directory
lightningd(93): bitcoin-cli exec failed: No such file or directory
Log dumped in crash.log
lightningd(93): FATAL SIGNAL 6 RECEIVED
lightningd(93): backtrace: lightningd/log.c:436 (log_crash) 0x41047f
lightningd(93): backtrace: (null):0 ((null)) 0x7f90f1d86caf
lightningd(93): backtrace: (null):0 ((null)) 0x7f90f1d86c37
lightningd(93): backtrace: (null):0 ((null)) 0x7f90f1d8a027
lightningd(93): backtrace: lightningd/log.c:525 (fatal) 0x4108b7
lightningd(93): backtrace: lightningd/bitcoind.c:668 (wait_for_bitcoind) 0x4053a5
lightningd(93): backtrace: lightningd/chaintopology.c:726 (setup_topology) 0x4079a9
lightningd(93): backtrace: lightningd/lightningd.c:325 (main) 0x40ee14
lightningd(93): backtrace: (null):0 ((null)) 0x7f90f1d71f44
lightningd(93): backtrace: (null):0 ((null)) 0x403158
lightningd(93): backtrace: (null):0 ((null)) 0xffffffffffffffff
Fatal signal 6. 0x410565 log_crash
        lightningd/log.c:462
0x7f90f1d86caf ???
        ???:0
0x7f90f1d86c37 ???
        ???:0
0x7f90f1d8a027 ???
        ???:0
0x4108b7 fatal
        lightningd/log.c:525
0x4053a5 wait_for_bitcoind
        lightningd/bitcoind.c:668
0x4079a9 setup_topology
        lightningd/chaintopology.c:726
0x40ee14 main
        lightningd/lightningd.c:325
0x7f90f1d71f44 ???
        ???:0
0x403158 ???
        ???:0
0xffffffffffffffff ???
        ???:0
Log dumped in crash.log
Overtorment commented 6 years ago

@BramdeBoer probably bitcoind runs on mainnet and youre trying lightning on testnet (they have different ports)

practicalswift commented 6 years ago

I've now submitted PR #1192 which provides more user-friendly error messages common failure scenarios for new users.

practicalswift commented 6 years ago

Somewhat related – I have submitted this PR to Bitcoin Core in order to make the combined c-lightning/bitcoind onboarding experience less confusing :-)