Error cryptogen tool in Hyperledger Fabric

為{幸葍}努か 提交于 2021-02-07 07:35:40

问题


I am attempting to install and run Hyperledger Fabric on OSX. Installation seems to have gone well. However, when I run the cryptogen tool I am getting the following warnings:

Apples-MacBook-Pro:e2e mycomputer$ ./../../$os_arch/bin/cryptogen generate --config=./crypto-config.yaml
org1.example.com
2017-04-27 15:46:27.940 PDT [bccsp] GetDefault -> WARN 001 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.963 PDT [bccsp] GetDefault -> WARN 002 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.966 PDT [bccsp] GetDefault -> WARN 003 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.967 PDT [bccsp] GetDefault -> WARN 004 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.969 PDT [bccsp] GetDefault -> WARN 005 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
org2.example.com
2017-04-27 15:46:27.973 PDT [bccsp] GetDefault -> WARN 006 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.975 PDT [bccsp] GetDefault -> WARN 007 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.977 PDT [bccsp] GetDefault -> WARN 008 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.979 PDT [bccsp] GetDefault -> WARN 009 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.980 PDT [bccsp] GetDefault -> WARN 00a Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.984 PDT [bccsp] GetDefault -> WARN 00b Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.989 PDT [bccsp] GetDefault -> WARN 00c Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.992 PDT [bccsp] GetDefault -> WARN 00d Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.

Then the following error is generated when the configtxgen tool is run:

2017-04-27 12:23:57.202 PDT [common/configtx/tool] main -> INFO 001 Loading configuration
2017-04-27 12:23:57.203 PDT [configtx/tool/localconfig] Load -> CRIT 002 Error reading configuration: Unsupported Config Type ""
panic: Error reading configuration: Unsupported Config Type ""

goroutine 1 [running]:
panic(0x490d00, 0xc420175f50)
    /opt/go/go1.7.linux.amd64/src/runtime/panic.go:500 +0x1a1
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panicf(0xc4201da240, 0x5663ea, 0x1f, 0xc420175e70, 0x1, 0x1)
    /w/workspace/fabric-verify-x86_64_1/gopath/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:194 +0x127
github.com/hyperledger/fabric/common/configtx/tool/localconfig.Load(0x7fff5fbffbfe, 0x7, 0x0)
    /w/workspace/fabric-verify-x86_64_1/gopath/src/github.com/hyperledger/fabric/common/configtx/tool/localconfig/config.go:195 +0x79c
main.main()
    /w/workspace/fabric-verify-x86_64_1/gopath/src/github.com/hyperledger/fabric/common/configtx/tool/configtxgen/main.go:204 +0x405

The result is that no orderer.block is output into the e2e directory.

What is going on?

Thank you for your help. philstan


回答1:


Though you are getting warning messages when you execute ./../../$os_arch/bin/cryptogen generate --config=./crypto-config.yaml, the certifcates are created in the crypto_config folder in ee folder.

As for the second part, creating a genesis block you need to do this

    Do not pass ORDERER_CFG_PATH=$PWD
    instead, pass the following: FABRIC_CFG_PATH=$PWD

    In the network_setup.sh script, make the same change.
    It should be: export FABRIC_CFG_PATH=$PWD

For more info on this, see this link https://jira.hyperledger.org/browse/FAB-3467




回答2:


I got same error on Windows. Setting environment variable as below did not resolve issue.

$ FABRIC_CFG_PATH=$PWD

$ ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
2017-05-24 15:48:42.109 IST [common/configtx/tool] main -> INFO 001 Loading configuration
2017-05-24 15:48:42.113 IST [common/configtx/tool/localconfig] Load -> CRIT 002 Error reading config
uration:  Unsupported Config Type ""
panic: Error reading configuration: Unsupported Config Type ""

goroutine 1 [running]:
panic(0x8a3e60, 0xc0421ee9f0)
        /opt/go/go1.7.linux.amd64/src/runtime/panic.go:500 +0x1af
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panic(0xc04216dad0, 0xc04219
7c60, 0x2, 0x2)
        /w/workspace/fabric-binaries-x86_64-1/gopath/src/github.com/hyperledger/fabric/vendor/github
.com/op/go-logging/logger.go:188 +0xd7
github.com/hyperledger/fabric/common/configtx/tool/localconfig.Load(0xc042040400, 0x15, 0x0)
        /w/workspace/fabric-binaries-x86_64-1/gopath/src/github.com/hyperledger/fabric/common/config
tx/tool/localconfig/config.go:180 +0xa95
main.main()
        /w/workspace/fabric-binaries-x86_64-1/gopath/src/github.com/hyperledger/fabric/common/config
tx/tool/configtxgen/main.go:328 +0x501

Passing same environment variable on same line as command execution worked fine.

$ FABRIC_CFG_PATH=$PWD ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-arti
facts/genesis.block
2017-05-24 15:56:29.811 IST [common/configtx/tool] main -> INFO 001 Loading configuration
2017-05-24 15:56:29.831 IST [msp] getMspConfig -> INFO 002 intermediate certs folder not found at [D
:\test\fabric-alpha2\release\windows-amd64\crypto-config\ordererOrganizations\example.com\msp\interm
ediatecerts]. Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-con
fig\ordererOrganizations\example.com\msp\intermediatecerts: The system cannot find the file specifie
d.]
2017-05-24 15:56:29.855 IST [msp] getMspConfig -> INFO 003 crls folder not found at [D:\test\fabric-
alpha2\release\windows-amd64\crypto-config\ordererOrganizations\example.com\msp\intermediatecerts].
Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\ordererOrg
anizations\example.com\msp\crls: The system cannot find the file specified.]
2017-05-24 15:56:29.860 IST [msp] getMspConfig -> INFO 004 MSP configuration file not found at [D:\t
est\fabric-alpha2\release\windows-amd64\crypto-config\ordererOrganizations\example.com\msp\config.ya
ml]: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\ordererOrganizat
ions\example.com\msp\config.yaml: The system cannot find the file specified.]
2017-05-24 15:56:29.892 IST [msp] getMspConfig -> INFO 005 intermediate certs folder not found at [D
:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizations\org1.example.com\msp\inte
rmediatecerts]. Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-c
onfig\peerOrganizations\org1.example.com\msp\intermediatecerts: The system cannot find the file spec
ified.]
2017-05-24 15:56:29.897 IST [msp] getMspConfig -> INFO 006 crls folder not found at [D:\test\fabric-
alpha2\release\windows-amd64\crypto-config\peerOrganizations\org1.example.com\msp\intermediatecerts]
. Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrga
nizations\org1.example.com\msp\crls: The system cannot find the file specified.]
2017-05-24 15:56:29.904 IST [msp] getMspConfig -> INFO 007 MSP configuration file not found at [D:\t
est\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizations\org1.example.com\msp\config.
yaml]: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizati
ons\org1.example.com\msp\config.yaml: The system cannot find the file specified.]
2017-05-24 15:56:29.918 IST [msp] getMspConfig -> INFO 008 intermediate certs folder not found at [D
:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizations\org2.example.com\msp\inte
rmediatecerts]. Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-c
onfig\peerOrganizations\org2.example.com\msp\intermediatecerts: The system cannot find the file spec
ified.]
2017-05-24 15:56:29.924 IST [msp] getMspConfig -> INFO 009 crls folder not found at [D:\test\fabric-
alpha2\release\windows-amd64\crypto-config\peerOrganizations\org2.example.com\msp\intermediatecerts]
. Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrga
nizations\org2.example.com\msp\crls: The system cannot find the file specified.]
2017-05-24 15:56:29.928 IST [msp] getMspConfig -> INFO 00a MSP configuration file not found at [D:\t
est\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizations\org2.example.com\msp\config.
yaml]: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizati
ons\org2.example.com\msp\config.yaml: The system cannot find the file specified.]
2017-05-24 15:56:29.936 IST [common/configtx/tool] doOutputBlock -> INFO 00b Generating genesis bloc
k
2017-05-24 15:56:29.941 IST [common/configtx/tool] doOutputBlock -> INFO 00c Writing genesis block

Genesis block was created (As described in documentation we need to ignore logs regarding intermediate certs.




回答3:


to solves this, don't set the PATH like this:

FABRIC_CFG_PATH=$PWD

instead you have to export it like this:

export FABRIC_CFG_PATH=$PWD

otherwise you will add the PATH at the beginning of command, like this for example:

FABRIC_CFG_PATH=$PWD ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block



回答4:


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:

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



回答5:


I had the same problem after I implemented a new network. In my case the solution was to change the path of PATH in .bashrc to the new folder where my cryptogen tool is. Example:

export PATH=$PATH:~/fabric-samples/network

When implementing first-network the tool is in the bin-folder, but in my new network the tool is another folder. Then reboot and check with 'which cryptogen' that the right folder is selected.



来源:https://stackoverflow.com/questions/43685611/error-cryptogen-tool-in-hyperledger-fabric

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!