Ayush Gupta
Ayush Gupta

Reputation: 121

How do I resolve the error on hyperledger fabric?

While trying to follow tutorial on building your first network I've got following output:

$  ./byfn.sh -m generate

Generating certs and genesis block for with channel 'mychannel' and CLI timeout of '10000' Continue (y/n)? y proceeding ... which: no cryptogen in (/c/users/ayush/fabric-samples/first-network/../bin:/c/users/ayush/fabric-samples/first-network:c:/users/ayush/bin:/c/Users/ayush/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Program Files/Docker Toolbox:/c/Users/ayush/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/ayush/bin:/c/ProgramData/Oracle/Java/javapath:/c/Program Files/Docker/Docker/Resources/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/cmd:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Gradle/gradle-3.3/bin:/c/Go/bin:/c/Program Files/nodejs:/c/Users/ayush/AppData/Local/Programs/Python/Python36/Scripts:/c/Users/ayush/AppData/Local/Programs/Python/Python36:/c/Users/ayush/AppData/Local/Microsoft/WindowsApps:/c/python:/c/Program Files/Docker Toolbox:/c/Users/ayush/AppData/Roaming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/bin/vendor_perl:/usr/bin/core_perl) cryptogen tool not found. exiting

What is the problem and how can I get it solved?

Upvotes: 12

Views: 14848

Answers (11)

Shweta Gupta
Shweta Gupta

Reputation: 776

Download the platform-specific binaries after cd into your workspace.

curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/v1.4.0/scripts/bootstrap.sh | bash

and make sure your version of binaries matches your configuration file.

Upvotes: 0

Vipul Dabhi
Vipul Dabhi

Reputation: 19

Probably have missed this Step

Download Platform-specific Binaries

https://hyperledger-fabric.readthedocs.io/en/release-1.1/samples.html

run command in cd Fabric-Samples

Upvotes: 0

Deepak Bhatta
Deepak Bhatta

Reputation: 474

Unless you close the terminal, following solution works:

export PATH=$PATH:PATH_TO_FABRIC_SAMPLES/bin

Upvotes: 0

Thanga Mariappan P
Thanga Mariappan P

Reputation: 81

Step1: cd fabric-samples

Step2:

curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/v1.0.5/scripts/bootstrap.sh | bash -s 1.0.5

Step3: cd fabric-samples/first-network

Step4: ./byfn.sh -m generate

You will see a brief description as to what will occur, along with a yes/no command line prompt. Respond with a y or hit the return key to execute the described action.

Upvotes: 2

Artem Barger
Artem Barger

Reputation: 41222

The key of you problem is in the last sentence:

cryptogen tool not found. exiting

You need to make sure to have cryptogen tool compiled prior to trying run the example with ./byfn.sh. Just run from fabric home folder:

make cryptogen configtxgen peer orderer peer-docker orderer-docker tools-docker

Update

You are missing: "Platform specific binaries", see here how to get them.

Upvotes: 10

Thao Nguyen Tien
Thao Nguyen Tien

Reputation: 869

Please follow below steps to resolve this issue:

1.Download the platform-specific binaries using command

curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s 1.1.0"

Once you run the command it will download various tools like cryptogen, configtxgen etc under bin directory.

1.add the bin directory to your PATH variable using below command export PATH=./bin:$PATH

Upvotes: 2

Anand Soni
Anand Soni

Reputation: 186

The main problem is in the last line of error which says "cryptogen tool not found. exiting"

Please follow below steps to resolve this issue-

  1. Download the platform-specific binaries using command

curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/v1.0.5/scripts/bootstrap.sh | bash -s 1.0.5

Once you run the command it will download various tools like cryptogen, configtxgen etc under bin directory.

  1. add the bin directory to your PATH variable using below command

export PATH=$PATH:[path-to-bin-directory]

now try to build the network again. I hope this helps someone.

Upvotes: 2

Sindelio
Sindelio

Reputation: 1

cryptogen command is under the bin directory where you installed (or uncompressed) the fabric tarball. So you just need to update your $PATH variable so that the shell knows where the cryptogen command can be found. This code should work:

export "$PATH:/<home>/<fabric>/bin"

Where <home> is your home directory, such as /home/sindelio and <fabric> is where the fabric was installed.

Upvotes: 0

chan zanway
chan zanway

Reputation: 51

I got the answer now. This issue is caused by the lack of cryptogen, which is indeed a command tool. The simplest way to get it is to download the platform specific binaries into your local machine, here is the sh:

cd fabric-samples
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap-1.0.1.sh | bash

This sh will download a bash file which would pull the latest Fabric docker images and the platform specific tools, its content is as below:

#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

export VERSION=1.0.1
export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}')
#Set MARCH variable i.e ppc64le,s390x,x86_64,i386
MARCH=`uname -m`

dockerFabricPull() {
  local FABRIC_TAG=$1
  for IMAGES in peer orderer couchdb ccenv javaenv kafka zookeeper tools; do
      echo "==> FABRIC IMAGE: $IMAGES"
      echo
      docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG
      docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES
  done
}

dockerCaPull() {
      local CA_TAG=$1
      echo "==> FABRIC CA IMAGE"
      echo
      docker pull hyperledger/fabric-ca:$CA_TAG
      docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca
}

: ${CA_TAG:="$MARCH-$VERSION"}
: ${FABRIC_TAG:="$MARCH-$VERSION"}

echo "===> Downloading platform binaries"
curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/hyperledger-fabric-${ARCH}-${VERSION}.tar.gz | tar xz

echo "===> Pulling fabric Images"
dockerFabricPull ${FABRIC_TAG}

echo "===> Pulling fabric ca Image"
dockerCaPull ${CA_TAG}
echo
echo "===> List out hyperledger docker images"
docker images | grep hyperledger*

Now it is based on Fabric 1.0.1, you can find the latest version of this bash from here : http://hyperledger-fabric.readthedocs.io/en/latest/samples.html

After the sh execution is completed, there will be a folder named bin in current directory, then copy the files under this folder into a searchable folder, such as

cp ./bin/*  $GOROOT/bin

Then you can test if the cryptogen exists by type command:

which cryptogen

Upvotes: 2

Robert Tomas G IV
Robert Tomas G IV

Reputation: 2385

If you're using a mac, do the following in terminal:

brew tap hyperledger/fabric

brew install fabric-tools

and then try again with ./byfn.sh -m generate command

Upvotes: 2

adnan.c
adnan.c

Reputation: 721

Not sure if its still an issue or not..... You can either try to use what @Artem already mentioned, or you can add the ......fabric-samples/bin folder to your path, which has the tools. its the same fabric-samples folder that has the byfn.sh

Upvotes: 0

Related Questions