6

I noticed that geth stopped running on my system, so I tried restarting it but got the following error: Fatal: Error starting protocol stack: datadir already used by another process

I checked whether there is another active instance of geth by running ps aux but found nothing. So I'm not sure how the directory can possibly be used by another process. Any ideas for debugging this situation?

1
  • 2
    Try re-running it with --verbosity 5, and see if the errors are any more detailed. Jan 26, 2018 at 23:22

3 Answers 3

6

If you're sure that geth is not already running, check for the presence of a LOCK file in the geth subdirectory of your data directory. Under Ubuntu this will be ~/.ethereum/geth.

I have experienced a rogue LOCK that caused this issue - I'm not sure why, possibly the normal shutdown of the previous geth session was distured.

Remove the Lockfile Debian/Ubuntu

Remove (or rename) ~/.ethereum/geth/LOCK and restart geth.

# Check that geth is not already running:
ps aux | grep geth

# geth not running - Check for presence of LOCK
test -e  && echo LOCK exists || echo LOCK does not exist

# LOCK exists, but geth isn't running so get rid of LOCK
# Rename to be safe - change back if you mess something up
mv ~/.ethereum/geth/LOCK ~/.ethereum/geth/xLOCK

Now try to start geth.

1
  • 1
    In my case, I also rename the file ~/.ethereum/geth/chaindata/LOCK to backup the file. Then, geth works.
    – Bowen Xu
    Jul 9, 2018 at 6:03
2

Start geth in Terminal first:

> geth --mine

Launch Mist, but also from Terminal so you can pass commands to make it connect to the IPC created by geth. On my computer, it looks something like this and try

> /Applications/Mist.app/Contents/MacOS/Mist --rpc ~/Library/Ethereum/geth.ipc

Note: you need to change the paths above to correspond with where those files are on your computer and where you're calling them from, as well as the network.

The geth.ipc file is only created/shows up after you have started geth.

For example, another example of this with testnet is:

Terminal 1.1

> geth --testnet --mine

Terminal 1.2 (from home folder)

> cd /Applications
> Mist.app/Contents/MacOS/Mist --rpc ~/Library/Ethereum/testnet/geth.ipc

and anther cmd close

try it

2

I had the same issue, with ps aux displaying nothing for geth. Yet when I killed the port I was trying to run geth at, it worked! So you simply need to execute this command:

sudo kill -9 `sudo lsof -t -i:{PORT FOR GETH}`

Then retry running geth.

Your Answer

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

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