How do I resolve the error on hyperledger fabric? - 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?

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.

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

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

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-
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.
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.

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

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.

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

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.

Unless you close the terminal, following solution works:
export PATH=$PATH:PATH_TO_FABRIC_SAMPLES/bin

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

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.

Related

Error while downloading platform specific binaries for hyperledger fabric in

I'm trying to install hyperleger fabric in UBUNTU 18.04 TS.. following this link
My specifications are
OS UBUNTU 18.04 TS
curl 7.58.0
Docker 19.03.6
nodejs 8.10.0
npm 5.6.0
python 2.7.17
git version 2.17.1
When I get to the part of installing the binaries and docker images using curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh. I tried with a shortend link as shown in this image shortened link 1
The fabric samples get installed but the binaries that include the bin and config files are not installed. I have tried including version identifiers to download specific versions. I'm getting error
gzip: stdin: not in gzip format
tar: child return status 1
tar: error is not recoverable: exiting now
===> there was an error downloading binary file.
See this image for more information terminal output. shortened link and still end up with the same issue.
Can someone help me solve this? Thanks in advance..
ps. this is my first time in stack overflow and I'm unable to post the shortened url and have included them as shortened links..
edit
I tried to extract the bin and config folders by downloading the specific binary versions from github under assets as mentioned below by one of the users(I downloade the 1.4.8 version)..
But when I try to bring up the network from first-network dotrectory it throws up the following error..
You can substitute the un-shortened URL with this command:
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/release-2.2/scripts/bootstrap.sh | bash -s
After bash -s, you can put your version specific parameters, like
bash -s -- <fabric_version> <fabric-ca_version>
So for fabric version 2.2.0 and fabric-ca-version 1.4.8:
bash -s -- 2.2.0 1.4.8
So the un-shorted URL will be
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/release-2.2/scripts/bootstrap.sh | bash -s -- 2.2.0 1.4.8
Link of the source:
https://hyperledger-fabric.readthedocs.io/en/latest/install.html#
I had similar problems trying to use the provided bootstrap script. For me it made sense in some cases to check the page directly https://github.com/hyperledger/fabric/releases to understand:
whether the version I try to download exists
whether the link built by the script is correct
From this page you can download the binaries directly per click, you find them under assets.

Unable to run Cryptogen

I try to run Cryptogen but an error appears, when I'm executing the command.
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap-
1.0.1.sh | bash
bash: line 1: 404:: command not found
You have a long way to go. And your question is incomplete. You need to tell us he operating system you are using. Also, the version of the Hyperledger Fabric documentation that you found this at.
The command that you ran only downloads the code, binaries, and docker images. It looks like you are trying to run this:
https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh
which is then piped into bash. But it is failing to find that URL.

Error when trying to bring up the test network

I trying to follow tutorials and develope on Ubuntu. Then get an error when comes to "Bring up the test network" part. I successfully run the following command to print the script help text of the test network.
./network.sh -h
When I want to run the next command to bring up the network
./network.sh up
I get the message as follow
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'
ERROR! Peer binary and configuration files not found..
May somebody tells me what's happened? Kindly helps.
I had the same issue, looks like you need to fetch system specific binaries:
https://hyperledger-fabric.readthedocs.io/en/release-2.2/test_network.html
I ran the curl command in the root dir without specifying the versions.
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s
Make sure you add the ./bin to .gitignore
Be sure to use
./network.sh up
from the test network folder and that test network folder is contained in fabric samples, because it could use binaries from different directories contained inside fabric samples and moving it could cause your error.
Also try to set this environment variable
FABRIC_CFG_PATH=$PWD
to force Fabric to be launched in your test network folder
first bring down the network to clean up
cd test-network
./network.sh down
start the network agian
./network.sh up
Before you can deploy the test network, you need to follow the instructions to Install the Samples, Binaries and Docker Images in the Hyperledger Fabric documentation.

Installing Jenkins Plugins to Docker Jenkins

I have the following Dockerfile with jenkins as the base image:
FROM jenkins
USER root
ENV JENKINS_MIRROR http://mirrors.jenkins-ci.org
RUN for plugin in git-client git ws-cleanup ; do wget -O $JENKINS_HOME/plugins/${plugin}.hpi $JENKINS_MIRROR/plugins/${plugin}/latest/${plugin}.hpi ; done
EXPOSE 8080
I'm trying to install some additional plugins but it gives me an error saying no such file or directory
I then started and connected to the container of this build step in order to "debug" the error:
However, I could not find out the cause because every directory seems to exist. Furthermore, if I then run the for-loop manually in the bash, all plugins are installed correctly...
I further noticed, that the installation of the the plugins works, if I install them in the root directory as follows:
RUN for plugin in git-client git ws-cleanup ; do wget -O ${plugin}.hpi $JENKINS_MIRROR/plugins/${plugin}/latest/${plugin}.hpi ; done
However, this is the wrong place as they have to be placed in the directory $JENKINS_HOME/plugins
Why I am not able to install the plugins in $JENKINS_HOME/plugins?
I can't read your screenshots, but you don't seem to be following the official instructions. See https://github.com/cloudbees/jenkins-ci.org-docker under "Installing more tools". Note:
You should save the plugins to /usr/share/jenkins/ref/plugins
You could use a plugins.txt file instead, which contains the names of your plug-ins, and you can process with the provided plugins.sh script. This looks like:
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/plugins.txt
I think the reason your approach wasn't working was to do with some processing in the start-up script.
install-plugins.sh is deprecated. I had to switch to jenkins-plugin-cli:
FROM jenkins/jenkins
...
RUN jenkins-plugin-cli \
--plugins \
git \
workflow-aggregator \
blueocean \
other-plugins
jenkins-plugin-cli also supports -f parameter, which gets the list of plugins as a file.
See Jenkins Official Documentation for details.

Composer & Cygwin

Composer doesn't run correctly in Cygwin if you try to install it "globally".
Putting composer.phar into /usr/local/bin/composer, then trying to run it will result in the error:
Could not open input file: /usr/local/bin/composer
Just tripped over the same problem and found a solution. Posting it here, just in case I'll ever have to look it up again.
Set up a bin directory right under /home/my-username:
cd ~
mkdir bin
Move the composer.phar (or any other of those nifty new PHP imps that are on the rise)
into the ~/bindirectory and make sure to set it's execution bit:
# Notice how I got rid of the superfluous `.phar` extension
mv /path/to/composer.phar ~/bin/composer
chmod +x ~/bin/composer
Tell cygwin to include your ~/bin directory in the search path:
Open up the file ~/.bash_profile and uncomment the following paragraph ...
# Set PATH so it includes user's private bin if it exists
if [ -d "${HOME}/bin" ] ; then
PATH="${HOME}/bin:${PATH}"
fi
Now, for the most important part:
A wrapper script that helps Win's native PHP resolve Unix style paths (which is causing
the problem after all as Windows doesn't know how to handle /cygdrive/... paths).
cd ~/bin
touch php
chmod +x php
After editing the wrapper script ~/bin/php should read:
#!/bin/bash
# e.g. php="/cygdrive/c/Program Files (x86)/php/php.exe"
php="/path/to/php.exe"
for ((n=1; n <= $#; n++)); do
if [ -e "${!n}" ]; then
# Converts Unix style paths to Windows equivalents
path="$(cygpath --mixed ${!n} | xargs)"
case 1 in
$(( n == 1 )) )
set -- "$path" "${#:$(($n+1))}";;
$(( n < $# )) )
set -- "${#:1:$((n-1))}" "$path" ${#:$((n+1)):$#};;
*)
set -- "${#:1:$(($#-1))}" "$path";;
esac
fi
done
"$php" "$#"
Now restart your shell and it should correctly invoke the PHP interpreter whenever it
stumbles upon a #!/usr/bin/env php shebang. Simply issue a:
composer --help
How about this one?
In ~/.bashrc, add: alias composer='php c:\\your\\path\\to\\composer.phar'
Restart cygwin or reload the bashrc by running source ~/.bashrc
Works for me using both Cygwin's native php.exe and XAMPP's Windows-specific one.
I think what might work is to build a proxy instead:
Put composer.phar in /usr/local/bin/composer.phar
Create a bash proxy as /usr/local/bin/composer with the following:
#!/bin/sh
c:/path/to/php c:/path/to/composer.phar $#
chmod +x /usr/local/bin/composer
Try this:
Install Cygwin PHP and use it to run composer in Cygwin.
You can choose one of two ways to work fine with PHP+Composer in Cygwin:
Install Cygwin PHP and install composer.phar in Cygwin.
Install Windows PHP and install Winodows Composer, then call then from Cygwin. (Windows XAMMP+Composer with alias in cmd)
Your problem is caused by that Cygwin Composer is ruining by Windows PHP on Cygwin, so it can not recognize the file path.
After install Cygwin PHP, the composer will integrates with Cygwin PHP then fit to Cygwin's filepath.
Cygwin PHP extensions for composer usage:
php
php-json
php-mbstring
php-phar
php-zip
php-posix
You can install other PHP extension when composer's package is needed such as php-xmlwriter, php-tokenizer, php-ctype.
Installation commands guide:
If you have already installed apt-cyg, there are installation command above:
apt-cyg install php php-json php-mbstring php-phar php-zip php-posix
apt-cyg install php-xmlwriter php-tokenizer php-ctype
Then install Composer via Cygwin PHP:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
chmod +x ./composer.phar
mv ./composer.phar /usr/bin/composer
composer -v
Conclusion
I recommend using Windows PHP + Windows Composer, and call then in Cygwin, it because the Cygwin PHP is not much stable than Windows PHP.
I had the same problem. After reading the final instruction from composer installer, it says that the $PATH variable should be reloaded. I rebooted my computer and then linked the Composer bin to /usr/local/bin.
First locate the composer bin :
/cygdrive/c/ProgramData/ComposerSetup/bin/composer
Then according to Seldaek answer, after trying a non-working symlink, I did :
nano /usr/local/bin/composer
#!/bin/sh
/cygdrive/c/ProgramData/ComposerSetup/bin/composer $#
chmod +x /usr/local/bin/composer
And it's working.
What I did (very simple):
Install Composer normally with the Windows installer
Open a Cygwin console an type composer you will see something like Could not open input file: /c/route/to/your/composer/installation/bin
Create an alias composer='composer.bat' on your bash profile or bashrc or whatever
Done
I'm running Windows 8.1
I was having this issue. Most of the responses were over my head but I fixed it with no problems.
Step 1) Reinstall Composer globally as per https://getcomposer.org/download/
Step 2) Leave it alone. All the special stuff you want to do, don't do that.
Step 3) Download the latest setup-xxx.exe from https://cygwin.com/
Step 4) Click it with your mouse.
NOTE: During step 5 you will feel a sudden urge to read instructions, browse the web for info and start checking little boxes on the menu. Don't do that.
Step 5) Click 'next' until it stops asking. It will look at your existing
settings, fix things up and add any missing dependencies.
This worked for me.
Getting composer to work globally inside Cygwin is a pain in the butt...
The solutions I have come up with:
Don't use it globally. If you are using the PHP CLI from a Windows installation, it won't recognize the Linux paths that Cygwin uses.
What I have done is put it in the base directory of all the projects I use composer with, and do ../composer.phar to run it.
It works fine this way, and it's almost globally available...
Download, and compile your own PHP binaries within Cygwin... Yea, kind of a overkill.
I solved the problem like this in a Cygwin/XAMPP setup:
Install composer.phar to XAMPP's php directory
Create an executable Bash script named composer in XAMPP's php directory:
#!/bin/bash
script_dir=$(cygpath -w $(dirname $0))
php "$script_dir/composer.phar" $#
It's important to use cygpath -w to convert the path to a path in Windows form.
Make sure XAMPP's php directory is accessible in Cygwin's $PATH:
$ export PATH=$PATH:/cygdrive/i/dev/server/xampp/php
Now it's possible to call composer from anywhere you like without problems:
$ composer -V
Composer version 264f433ca3f007d39568b3722b4bf418f58ba15b
I fixed it by adding a /usr/local/bin/composer file:
nano /usr/local/bin/composer
with the following content:
#!/bin/bash
/cygdrive/c/wamp/bin/php/php5.4.3/php "C:\wamp\bin\php\php5.4.3\composer"
Basically, you have to call PHP with a Windows style path, not a cygwin path.
The easiest way is to install composer using the Windows installer from their website and then copy the two files 'composer' and 'composer.phar' from "C:\ProgramData\Composer" into a directory which is in the PATH variable. E.g. you could copy the files into the /bin/ directory of cygwin. Afterwards you can again uninstall the "Windows version" of composer.
Update! This is what I did:
Install PHP and needed modules from the Cygwin Ports project
Download the latest composer snapshot
Rename 'composer.phar' to 'composer' and save it to /usr/local/bin
Open /bin/dash.exe and run '/usr/bin/rebaseall'
Also if 4. gives you an error, composer should run now
I suggest you use babun, it is based cygwin, but you can install package by pact, you can do this:
pact install php php-json php-phar
php -r "readfile('https://getcomposer.org/installer');" | php
then enjoy yourself.
I was having trouble getting Composer to work in Cygwin and none of the solutions above were resolving my problem. Eventually I stumbled across this comment in the Composer github bugs discussion:
Yeah TBH using php from cygwin isn't a great idea, cygwin is just too different an environment. Too many hacks that create failures.. In any case closing here as there isn't much we can do I'm afraid :)
I don't know precisely where composer/Cygwin/php was tripping up, but, broadly, my problem was that I had two conflicting installations of PHP in environmental variables, one from an installation of WAMP, and another installed with Cygwin. The Cygwin PHP installation seemed to be struggling with some sort of path issue. I removed it, using only the WAMP PHP, and composer ran in Cygwin just fine.

Resources