0

First of all I have to say that all this things will work on my windows machine. Today I started to do the same things on a ubuntu machine (with ssh and private key authentication). I've created a genesis.json file and a "blockchain" dir (that will be the location for my private chain data). But when I try to initiate (with my genesis file) the Blockchain, I recive this error:

Failed to read genesis file: open genesis.json: permission denied

. I've also performed the command chmod 777 genesis.json, but nothing's changed. The comand, that in windows will work, is: geth --datadir blokchain init genesis.json. I've also tried to put the path of the dir and the file, but nothing.

Any idea? Thanks!

By the ways, this is my genesis.json file:

{
  "coinbase"   : "0x0000000000000000000000000000000000000001",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x8000000000",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00",
  "alloc": {},
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0,
        "EIP150Block":0,
        "ByzantiumBlock":0
    }
}
1
  • Are you sure chmod executed correctly? Can you show the output of ls -l genesis.json? Can you show more output log from geth? In any case it seems to be a problem unrelated to Ethereum more like with your file permissions, perhaps unix.stackexchange.com is a better fit.
    – Ismael
    Commented Sep 27, 2019 at 14:14

2 Answers 2

1

This is more of a question for the ubuntu stackexchange.

You have two options:

  1. Execute with sudo. This will work for sure: sudo geth --datadir blokchain init genesis.json
  2. There might be a problem with permission (chmod set incorrectly). Try setting it on the entire folder. sudo chmod -r 777 myFolderThatContainsEntireChain. This isn't the best solution but it may well be worth to try and see if it fixes your problem.

EDIT: If it doesn't help consider this.

I realized you spelled blokchain instead of blockchain are you sure this is correct?

Otherwise it seems like geth can't find the genesis.json. Are you sure you are currently in the folder where your genesis.json resides? Furthermore make sure that the datadir folder exists as well (and with the correct path).

I hope this helps.

3
  • 1
    I tried both option but I get the same error. Commented Oct 2, 2019 at 9:27
  • 1
    I updated my answer
    – cqx
    Commented Oct 2, 2019 at 13:59
  • The name is correct and I launch the init command in the dir in which there is the genesis.json file. I've installed geth with the command: "sudo snap install geth" Commented Oct 4, 2019 at 18:13
1

I've had the same problem. This issue has nothing to do with your genesis file, but rather with the geth version installed by snap.

Simply download the most recent geth version from the official website add it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.