BYFN Error - "unable to bootstrap orderer"

Q

Why am I getting the "panic: unable to bootstrap orderer. Error reading genesis block file: read /var/hyperledger/orderer/orderer.genesis.block: is a directory" error?

✍: FYIcenter.com

A

When you build and deploy your BYFN network manually, you may end up missing the genesis.block file.

Try to run the "docker-compose up" command again to deploy and start BYFN containers without the "--detach" option

$ cd ~/hyperledger-binaries/fabric-samples/first-network

$ docker-compose -f docker-compose-cli.yaml up

...
orderer.example.com  | FileLedger.Prefix = "hyperledger-fabric-ordererledger"
orderer.example.com  | RAMLedger.HistorySize = 1000
orderer.example.com  | Kafka.Retry.ShortInterval = 5s
...
orderer.example.com  | Kafka.Verbose = true
orderer.example.com  | Kafka.Version = 0.10.2.0
...
orderer.example.com  | Debug.BroadcastTraceDir = ""
orderer.example.com  | Debug.DeliverTraceDir = ""
orderer.example.com  | Consensus = map[WALDir:/var/hyperledger/production/orderer/etcdraft/wal \
   SnapDir:/var/hyperledger/production/orderer/etcdraft/snapshot]
orderer.example.com  | Operations.ListenAddress = "127.0.0.1:8443"
...
orderer.example.com  | Metrics.Statsd.Prefix = ""

orderer.example.com  | panic: unable to bootstrap orderer. Error reading \
   genesis block file: read /var/hyperledger/orderer/orderer.genesis.block: \
   is a directory
...

^C
Gracefully stopping... (press Ctrl+C again to force)
...

So the genesis block file is cause a problem. Let's check the local version in the hosting system:

$ ls -l channel-artifacts
drwxr-xr-x 2 root root 4096 Apr 11 17:19 genesis.block

$ ls -l channel-artifacts/genesis.block/
total 0

The "genesis.block" file has been changed to an empty directory and owned by "root" now. Some thing happened to the file. We need to do the entire build and deploy process.

1. Generate certificates:

$ ../bin/cryptogen generate --config=./crypto-config.yaml

$ ls -l crypto-config
total 8
drwxr-xr-x 3 poetic_admin poetic_admin 4096 Apr 11 23:52 ordererOrganizations
drwxr-xr-x 4 poetic_admin poetic_admin 4096 Apr 11 23:52 peerOrganizations

2. Generate genesis block and bootstrap transactions:

$ export FABRIC_CFG_PATH=./

$ ../bin/configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel \
   -outputBlock ./channel-artifacts/genesis.block
   
$ ../bin/configtxgen -profile TwoOrgsChannel -channelID mychannel \
   -outputCreateChannelTx ./channel-artifacts/channel.tx 

$ ../bin/configtxgen -profile TwoOrgsChannel -channelID mychannel -asOrg Org1MSP \
   -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx 

$ ../bin/configtxgen -profile TwoOrgsChannel -channelID mychannel -asOrg Org2MSP \
   -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx 
   
$ ls -l channel-artifacts
-rw-r--r-- 1 poetic_admin poetic_admin   284 Apr 11 23:59 Org1MSPanchors.tx
-rw-r--r-- 1 poetic_admin poetic_admin   284 Apr 11 23:59 Org2MSPanchors.tx
-rw-r--r-- 1 poetic_admin poetic_admin   346 Apr 11 23:57 channel.tx
-rw-r--r-- 1 poetic_admin poetic_admin 12980 Apr 11 23:56 genesis.block

3. Start the FYBN Docker containers:

$ docker-compose -f docker-compose-cli.yaml up --detach

$ docker ps --all 
IMAGE                              COMMAND            STATUS         NAMES

hyperledger/fabric-tools:latest    "/bin/bash"        Up 25 seconds  cli
hyperledger/fabric-orderer:latest  "orderer"          Up 33 seconds  orderer.example.com
hyperledger/fabric-peer:latest     "peer node start"  Up 32 seconds  peer1.org2.example.com
hyperledger/fabric-peer:latest     "peer node start"  Up 31 seconds  peer0.org1.example.com
hyperledger/fabric-peer:latest     "peer node start"  Up 34 seconds  peer1.org1.example.com
hyperledger/fabric-peer:latest     "peer node start"  Up 34 seconds  peer0.org2.example.com

All BYFN Docker containers are up and running.

 

⇒ CORE_PEER_* Environment Variables on BYFN CLI

⇐ BYFN CLI Container Missing Admin Certificates

⇑ Hyperledger Fabric Sample Networks

⇑⇑ Hyperledger Tutorials

2020-10-10, 1423👍, 0💬