title: fabric网络中的报错(二)
date: 2021-03-22 18:51:50
categories:
- Hyperledger Fabric
tags: - Hyperledger Fabric
重要声明 ,早期写的博客,后面发现里面的某些解决办法是错误的,借鉴一下就好。
问题一:
fatal: unable to access ‘https://github.com/hyperledger/fabric-samples.git/’: Failed to connect to github.com port 443: 拒绝连接
解决办法:
命令行输入: git config --global --unset http.proxy git config --global --unset https.proxy
问题二;
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images/create?fromImage=hyperledger%2Ffabric-ca&tag=1.4.9: dial unix /var/run/docker.sock: connect: permission denied
解决办法:
用VPN下载
Fabric2.3.0版本测试网络运行问题解决办法
问题一:
Starting nodes with CLI timeout of ‘5’ tries and CLI delay of ‘3’ seconds and using database ‘leveldb’ with crypto from ‘cryptogen’
./network.sh: line 51: 37615 Abort trap: 6 peer version > /dev/null 2>&1
Peer binary and configuration files not found…
Follow the instructions in the Fabric docs to install the Fabric Binaries:
https://hyperledger-fabric.readthedocs.io/en/latest/install.html
解决办法:
这是镜像没下载完 造成的
换VPN 切手机热点下载镜像 具体什么原因导致下载失败不知道 反正失败了好多次 网上的方法也试了好多次 没啥用
问题二:
Error: error getting endorser client for channel: endorser client failed to connect to localhost:7051: failed to create new connection: context deadline exceeded
错误:错误获取代言人客户端的通道:代言人客户端未能连接到本地端:7051:未能创建新连接:上下文截止日期已过
Lexi
错误:获取广播客户端时出错:订购者客户端无法连接到orderer.test.com:7050:无法创建新的连接:超出了上下文截止日期
解决办法:
好多的原因都会报这种错误,具体说不清楚 ,反正我被这个报错玩过好多次。。。。
比如说 第二个错误是因为我安装链码只安装到了一个组织,另一个没有安装。
问题三:
Error: failed to normalize chaincode path: ‘go list’ failed with: go: github.com/golang/protobuf@v1.3.2: Get “https://proxy.golang.org/github.com/golang/protobuf/@v/v1.3.2.mod”: dial tcp 216.58.200.241:443: i/o timeout: exit status 1
Chaincode packaging has failed
Deploying chaincode failed
解决办法:
下载go依赖包
cd …/hyperledger/fabric-samples/chaincode/sacc
go mod init
go env -w GOPROXY=https://goproxy.cn,direct
go mod vendor
问题四:
Could not find profile: soloOrgsOrdererGenesis
Could not find profile: soloOrgsOrdererGenesis. Please make sure that FABRIC_CFG_PATH or -configPath is set to a path which contains configtx.yaml with the specified profile
解决办法:
export FABRIC_CFG_PATH=/home/hyperledger/solotest 后面的路径改成你项目configtx.yaml文件的路径
问题五:
Error: failed to create deliver client for orderer: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: connection error: desc = “transport: error while dialing: dial tcp: lookup orderer.example.com on 127.0.0.11:53: no such host”
错误:无法为订购者创建交付客户端:订购者客户端未能连接到orderer.example.com:7050:无法创建新连接:连接错误:desc =“运输:拨号时出错:拨打tcp:查找orderer.example。 127.0.0.11:53上的com:没有这样的主机”
第二次提交相同代码出现下面问题:
Error: failed to create deliver client for orderer: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: context deadline exceeded
错误:无法为订购者创建交付客户端:订购者客户端无法连接到orderer.example.com:7050:未能创建新的连接:超出了上下文截止日期
解决办法:
命令行输入
docker-compose ps 查看order.example.com 是否有 0.0.0.0:7050->7050/tcp
如果没有请查看docker-compose.yaml配置文件 肯定哪里错了
Name Command State Ports
cli /bin/sh Up
orderer.example.com orderer Up 0.0.0.0:7050->7050/tcp
peer0.org1.example.com peer node start Up 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp
问题六:
docker 获得权限被拒绝
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied
Couldn’t connect to Docker daemon at http+docker://localunixsocket - is it running?
If it’s at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
解决办法:
sudo usermod -aG docker $USER
sudo chmod 666 /var/run/docker.sock
问题七:
cryptogen:未找到命令
解决办法:
打开 usr/local/bin 看看里面的东西还在不在
如果不在
复制fabric-samples/bin 文件夹里面的东西 到usr/local/bin里面去
如果需要管理员权限
命令行输入:sudo nautilus
问题八:
Named volume “peer0.org2.example.com:/var/hyperledger/production:rw” is used in service “peer0.org2.example.com” but no declaration was found in the volumes section.
解决办法:
version: ‘2’
volumes:
orderer.example.com:
peer0.org1.example.com:
peer0.org2.example.com: 这里没加入内容 小错误
问题九:
Error: got unexpected status: FORBIDDEN – config update for existing channel did not pass initial checks: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the ‘Writers’ sub-policies to be satisfied: permission denied
解决办法:
docker volume prune 关掉所用容器后 执行这个命令,修剪数据卷 大胆一点 ,删
问题十:
txid [8a33c33de95c2590c49c8f28a91f736b537a3ac319ea968309e4d52a9dea99d5] committed with status (ENDORSEMENT_POLICY_FAILURE) at peer0.org2.example.com:8051
Error: transaction invalidated with status (ENDORSEMENT_POLICY_FAILURE)错误:交易因状态无效(ENDORSEMENT_POLICY_FAILURE)
解决办法:
peer lifecycle chaincode commit -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:8051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --channelID mychannel --name sacc --version 1.0 --sequence 1 --init-required
这里–peerAddresses --tlsRootCertFiles 你只设置了一个
问题十一:
在建立bee run 项目时
…/github.com/prometheus/common/expfmt/decode.go:25:2: cannot find package “github.com/matttproud/golang_protobuf_extensions/pbutil” in any of:
/usr/local/go/src/github.com/matttproud/golang_protobuf_extensions/pbutil (from $GOROOT)
/home/tianzhiwei/go/src/github.com/matttproud/golang_protobuf_extensions/pbutil (from $GOPATH)
解决办法:
go mod init
如果显示:go mod init: modules disabled by GO111MODULE=off; see ‘go help modules’
先export GO111MODULE=“on”
然后go mod init
问题十二:
Error: error getting chaincode bytes: ‘go list’ failed with: no required module provides package github.com/chaincode/sacc: go.mod file not found in current directory or any parent directory; see ‘go help modules’: exit status 1
解决办法
cd /opt/gopath/src/github.com/chaincode/sacc
//进入链码文件夹下 输入下面的东西
go env -w GO111MODULE=off
部署fabric-ca过程中的报错
问题一:
安装libtool与libltdl-dev依赖包时
无法解析域名“security.ubuntu.com”
解决办法:
sudo vim /etc/resolv.conf # 添加如下内容
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 127.0.0.1
输入Esc,:wq,保存并退出
sudo /etc/init.d/networking restart