[Solved] [Solved] Hyperledger Fabric 2.3 Channel creation failed

Introduction, problem description

In the process of learning the hyperledger framework fabric blockchain according to the readthedocs tutorial, the step of channel creation has been failing, that is, it cannot be successfully run:

./network.sh up createChannel

The error message that appears:

Go directly to search for this segmentation fault without any effective solution. The following is my entire investigation process, for your reference only.

My system environment is win11, wsl2, docker desktop, and ubuntu18.04 installed in wsl2.

Troubleshooting process

The following is the record of my troubleshooting attempt. Netizens can directly jump to the Summary page to conduct self-inspection of all steps.

Try 1, replace the peer and other binary to the new version

There has been a problem that knocking on osnadmin will also prompt a segmentation fault, so I plan to replace the binary directly, but it will not work if I switch to 2.2.6 and the old version.

Attachment: warehouse address

fabric-samples sample repository https://github.com/hyperledger/fabric-samples

fabric main repository https://github.com/hyperledger/fabric

github acceleration https://github.91chi.fun/

Go directly to the release page of the fabric warehouse address to download the linux installation package and unzip it to the samples warehouse.

cd fabric-samples

tar -zxvf /root/hyperledger-fabric-2.4.2.tar.gz

The problem is still.

Try 2, delete all mirrors, download the mirror again

I copied a docker image from a colleague who could run it successfully, but that version is older, so I suspect it’s not a problem with the docker image version. But try it anyway.

Go directly to install-fabric.sh under the fabric repository to view the source code. You can copy the content and run vi a script again:

./install-fabric.sh docker

working process:

Finally downloaded the latest version of the mirror:

But the problem remains.

Attempt 3, check gopath and clone again

In the end, I can only suspect that the warehouse is not downloaded completely, and clone it again.

After checking the go env is normal and the GOPATH variable is also set

When I recreated the path to name the new folder, I suddenly thought of the naming specification of the go warehouse, that is, to organize a project like github.com/xxx.com/xxxproject/, so I created the following folder

/opt/gopath/src/github.com/hyperledger/ , is the fabric-samples repository under this folder, and channels are created normally in /test-network! ! Here are the solution steps

cd to your GOPATH specific path, such as /opt/gopath/

mkdir -p src/github.com/hyperledger

cd src/github.com/hyperledger

git clone https://github.com/hyperledger/fabric-samples.git

##If the network is not good, use the following to speed up git

git clone https://github.91chi.fun/https://github.com/hyperledger/fabric-samples.git

Perform docker image cleanup:

docker stop `docker ps -a -q`

docker rm $(docker images -aq)

I delete all the images directly on the docker desktop, and then pull the latest version of the docker image.

At this point, go to test-network and execute ./test-network.sh up createChannel -c newchannel666

I found out that I can finally successfully create a custom channel!

Summary and troubleshooting steps

Please follow the steps below to check your own environment, and if you are successful, remember to come back and give a thumbs up!

1. Whether to set the environment variable GOPATH, such as /opt/gopath

2. Your samples repository should be cloned in $GOPATH/src/github.com/hyperledger/fabric-samples/ and be the main branch

3. Your binary is the latest version, extract it to fabric-samples/, and configure the PATH environment variable for the bin path, such as export PATH=$PATH:/opt/gopath/src/github.com/hyperledger/fabric-samples /bin

4. Your docker image is the latest version (such as fabric 2.4, ca-1.5). If you do not manually delete all images and perform the download of the latest version of docker, use BootStrap.sh -sb or install-fabric.sh docker to only run docker Mirror installation.

5. Check that the versions of docker, docker-compose, and go are new.