I am trying to create private block chain. When I am trying to run this command:

geth init ./customgenesis.json

...it is showing an error:

fatal: failed to open database: The process cannot access the file because it is being used by another process

I am unable to proceed with the other steps. May I know how to overcome this?

  • Hi there. Do you already have another instance of Geth running on your machine? (Which platform are you on? Windows, OSX, Linux?) Are you following a particular tutorial? – Richard Horrocks Jul 20 '17 at 18:17
  • Hi It's Windows. – prasanna Jul 20 '17 at 19:40
  • Before you run geth init with your new genesis file, check whether there's an instance of Geth already running in Task Manager. Either that, or the editor you used to create the file might have a lock on it. – Richard Horrocks Jul 20 '17 at 20:28
  • maybe you have a geth instance already running, kill then the previous one and restart geth – Badr Bellaj Jul 30 '17 at 16:20

This error will almost certainly be due to another Geth instance running in the background. This previous process will have already locked various files that any subsequent instances would require.

On Linux, check the output of ps faux | grep geth, find the process's ID, then kill it using kill -INT <pid>.

On Windows, check the output of Process Manager (or whatever it's actually called), and safely kill any Geth instance that is there.

|improve this answer|||||

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.