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
    }
}
  • 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 Sep 27 at 14:14
0

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.

  • I tried both option but I get the same error. – Tommaso Pessina Oct 2 at 9:27
  • I updated my answer – Niklas Feurstein Oct 2 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" – Tommaso Pessina Oct 4 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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