【ERROR】chaincode install failed with status: 500 - failed to invoke backing implementation xxx

简介: 【ERROR】chaincode install failed with status: 500 - failed to invoke backing implementation xxx

peer节点能够成功打包链码,但安装一直报错:

bash-5.1# peer lifecycle chaincode install codecc.tar.gz Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 2 "github.com/hyperledger/fabric-cluster/chaincode/go/xxx ...

原因:peer容器下的go版本不匹配


因为同样的链码在之前的环境下打包是可以成功安装的,但是这次却一直报错,印象中我也没有中途换过fabric版本,刚开始一直坚信是链码的问题,后来才确定是版本问题。


目前版本:


[zcongfly@localhost ~]$ systemctl start docker
[zcongfly@localhost ~]$ docker version
Client: Docker Engine - Community
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:30:24 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Server: Docker Engine - Community
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:28:33 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.15
  GitCommit:        5b842e528e99d4d4c1686467debf2bd4b88ecd86
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
[zcongfly@localhost ~]$ docker-compose version
docker-compose version 1.28.5, build c4eb3a1f
docker-py version: 4.4.4
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
[zcongfly@localhost ~]$ go version
go version go1.18 linux/amd64
[zcongfly@localhost ~]$ docker images
REPOSITORY                     TAG       IMAGE ID       CREATED         SIZE
busybox                        latest    66ba00ad3de8   5 weeks ago     4.87MB
couchdb                        3.1.1     a81efb6c8280   16 months ago   191MB
hyperledger/fabric-ca          1.5       4ea287b75c63   17 months ago   69.8MB
hyperledger/fabric-ca          1.5.2     4ea287b75c63   17 months ago   69.8MB
hyperledger/fabric-ca          latest    4ea287b75c63   17 months ago   69.8MB
hyperledger/fabric-tools       2.3       98fa0bfb0fd2   17 months ago   445MB
hyperledger/fabric-tools       2.3.3     98fa0bfb0fd2   17 months ago   445MB
hyperledger/fabric-tools       latest    98fa0bfb0fd2   17 months ago   445MB
hyperledger/fabric-peer        2.3       a491b5ab42f6   17 months ago   53.3MB
hyperledger/fabric-peer        2.3.3     a491b5ab42f6   17 months ago   53.3MB
hyperledger/fabric-peer        latest    a491b5ab42f6   17 months ago   53.3MB
hyperledger/fabric-orderer     2.3       9e1952b8840d   17 months ago   35.4MB
hyperledger/fabric-orderer     2.3.3     9e1952b8840d   17 months ago   35.4MB
hyperledger/fabric-orderer     latest    9e1952b8840d   17 months ago   35.4MB
hyperledger/fabric-ccenv       2.3       56fa403e02ee   17 months ago   502MB
hyperledger/fabric-ccenv       2.3.3     56fa403e02ee   17 months ago   502MB
hyperledger/fabric-ccenv       latest    56fa403e02ee   17 months ago   502MB
hyperledger/fabric-baseos      2.3       b35a8ef578c0   17 months ago   6.87MB
hyperledger/fabric-baseos      2.3.3     b35a8ef578c0   17 months ago   6.87MB
hyperledger/fabric-baseos      latest    b35a8ef578c0   17 months ago   6.87MB
hyperledger/fabric-zookeeper   0.4.22    9d0214fb481b   2 years ago     276MB
hyperledger/fabric-zookeeper   latest    9d0214fb481b   2 years ago     276MB
hyperledger/fabric-kafka       0.4.22    e94a8ade54af   2 years ago     270MB
hyperledger/fabric-kafka       latest    e94a8ade54af   2 years ago     270MB
hyperledger/fabric-couchdb     0.4.22    339050a439e7   2 years ago     261MB
hyperledger/fabric-couchdb     latest    339050a439e7   2 years ago     261MB
hyperledger/fabric-tools       1.4.0     0a44f4261a55   4 years ago     1.56GB
hyperledger/fabric-ccenv       1.4.0     5b31d55f5f3a   4 years ago     1.43GB
hyperledger/fabric-orderer     1.4.0     54f372205580   4 years ago     150MB
hyperledger/fabric-peer        1.4.0     304fac59b501   4 years ago     157MB

好离谱,同样的版本之前一直跑得好好的,我也不知道啥情况突然链码安装这一步不好使了。。。(可能虚拟机的问题吧)

解决方法可能得重新部署下环境。

至于应该换成哪个版本,环境搭建太繁琐,懒得再试了,先把情况记录下,等导师找我再说吧。。。

有友友遇到同样的情况评论或者私信滴滴我一下吧~

华丽的分割线(我导找我了)


就是版本问题,把原来的docker删干净重新拉取安装,同样的yaml文件和链码就没问题了。

目前安装的版本:

hyperledger/fabric-tools     2.4       625237d887db   13 months ago   473MB
hyperledger/fabric-tools     2.4.3     625237d887db   13 months ago   473MB
hyperledger/fabric-tools     latest    625237d887db   13 months ago   473MB
hyperledger/fabric-peer      2.4       ee643d889779   13 months ago   62.3MB
hyperledger/fabric-peer      2.4.3     ee643d889779   13 months ago   62.3MB
hyperledger/fabric-peer      latest    ee643d889779   13 months ago   62.3MB
hyperledger/fabric-orderer   2.4       df64446ac2df   13 months ago   37.3MB
hyperledger/fabric-orderer   2.4.3     df64446ac2df   13 months ago   37.3MB
hyperledger/fabric-orderer   latest    df64446ac2df   13 months ago   37.3MB
hyperledger/fabric-ccenv     2.4       da4f00cb576a   13 months ago   517MB
hyperledger/fabric-ccenv     2.4.3     da4f00cb576a   13 months ago   517MB
hyperledger/fabric-ccenv     latest    da4f00cb576a   13 months ago   517MB
hyperledger/fabric-baseos    2.4       0287ebf8aaf3   13 months ago   6.94MB
hyperledger/fabric-baseos    2.4.3     0287ebf8aaf3   13 months ago   6.94MB
hyperledger/fabric-baseos    latest    0287ebf8aaf3   13 months ago   6.94MB
hyperledger/fabric-ca        1.5       4ea287b75c63   18 months ago   69.8MB
hyperledger/fabric-ca        1.5.2     4ea287b75c63   18 months ago   69.8MB
hyperledger/fabric-ca        latest    4ea287b75c63   18 months ago   69.8MB
hyperledger/fabric-couchdb   latest    b967e8b98b6b   2 years ago     261MB

贴一段咨询chatgpt的回复:

Q:请问fabric安装链码时候出现这种报错是什么原因?如何解决呢?

这个报错似乎是由于在构建链码镜像时缺少必要的依赖项而导致的。具体来说,它可能是因为需要升级到使用支持 “unsafe.Slice” 的 Golang 版本,或者在 Dockerfile 中添加必要的依赖项。

尝试以下方法解决问题:

  1. 确保您的 Golang 版本是 1.16 或更高版本。
  2. 确保您已经安装了 Docker 和 Docker Compose。
  3. 检查您的链码代码和 Dockerfile 是否正确,特别是是否设置了正确的环境变量和依赖项。
  4. 在 Dockerfile 中添加必要的依赖项,例如 sudo,gcc,g++,make 等。
  5. 重新构建链码镜像并重新运行peer lifecycle chaincode install 命令。

如果这些步骤都无法解决问题,请检查您的链码代码并确保它们是正确的,并且可以在本地编译和运行。您也可以尝试使用不同的 Golang 版本或尝试在另一台机器上构建链码镜像。

Q:这个golang版本是指peer容器中的golang版本还是指Linux本地系统中的golang版本?

这里指的是在您安装链码的那台机器上的 Golang 版本。如果是在 CentOS 容器中运行 peer,则需要检查 CentOS 容器中的 Golang 版本是否为 1.16 或更高版本。如果在本地系统上运行,则需要检查本地系统上的 Golang 版本。

请注意,peer 容器和本地系统中的 Golang 版本可能不同。在构建链码镜像时,您需要使用 Dockerfile 中指定的 Golang 版本来构建链码二进制文件。因此,请确保您在 Dockerfile 中正确指定了所需的 Golang 版本。

目录
相关文章
|
10月前
|
缓存 PHP
Composer 报错 Error while processing content unencoding: Unknown failure within ...
Composer 报错 Error while processing content unencoding: Unknown failure within ...
162 0
|
7月前
Failed to execute script ‘xxx‘ due to unhandled exception:No module named ‘ctypes‘
Failed to execute script ‘xxx‘ due to unhandled exception:No module named ‘ctypes‘
182 0
|
1月前
|
开发者 iOS开发
no identity found Command CodeSign failed with a nonzero exit code
no identity found Command CodeSign failed with a nonzero exit code
24 0
|
1月前
|
应用服务中间件 Python 容器
ERROR [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer 1917: Failed to check/redeclare aut
ERROR [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer 1917: Failed to check/redeclare aut
46 0
|
10月前
|
Java Maven Android开发
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
|
10月前
|
C语言
安装mujoco报错:distutils.errors.DistutilsExecError: command ‘gcc‘ failed with exit status 1
安装mujoco报错:distutils.errors.DistutilsExecError: command ‘gcc‘ failed with exit status 1
386 0
Execution failed for task :Test:lintVitalRelease/Lint found fatal errors while assembling a release
Execution failed for task :Test:lintVitalRelease/Lint found fatal errors while assembling a release
106 0
|
Java
Error: A JNI error has occurred, please check your installation and try again
Error: A JNI error has occurred, please check your installation and try again
168 0
Gradle sync failed: Unsupported method: NativeArtifact.getSourceFolders().
Gradle sync failed: Unsupported method: NativeArtifact.getSourceFolders().
79 0
|
Android开发
解析Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
解析Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
358 0
解析Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]