IBM/raft-fabric-sample

cryptogen: cannot execute binary file: Exec format error

ronaldl29 opened this issue ยท 14 comments

Environment: Ubuntu 18.04
Node.js v8.14.0
NPM v6.13.4
Go 1.13.6

When I get to the step where I run:

./byfn.sh generate -o etcdraft

This is my output:

Generating certs and genesis block for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
/home/bud/Projects/raft-fabric-sample/first-network/../bin/cryptogen

##########################################################

Generate certificates using cryptogen tool

##########################################################

  • cryptogen generate --config=./crypto-config.yaml
    ./byfn.sh: line 362: /home/bud/Projects/raft-fabric-sample/first-network/../bin/cryptogen: cannot execute binary file: Exec format error
  • res=126
  • set +x
    Failed to generate certificates...

What is your python version?

as shown in the Hyperledger Fabric dependencies (which this guide is based on - https://hyperledger-fabric.readthedocs.io/en/release-1.4/prereqs.html) you will need Python 2.7.

The following applies to Ubuntu 16.04 users only.

By default Ubuntu 16.04 comes with Python 3.5.1 installed as the python3 binary. The Fabric Node.js SDK requires an iteration of Python 2.7 in order for npm install operations to complete successfully. Retrieve the 2.7 version with the following command:

sudo apt-get install python
Check your version(s):

python --version

I think this post may be the answer to your question - siyuyifang/balance-transfer-java#1

@horeaporutiu
My python version is 2.7.17. Not sure if it matters but HLF is running fine on my machine when executing the first network from fabric-samples.

@ronaldlong46

Got it - It seems to be because when you download Fabric binaries, they automatically sync with the platform you are using. Since I am using macOS it is different than Ubuntu so the binaries are not working properly.

I will rearrange the repo and change the steps to make sure the binaries will work for Ubuntu users. Stay tuned!

@ronaldlong46

I've just updated the steps for Linux users. Please see this part of the README. Let me know if this solves the problem. https://github.com/IBM/raft-fabric-sample#for-linux-users

Thanks! You're awesome @horeaporutiu
I'm at step 3 (on the regular instructions). When I run this command:
./byfn.sh up -o etcdraft -l node

I get:

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (404): network _byfn not found
!!!!!!!!!!!!!!! Chaincode instantiation on peer0.org2 on channel 'mychannel' failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

ERROR !!!! Test failed

@ronaldlong46 Could you post the logs from peer0 org2?

you can do this by doing docker ps command and then docker logs <containerID of peer0org2 >

I see a similar error here - maybe this Stack post will help: https://stackoverflow.com/questions/46775044/error-when-try-to-instantiate-chain-code-on-hyperledger-fabric

You've also made sure that you did ./byfn.sh down and then docker stop $(docker ps -a -q) ; docker rm -f $(docker ps -aq) ; docker system prune -a ; docker volume prune ; docker ps -a ; docker images -a ; docker volume ls
before starting step 3 right?

Yes, I ran the steps to clear existing docker containers prior to going to step 3. I will go through that link. Here are my logs for peer0org2: @horeaporutiu
2020-01-28 03:03:20.610 UTC [nodeCmd] serve -> INFO 001 Starting peer:
Version: 1.4.4
Commit SHA: 7917a40
Go version: go1.12.12
OS/Arch: linux/amd64
Chaincode:
Base Image Version: 0.4.18
Base Docker Namespace: hyperledger
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger
2020-01-28 03:03:20.610 UTC [ledgermgmt] initialize -> INFO 002 Initializing ledger mgmt
2020-01-28 03:03:20.610 UTC [kvledger] NewProvider -> INFO 003 Initializing ledger provider
2020-01-28 03:03:20.630 UTC [kvledger] NewProvider -> INFO 004 ledger provider Initialized
2020-01-28 03:03:20.687 UTC [ledgermgmt] initialize -> INFO 005 ledger mgmt initialized
2020-01-28 03:03:20.687 UTC [peer] func1 -> INFO 006 Auto-detected peer address: 172.20.0.11:9051
2020-01-28 03:03:20.688 UTC [peer] func1 -> INFO 007 Returning peer0.org2.example.com:9051
2020-01-28 03:03:20.688 UTC [peer] func1 -> INFO 008 Auto-detected peer address: 172.20.0.11:9051
2020-01-28 03:03:20.688 UTC [peer] func1 -> INFO 009 Returning peer0.org2.example.com:9051
2020-01-28 03:03:20.689 UTC [nodeCmd] serve -> INFO 00a Starting peer with TLS enabled
2020-01-28 03:03:20.690 UTC [nodeCmd] computeChaincodeEndpoint -> INFO 00b Entering computeChaincodeEndpoint with peerHostname: peer0.org2.example.com
2020-01-28 03:03:20.690 UTC [nodeCmd] computeChaincodeEndpoint -> INFO 00c Exit with ccEndpoint: peer0.org2.example.com:9052
2020-01-28 03:03:20.691 UTC [sccapi] registerSysCC -> INFO 00d system chaincode lscc(github.com/hyperledger/fabric/core/scc/lscc) registered
2020-01-28 03:03:20.691 UTC [sccapi] registerSysCC -> INFO 00e system chaincode cscc(github.com/hyperledger/fabric/core/scc/cscc) registered
2020-01-28 03:03:20.691 UTC [sccapi] registerSysCC -> INFO 00f system chaincode qscc(github.com/hyperledger/fabric/core/scc/qscc) registered
2020-01-28 03:03:20.691 UTC [sccapi] registerSysCC -> INFO 010 system chaincode (+lifecycle,github.com/hyperledger/fabric/core/chaincode/lifecycle,true) disabled
2020-01-28 03:03:20.693 UTC [gossip.service] func1 -> INFO 011 Initialize gossip with endpoint peer0.org2.example.com:9051 and bootstrap set [peer1.org2.example.com:10051]
2020-01-28 03:03:20.697 UTC [gossip.gossip] NewGossipService -> INFO 012 Creating gossip service with self membership of Endpoint: peer0.org2.example.com:9051, InternalEndpoint: peer0.org2.example.com:9051, PKI-ID: 5ac72a85f9bba2849dc2e64b40e9bae8b07ca5032f9c69c67b3f633574e6d2d7, Metadata:
2020-01-28 03:03:20.697 UTC [gossip.gossip] start -> INFO 013 Gossip instance peer0.org2.example.com:9051 started
2020-01-28 03:03:20.698 UTC [sccapi] deploySysCC -> INFO 014 system chaincode lscc/(github.com/hyperledger/fabric/core/scc/lscc) deployed
2020-01-28 03:03:20.698 UTC [cscc] Init -> INFO 015 Init CSCC
2020-01-28 03:03:20.699 UTC [sccapi] deploySysCC -> INFO 016 system chaincode cscc/(github.com/hyperledger/fabric/core/scc/cscc) deployed
2020-01-28 03:03:20.699 UTC [qscc] Init -> INFO 017 Init QSCC
2020-01-28 03:03:20.699 UTC [sccapi] deploySysCC -> INFO 018 system chaincode qscc/(github.com/hyperledger/fabric/core/scc/qscc) deployed
2020-01-28 03:03:20.699 UTC [sccapi] deploySysCC -> INFO 019 system chaincode (+lifecycle,github.com/hyperledger/fabric/core/chaincode/lifecycle) disabled
2020-01-28 03:03:20.699 UTC [nodeCmd] serve -> INFO 01a Deployed system chaincodes
2020-01-28 03:03:20.700 UTC [discovery] NewService -> INFO 01b Created with config TLS: true, authCacheMaxSize: 1000, authCachePurgeRatio: 0.750000
2020-01-28 03:03:20.700 UTC [nodeCmd] registerDiscoveryService -> INFO 01c Discovery service activated
2020-01-28 03:03:20.700 UTC [nodeCmd] serve -> INFO 01d Starting peer with ID=[name:"peer0.org2.example.com" ], network ID=[dev], address=[peer0.org2.example.com:9051]
2020-01-28 03:03:20.700 UTC [nodeCmd] serve -> INFO 01e Started peer with ID=[name:"peer0.org2.example.com" ], network ID=[dev], address=[peer0.org2.example.com:9051]
2020-01-28 03:03:20.700 UTC [nodeCmd] func7 -> INFO 01f Starting profiling server with listenAddress = 0.0.0.0:6060
2020-01-28 03:03:20.700 UTC [kvledger] LoadPreResetHeight -> INFO 020 Loading prereset height from path [/var/hyperledger/production/ledgersData/chains]
2020-01-28 03:03:20.700 UTC [fsblkstorage] LoadPreResetHeight -> INFO 021 Loading Pre-reset heights
2020-01-28 03:03:20.700 UTC [fsblkstorage] preRestHtFiles -> INFO 022 Dir [/var/hyperledger/production/ledgersData/chains/chains] missing... exiting
2020-01-28 03:03:20.700 UTC [fsblkstorage] LoadPreResetHeight -> INFO 023 Pre-reset heights loaded
2020-01-28 03:03:21.510 UTC [comm.grpc.server] 1 -> INFO 024 unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2020-01-28T03:03:23.51Z grpc.peer_address=172.20.0.2:49064 grpc.peer_subject="CN=peer1.org2.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=196.306ยตs
2020-01-28 03:03:21.518 UTC [comm.grpc.server] 1 -> INFO 025 streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.request_deadline=2020-01-28T03:03:31.511Z grpc.peer_address=172.20.0.2:49064 grpc.peer_subject="CN=peer1.org2.example.com,L=San Francisco,ST=California,C=US" error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=6.542945ms
2020-01-28 03:03:21.524 UTC [comm.grpc.server] 1 -> INFO 026 unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2020-01-28T03:03:23.524Z grpc.peer_address=172.20.0.2:49066 grpc.peer_subject="CN=peer1.org2.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=159.613ยตs
2020-01-28 03:03:45.233 UTC [endorser] callChaincode -> INFO 027 [][a3cc5d31] Entry chaincode: name:"cscc"
2020-01-28 03:03:45.234 UTC [ledgermgmt] CreateLedger -> INFO 028 Creating ledger [mychannel] with genesis block
2020-01-28 03:03:45.237 UTC [fsblkstorage] newBlockfileMgr -> INFO 029 Getting block information from block storage
2020-01-28 03:03:45.254 UTC [kvledger] CommitWithPvtData -> INFO 02a [mychannel] Committed block [0] with 1 transaction(s) in 12ms (state_validation=0ms block_and_pvtdata_commit=8ms state_commit=2ms) commitHash=[]
2020-01-28 03:03:45.257 UTC [ledgermgmt] CreateLedger -> INFO 02b Created ledger [mychannel] with genesis block
2020-01-28 03:03:45.259 UTC [gossip.gossip] JoinChan -> INFO 02c Joining gossip network of channel mychannel with 2 organizations
2020-01-28 03:03:45.259 UTC [gossip.gossip] learnAnchorPeers -> INFO 02d No configured anchor peers of Org1MSP for channel mychannel to learn about
2020-01-28 03:03:45.259 UTC [gossip.gossip] learnAnchorPeers -> INFO 02e No configured anchor peers of Org2MSP for channel mychannel to learn about
2020-01-28 03:03:45.282 UTC [gossip.state] NewGossipStateProvider -> INFO 02f Updating metadata information for channel mychannel, current ledger sequence is at = 0, next expected block is = 1
2020-01-28 03:03:45.285 UTC [sccapi] deploySysCC -> INFO 030 system chaincode lscc/mychannel(github.com/hyperledger/fabric/core/scc/lscc) deployed
2020-01-28 03:03:45.285 UTC [cscc] Init -> INFO 031 Init CSCC
2020-01-28 03:03:45.285 UTC [sccapi] deploySysCC -> INFO 032 system chaincode cscc/mychannel(github.com/hyperledger/fabric/core/scc/cscc) deployed
2020-01-28 03:03:45.285 UTC [qscc] Init -> INFO 033 Init QSCC
2020-01-28 03:03:45.285 UTC [sccapi] deploySysCC -> INFO 034 system chaincode qscc/mychannel(github.com/hyperledger/fabric/core/scc/qscc) deployed
2020-01-28 03:03:45.286 UTC [sccapi] deploySysCC -> INFO 035 system chaincode (+lifecycle,github.com/hyperledger/fabric/core/chaincode/lifecycle) disabled
2020-01-28 03:03:45.286 UTC [endorser] callChaincode -> INFO 036 [][a3cc5d31] Exit chaincode: name:"cscc" (53ms)
2020-01-28 03:03:45.286 UTC [comm.grpc.server] 1 -> INFO 037 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.20.0.13:57512 grpc.code=OK grpc.call_duration=53.707015ms
2020-01-28 03:03:50.260 UTC [gossip.channel] reportMembershipChanges -> INFO 038 Membership view has changed. peers went online: [[peer1.org2.example.com:10051]] , current view: [[peer1.org2.example.com:10051]]
2020-01-28 03:03:54.439 UTC [gossip.privdata] StoreBlock -> INFO 039 [mychannel] Received block [1] from buffer
2020-01-28 03:03:54.442 UTC [gossip.gossip] JoinChan -> INFO 03a Joining gossip network of channel mychannel with 2 organizations
2020-01-28 03:03:54.442 UTC [gossip.gossip] learnAnchorPeers -> INFO 03b No configured anchor peers of Org2MSP for channel mychannel to learn about
2020-01-28 03:03:54.443 UTC [gossip.gossip] learnAnchorPeers -> INFO 03c Learning about the configured anchor peers of Org1MSP for channel mychannel : [{peer0.org1.example.com 7051}]
2020-01-28 03:03:54.443 UTC [gossip.service] updateEndpoints -> WARN 03d Failed to update ordering service endpoints, due to Channel with mychannel id was not found
2020-01-28 03:03:54.444 UTC [committer.txvalidator] Validate -> INFO 03e [mychannel] Validated block [1] in 4ms
2020-01-28 03:03:54.463 UTC [kvledger] CommitWithPvtData -> INFO 03f [mychannel] Committed block [1] with 1 transaction(s) in 18ms (state_validation=0ms block_and_pvtdata_commit=14ms state_commit=2ms) commitHash=[47dc540c94ceb704a23875c11273e16bb0b8a87aed84de911f2133568115f254]
2020-01-28 03:03:54.575 UTC [comm.grpc.server] 1 -> INFO 040 unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2020-01-28T03:03:56.575Z grpc.peer_address=172.20.0.8:44894 grpc.peer_subject="CN=peer0.org1.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=50.837ยตs
2020-01-28 03:03:54.577 UTC [comm.grpc.server] 1 -> INFO 041 streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.request_deadline=2020-01-28T03:04:04.575Z grpc.peer_address=172.20.0.8:44894 grpc.peer_subject="CN=peer0.org1.example.com,L=San Francisco,ST=California,C=US" error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=1.512596ms
2020-01-28 03:03:54.579 UTC [comm.grpc.server] 1 -> INFO 042 unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2020-01-28T03:03:56.579Z grpc.peer_address=172.20.0.8:44896 grpc.peer_subject="CN=peer0.org1.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=38.137ยตs
2020-01-28 03:03:54.580 UTC [gossip.privdata] StoreBlock -> INFO 043 [mychannel] Received block [2] from buffer
2020-01-28 03:03:54.580 UTC [comm.grpc.server] 1 -> INFO 044 unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2020-01-28T03:03:56.58Z grpc.peer_address=172.20.0.2:49148 grpc.peer_subject="CN=peer1.org2.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=38.174ยตs
2020-01-28 03:03:54.581 UTC [comm.grpc.server] 1 -> INFO 045 streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.peer_address=172.20.0.2:49066 grpc.peer_subject="CN=peer1.org2.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=33.055927323s
2020-01-28 03:03:54.581 UTC [comm.grpc.server] 1 -> INFO 046 streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.request_deadline=2020-01-28T03:04:04.58Z grpc.peer_address=172.20.0.2:49148 grpc.peer_subject="CN=peer1.org2.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=554.009ยตs
2020-01-28 03:03:54.583 UTC [gossip.gossip] JoinChan -> INFO 047 Joining gossip network of channel mychannel with 2 organizations
2020-01-28 03:03:54.583 UTC [gossip.gossip] learnAnchorPeers -> INFO 048 Learning about the configured anchor peers of Org1MSP for channel mychannel : [{peer0.org1.example.com 7051}]
2020-01-28 03:03:54.583 UTC [gossip.gossip] learnAnchorPeers -> INFO 049 Learning about the configured anchor peers of Org2MSP for channel mychannel : [{peer0.org2.example.com 9051}]
2020-01-28 03:03:54.583 UTC [gossip.gossip] learnAnchorPeers -> INFO 04a Anchor peer with same endpoint, skipping connecting to myself
2020-01-28 03:03:54.583 UTC [gossip.service] updateEndpoints -> WARN 04b Failed to update ordering service endpoints, due to Channel with mychannel id was not found
2020-01-28 03:03:54.584 UTC [committer.txvalidator] Validate -> INFO 04c [mychannel] Validated block [2] in 4ms
2020-01-28 03:03:54.586 UTC [comm.grpc.server] 1 -> INFO 04d unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2020-01-28T03:03:56.586Z grpc.peer_address=172.20.0.9:35650 grpc.peer_subject="CN=peer1.org1.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=42.628ยตs
2020-01-28 03:03:54.588 UTC [comm.grpc.server] 1 -> INFO 04e streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.peer_address=172.20.0.8:44896 grpc.peer_subject="CN=peer0.org1.example.com,L=San Francisco,ST=California,C=US" error=EOF grpc.code=Unknown grpc.call_duration=7.119691ms
2020-01-28 03:03:54.589 UTC [comm.grpc.server] 1 -> INFO 04f streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.request_deadline=2020-01-28T03:04:04.587Z grpc.peer_address=172.20.0.9:35650 grpc.peer_subject="CN=peer1.org1.example.com,L=San Francisco,ST=California,C=US" error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=1.697026ms
2020-01-28 03:03:54.591 UTC [comm.grpc.server] 1 -> INFO 050 unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2020-01-28T03:03:56.591Z grpc.peer_address=172.20.0.9:35654 grpc.peer_subject="CN=peer1.org1.example.com,L=San Francisco,ST=California,C=US" grpc.code=OK grpc.call_duration=46.781ยตs
2020-01-28 03:03:54.608 UTC [kvledger] CommitWithPvtData -> INFO 051 [mychannel] Committed block [2] with 1 transaction(s) in 23ms (state_validation=0ms block_and_pvtdata_commit=15ms state_commit=3ms) commitHash=[5f88b61407b149a48413433f4670c46531e5c4a8febdc339a9536ff8716a559e]
2020-01-28 03:03:55.260 UTC [gossip.channel] reportMembershipChanges -> INFO 052 Membership view has changed. peers went online: [[peer0.org1.example.com:7051 ]] , current view: [[peer1.org2.example.com:10051] [peer0.org1.example.com:7051 ]]
2020-01-28 03:03:57.663 UTC [endorser] callChaincode -> INFO 053 [][b68a0ad1] Entry chaincode: name:"lscc"
2020-01-28 03:03:57.664 UTC [lscc] executeInstall -> INFO 054 Installed Chaincode [fabcar] Version [1.0] to peer
2020-01-28 03:03:57.664 UTC [endorser] callChaincode -> INFO 055 [][b68a0ad1] Exit chaincode: name:"lscc" (0ms)
2020-01-28 03:03:57.664 UTC [comm.grpc.server] 1 -> INFO 056 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.20.0.13:57572 grpc.code=OK grpc.call_duration=791.023ยตs
2020-01-28 03:03:57.709 UTC [endorser] callChaincode -> INFO 057 [mychannel][a91dcc51] Entry chaincode: name:"lscc"
2020-01-28 03:04:00.260 UTC [gossip.channel] reportMembershipChanges -> INFO 058 Membership view has changed. peers went online: [[peer1.org1.example.com:8051 ]] , current view: [[peer0.org1.example.com:7051 ] [peer1.org1.example.com:8051 ] [peer1.org2.example.com:10051]]
2020-01-28 03:04:33.904 UTC [dockercontroller] Start -> ERRO 059 start-could not start container: API error (404): network _byfn not found
2020-01-28 03:04:33.912 UTC [endorser] callChaincode -> INFO 05a [mychannel][a91dcc51] Exit chaincode: name:"lscc" (36203ms)
2020-01-28 03:04:33.912 UTC [endorser] SimulateProposal -> ERRO 05b [mychannel][a91dcc51] failed to invoke chaincode name:"lscc" , error: API error (404): network _byfn not found
error starting container
error starting container
2020-01-28 03:04:33.912 UTC [comm.grpc.server] 1 -> INFO 05c unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.20.0.13:57576 grpc.code=OK grpc.call_duration=36.203636832s

@ronaldlong46

Ok I've updated the instructions again. I just checked and it worked with my Ubuntu 18.04 machine.
Node version 8.10.0.

I've updated the instructions again. Note that it's important that you run all commands (byfn, etc) from the first-network folder inside the fabric-samples repo. Since the fabric-samples repo will have all the correct binaries for cryptogen that was giving us problems before. Try using the updated instructions again.

https://github.com/IBM/raft-fabric-sample#for-linux-users

@ronaldlong46 I was having this same issue and can confirm that following @horeaporutiu updated instructions now works.

Thanks for both of you, I'm using Ubuntu 19.10 by the way.

Hello. Congratulations for your work, super job...
I did'nt see your linux remarks when I first cloned your code. I founded another way to get around.
I had another LUbuntu 18.04 LTS VM (in VirtualBox) with tries and tests on HLF 1.4.4. It was then very easy to copy the bin directory content from original HLF first-network sample (8 files) to my local directory in your example, and that's all.
Once more : a very demonstrative job. Thank's. I'll stay connected.

@dvauze

Thanks. That's actually much easier than my steps :)

Will update those when i get a chance. Thanks for your comment!

Sorry the late reply. It's working! I still ran into an issue, one of the commands was downloading HLF 2.0 and the fabric versions weren't matching. I got around this by downloading binaries of a specific version by running:

curl -sSL http://bit.ly/2ysbOFE | bash -s -- 1.4.4 1.4.4 0.4.18

Thank you so much for your help!

@ronaldlong46 will update the directions accordingly. Thanks for the update.