[Ethereum] Port 30303 error in Mist when I run geth with a different datadir

go-ethereummist

I run geth with the following command. When I try to start Mist I get an error 30303: bind: address already in use. Why and how can I fix it?

This is the command I use to run geth:

geth --datadir /media/user/sdcard/chaindata --ipcdisable console

The command specifies that the blockchain data should be downloaded to the SD card rather than to the internal hard drive. It works fine for running geth itself.

But when I try to start Mist I get various error message such as:

Node type: geth
Network: main
Platform: linux (Architecure x64)

...11.167721 ethdb/database.go:82] Alloted 512MB cache and 1024 file handles to /home/ativera/.ethereum/chaindata
I0531 20:35:11.464852 ethdb/database.go:169] closed db:/home/ativera/.ethereum/chaindata
I0531 20:35:11.465825 ethdb/database.go:82] Alloted 512MB cache and 1024 file handles to /home/ativera/.ethereum/chaindata
I0531 20:35:11.587973 ethdb/database.go:82] Alloted 16MB cache and 16 file handles to /home/ativera/.ethereum/dapp
I0531 20:35:11.844313 eth/backend.go:170] Protocol Versions: [63 62 61], Network Id: 1
I0531 20:35:11.844786 eth/backend.go:199] Blockchain DB Version: 3
I0531 20:35:11.845385 core/blockchain.go:206] Last header: #0 [d4e56740…] TD=17179869184
I0531 20:35:11.845421 core/blockchain.go:207] Last block: #0 [d4e56740…] TD=17179869184
I0531 20:35:11.845440 core/blockchain.go:208] Fast block: #0 [d4e56740…] TD=17179869184
I0531 20:35:11.846587 p2p/server.go:311] Starting Server
Fatal: Error starting protocol stack: listen udp :30303: bind: address already in use

Why do I get the error message and more importantly, what should I do to be able to make Mist actually run when I start geth the way I do as specified above?

Best Answer

Q: Why do I get the error message?

The reason why you are getting the error with port 30303 already being used is because your first geth command is using this port.

When you run Ethereum Wallet (Mist), it will try to start up another instance of geth because it is unable to detect the first running instance of `geth.

Mist communicates with geth through the IPC file. In Linux this IPC file is $HOME/.ethereum/geth.ipc.

Because you have disabled the IPC file, in your geth command, Mist is unable to detect the first running instance.

And if you did not disable the IPC socket, geth will create it in your specified datadir with the full file name /media/user/sdcard/chaindata/geth.ipc.


Q: What should I do to be able to make Mist actually run when I start Geth the way I do as specified above?

What you will need to do is start geth specifying the IPC file that Mist expects to use (see How to change to private network in etherum wallet? to details on the IPC file path hard coded in Mist):

geth --datadir /media/user/sdcard/chaindata --ipcpath $HOME/.ethereum/geth.ipc console

Then start Mist.