ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.54k stars 20.13k forks source link

geth attach does not work. #1908

Closed jtremback closed 8 years ago

jtremback commented 9 years ago

Fails with this error:

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

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

jtremback commented 9 years ago

Yes, started geth with geth console

paulmorriss commented 9 years ago

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 notifications@github.com 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

obscuren commented 9 years ago

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

karalabe commented 8 years ago

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

IstoraMandiri commented 8 years ago

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)

realAkhmed commented 8 years ago

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
ogurcan commented 7 years ago

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?

jmahhh commented 7 years ago

geth attach http://127.0.0.1:8545

fjl commented 7 years ago

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

fanxiong commented 7 years ago

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

ronaldpetty commented 7 years ago

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.

denispeplin commented 7 years ago

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
ekotysh commented 7 years ago

On MacOS (for testnet):

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

antonioshadji commented 6 years ago

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?

lmars commented 6 years ago

@AntoniosHadji

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

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

antonioshadji commented 6 years ago

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 .

whitehat-coders commented 6 years ago

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

arthakdoo commented 6 years ago

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

mallapurbharat commented 6 years ago

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.

pellet commented 6 years ago

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

jbarros35 commented 6 years ago

geth attach http://127.0.0.1:8545

that one works for me ok

RobertChalmers commented 6 years ago

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

jayantrane commented 5 years ago

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"

charuraj88 commented 3 years ago

I run in this command but i got error please help me out geth --datadir /speqto/Go-Xport attach ipc:/home/oem/speqto/Go-Xport /geth.ipc Fatal: Unable to attach to remote geth: dial unix /home/oem/speqto/Go-Xport: connect: connection refused

izidorit commented 2 years ago

Hi, I installed GETH into a non-default folder (instead of "/root/.ethereum/" I installed it into "/root/.ethereum/bsc") I added all paths, so it can find all the stuff it needs, which works fine:

DataDir = "/root/.ethereum/bsc"
IPCPath = "/root/.ethereum/bsc/geth.ipc"

But here comes the white people problem...I'm used to use "geth attach". But since now I have BSC and ETH in paralell to server as a backup server, I had to differenciate, so now it should be "gethbsc attach", but when I try it, it says: Fatal: Unable to attach to remote geth: dial unix /root/.ethereum/geth.ipc: connect: no such file or directory Which seems, it tries to access ipc file in the default path. gethbsc attach /root/.ethereum/bsc/geth.ipc works fine, but how can I edit the "default" path somehow? So it would work simply by giving the command gethbsc attach

Does anyone have any suggestion/idea?

Appreciated in advance!

wwwuyijia commented 11 months ago

geth attach http://127.0.0.1:8545 出现Fatal: Failed to start the JavaScript console: Post "http://127.0.0.1:8545": dial tcp 127.0.0.1:8545: connect: connection refused 这个错误应该怎么解决

holiman commented 11 months ago

@wwwuyijia please file a new ticket, and provide more information.

From the looks of it, nothing is listening on 127.0.0.1:8545