Issue after building cardano-sl from nix build mode

Hello there!

I built cardano-sl as per the Stack with Nix for system libraries (mixed mode) instructions posted here:

The exact steps were:

Install nix using: curl https://nixos.org/nix/install | sh

Add the binary caches:

johnny@pesos-linux:~$ sudo cat /etc/nix/nix.conf
binary-caches = https://cache.nixos.org https://hydra.iohk.io
binary-cache-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=

the run:
nix-build -A cardano-sl-static --cores 0 --max-jobs 2 --no-build-output --out-link master

johnny@pesos-linux:~/cardano-sl$ ls master/bin
cardano-node-simple

Everything checks out good up to here.

What is next?

I assumed I needed to run the assertiontest but get the following error when I launch tmux:

-bash: shopt: progcomp: invalid shell option name
complete: command not found
complete: command not found
complete: command not found
and it keeps repeating “complete: command not found” from here on out.

Did I miss something?

Please advise…

I also assumed I would be able to launch “cardano-node” from command line but that fails as well.

johnny@pesos-linux:~/cardano-sl$ cardano-node
cardano-node: command not found

Please advise…

It could be an issue of stack path --local-install-root. This CLI is involved in binary lookup, if you run some shell script from cardano-sl/scripts/launch directory.

So in my case stack path --local-install-root shows cardano-sl/.stack-work/install/x86_64-linux/lts-9.1/8.0.2 but binary installation is in ``cardano-sl/.stack-work/install/x86_64-linux-nix/lts-9.1/8.0.2`.

That seems to be the reason for “command not found” error.

I didn’t run the demos for a while but I handn’t have any issue at the end of last year;-)

I’ll try to clean up my stuff, rebuild cardano-sl projects and report the result soon.

link to issue report includes a patch could help to solve the issue temporary.

Next step to actually run, should be this (and ensure you run this from inside the Cardano SL directory!):
To build a script that will contain everything needed to connect to mainnet:
$ nix-build -A connectScripts.mainnetWallet -o connect-to-mainnet

then “./connect-to-mainnet” and you should be running.

Other build options here:

Hope that helps!

1 Like

Your next step to run cardano-sl should be:

nix-build -A connectScripts.mainnetWallet -o connect-to-mainnet

This command will let Nix build a script for you to run the node and connect it to the cluster.

If your OS supports the systemd system, I suggested to run ./connect-to-mainnet as a system service:

sudo vi /etc/systemd/system/cardano-sl.service

Add this to the file:

After=network.target

[Service]
ExecStart=/CHANGE_IT_TO_YOUR_PATH/cardano-sl/connect-to-mainnet
Restart=always

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl enable cardano-sl.service
sudo systemctl start cardano-sl.service

The benefit of using a service instead of running it directly is to help you track the status and logs of the whole process:

sudo systemctl status cardano-sl
sudo journalctl -r -u cardano-sl
1 Like

Thank you for the response.

I made the changes suggested above and receive the following error:

 Failed to start connection.service: Unit connection.service not found.

I am running Ubuntu 16.04.3 LTS|

I’d try substituting that for connection.service. (Just on general principles, I know nothing about this!)

Sorry, it was a typo. You should use:

sudo systemctl start cardano-sl.service
1 Like