Go-ethereum: geth attach does not work.

Created on 16 Oct 2015  Â·  24Comments  Â·  Source: ethereum/go-ethereum

Fails with this error:

$ geth attach
Fatal: Unable to attach to geth node - dial unix /Users/jehan/Library/Ethereum/geth.ipc: connect: connection refused

Most helpful comment

geth attach http://127.0.0.1:8545

All 24 comments

Just to be sure; you have a node running, correct?

Yes, started geth with geth console

Is the node using the default data directory? I got this error when I was
running one with a non default data directory and I forgot to specify it on
the geth attach command line too.
Paul

On Friday, October 16, 2015, Jehan [email protected] wrote:

Yes, started geth with geth console

—
Reply to this email directly or view it on GitHub
https://github.com/ethereum/go-ethereum/issues/1908#issuecomment-148842840
.

Paul Morriss
http://paulmorriss.com

@jtremback if you supplied a --datadir /tmp/something make sure that you attach using geth attach ipc://tmp/something

I figure this is solved. We should probably clean up the CLI args further, but that's on our long term todo list already.

In case anyone had a similar issue, I was starting with --datadir /tmp/something and had to use geth attach ipc://tmp/something/geth.ipc (including geth.ipc)

Had a similar issue when starting in developer mode with geth --dev console. This is what worked:

$ geth attach ipc://tmp/ethereum_dev_mode/geth.ipc

I have a similar problem. I initialize my private local network as:

geth --identity="Node01" --datadir="./Node01" -verbosity 6 --ipcdisable --port 30301 --rpcport 8101 --networkid="12345" init ./CustomGenesis.json 2>> ./Node01.log

And then running the console as:

geth --identity="Node01" --datadir="./Node01" -verbosity 6 --ipcdisable --port 30301 --rpcport 8101 --networkid="12345" console 2>> ./Node01.log

Normally the console here work fine, but when I open another terminal window and try to attach, I am having this error message:

onders-macbook-pro:local_private_network ogurcan$ geth attach
Fatal: Unable to attach to remote geth: dial unix /Users/ogurcan/Library/Ethereum/geth.ipc: connect: no such file or directory

I also realized that geth is not creating a geth.ipc under the custom data directory I am giving, i.e. /Users/ogurcan/ethereum_test_networks/local_private_network/Node01/. As a result, I am unable to say geth attach ipc//something, like you guys above did.

Any ideas?

geth attach http://127.0.0.1:8545

@ogurcan You are using the --ipcdisable option, which disables creation of geth.ipc.

didn't need use --datadir, just geth attach ipc://somePath/geth.ipc

Just curious why this is closed? While ipc://.. worked, it is not in the help menu and so far (as of latest release today), this issue is the only place I have found evidence of how to do this (I might have missed something).

Why doesn't datadir have it default to geth.ipc like other subcommands? Is there a tracker for these type issues, I be happy to jump in.

I started geth with --testnet option:

geth --testnet --cache 2048 --rpc

To attach I used following command (on Linux):

geth attach ipc:/home/den/.ethereum/testnet/geth.ipc

On MacOS (for testnet):

geth attach ipc:/Users/ed/Library/Ethereum/testnet/geth.ipc

I'm running geth under a system user and the ipc socket only has permissions 600, owner can rw. I get the following error when try geth attach
Fatal: Unable to attach to remote geth: dial unix /home/antonios/.ethereum/geth.ipc: connect: permission denied
I can connect fine if using sudo geth attach

Is it possible to change permissions on ipc socket to 660?

@AntoniosHadji

Is it possible to change permissions on ipc socket to 660?

Run sudo chmod 660 /home/antonios/.ethereum/geth.ipc.

Yes, that is a manual way that works. I want to know if there is a way to
make the change permanent.

Antonios

On Nov 23, 2017 12:48 PM, "Lewis Marshall" notifications@github.com wrote:

@AntoniosHadji https://github.com/antonioshadji

Is it possible to change permissions on ipc socket to 660?

Run sudo chmod 660 /home/antonios/.ethereum/geth.ipc.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ethereum/go-ethereum/issues/1908#issuecomment-346674278,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB19GHzKXm8a2kfTU7NNDfSBfR3A9Bqhks5s5a_mgaJpZM4GQgCC
.

you can use crontab -e. then add this to to set permission.
* * * * * chmod 660 /path/to/geth.ipc

It's important to specify the ABSOLUTE path in the ipc:/ address. For example:

geth --datadir ~/eth-priv attach ipc:/home/myuser/eth-priv/geth.ipc

One way to find out the exact path to the IPC endpoint is to stop the geth node instance by pressing CTRL+C.

At the end of the console output, you should see something like
INFO [01-23|02:45:01] IPC endpoint closed: /home/path/to/myfolder/geth.ipc

Just copy-paste this path prepended with ipc:// to get the path to the ipc file. Just make sure that there are only two backslashes (/) in the ipc://home path beginning.
so you'd basically be doing

geth attach ipc://home/path/to/myfolder/geth.ipc

HTH.

I had issues with this due to using a symbolic link on macOS, I had to specify the real location of the ipc file.
e.g:
geth attach ipc:/Volumes/storage/Ethereum/testnet/geth.ipc

geth attach http://127.0.0.1:8545

that one works for me ok

found a solution.
First:
geth --unlock 0x2Dc6f1E4c8D2fDD46A6b6b11b2037F577bB1f4Cd --datadir=/Users/robert/Library/Ethereum —mine

Then in another Terminal run
zeus:~ robert$ geth attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.11-stable/darwin-amd64/go1.10.3
coinbase: 0xc9b74488b8e699b54803464a33d57cfff7eb052c
at block: 0 (Thu, 01 Jan 1970 01:00:00 BST)
datadir: /Users/robert/Library/Ethereum
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

For windows following worked for me!!

After opening geth instance, something like following will be on console
IPC endpoint opened. . . . . . url=\\\\.\\pipe\\geth.ipc

For attach, copy above url, replace '\\' with '/' and type following on other console
geth attach "//./pipe/geth.ipc"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leonzhao picture leonzhao  Â·  3Comments

362228416 picture 362228416  Â·  3Comments

aomiba picture aomiba  Â·  3Comments

cheershendtco picture cheershendtco  Â·  3Comments

freshonline picture freshonline  Â·  3Comments