Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: lapidary on November 06, 2020, 01:40:06 PM



Title: c-lightning on ubuntu
Post by: lapidary on November 06, 2020, 01:40:06 PM
Hello all,

I have Ubuntu 20, I did snap install bitcoin-core, now I want c-lightning, but can't see to make it work.  I can add the PPA for lightning network, install it; but it can't find bitcoin. 
Quote
bitcoin-cli not found.
  Do I need to reinstall bitcoin in a different way than snap? I would like to preserve my blockchain and bitcoin.conf (yes I have a backup of that)

Does anyone have a tutorial I can follow?


Title: Re: c-lightning on ubuntu
Post by: Rath_ on November 06, 2020, 01:45:21 PM
Does anyone have a tutorial I can follow?

What instructions have you followed so far? You can try following these instructions (https://github.com/ElementsProject/lightning/blob/master/doc/INSTALL.md#to-build-on-ubuntu) instead. Bitcoin Core installation using snap is also described there. The following command might help you with your error.

Code: (https://github.com/ElementsProject/lightning/blob/master/doc/INSTALL.md#to-build-on-ubuntu)
# Snap does some weird things with binary names; you'll
# want to add a link to them so everything works as expected
sudo ln -s /snap/bitcoin-core/current/bin/bitcoin{d,-cli} /usr/local/bin/


Title: Re: c-lightning on ubuntu
Post by: Carlton Banks on November 06, 2020, 04:20:33 PM
^ good advice


You need to find where snap has put bitcoin-cli, as lightningd is looking for it in the wrong place

/usr/bin or /usr/local/bin are typical directories (folders) for installing programs, but it seems snap puts programs installed using it in a different place

...and...

Beware! Don't be surprised in the future if snap "updates" the place where bitcoin-cli etc is installed, then the link in @Rath's post will stop working (the ln -s terminal command)


My advice: learn how to install programs _without_ snap packages, the sooner you do it, the faster you can say goodbye to this kind of problem


Title: Re: c-lightning on ubuntu
Post by: Carlton Banks on November 06, 2020, 04:33:59 PM
Does anyone have a tutorial I can follow?

so here is my tutorial :D

1. Open Terminal, do sudo find / -name bitcoin-cli
2. Take the result, and do ln -s /usr/local/bin <result>
3. Don't forget that Snap might change all this later! Then you have the fun of doing it all again


Title: Re: c-lightning on ubuntu
Post by: lapidary on November 06, 2020, 08:54:56 PM
I'm getting closer; making a link is good; but my node rpc listens on my local IPv4 address and not on localhost.  so I think that is why it still is complaining about not finding bitcoin-cli.  Does c-lighting have a config setting for host user and password?


Title: Re: c-lightning on ubuntu
Post by: AdolfinWolf on November 06, 2020, 08:59:47 PM
I'm getting closer; making a link is good; but my node rpc listens on my local IPv4 address and not on localhost.  so I think that is why it still is complaining about not finding bitcoin-cli.  Does c-lighting have a config setting for host user and password?
I don't use C-Lightning, but did you check out this documentation here? https://lightning.readthedocs.io/lightningd-config.5.html


Title: Re: c-lightning on ubuntu
Post by: lapidary on November 06, 2020, 09:54:50 PM
ah, thanks!

nothing as good as proper documentation.  --bitcoin-cli --bitcoin-rpcuser and --bitcoin-rpcpassword; now it's happy!!  So much more to learn; but at least it's running


Title: Re: c-lightning on ubuntu
Post by: ABCbits on November 07, 2020, 10:13:55 AM
For future reference, you can run Bitcoin Core directly with these command

Code:
snap run bitcoin-core.cli
snap run bitcoin-core.daemon
snap run bitcoin-core.qt

/usr/bin or /usr/local/bin are typical directories (folders) for installing programs, but it seems snap puts programs installed using it in a different place

Some documentation mention it's on /snap/bin. It store all application installed by Snap, but if you run ls -l, you will find out,
1. The application actually only act as symbolic links.
2. Snap change default binary name of an application (e.g. bitcoin-cli become bitcoin-core.cli)

But alternatively you could find the executable by using command lsblk, then see which mountpoint belong to application (e.g. Bitcoin Core at /snap/bitcoin-core/319).

Code:
$ cd /snap/bitcoin-core/319
$ ls
bin  command-cli.wrapper  command-daemon.wrapper  command-qt.wrapper  etc  flavor-select  lib  meta  share  snap  usr  var
$ cd bin
$ ls
bitcoin-cli  bitcoind  bitcoin-qt  desktop-launch

TLDR, snap provide easy installation, but annoying for everything else.