Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geth attach does not work. #1908

Closed
jtremback opened this issue Oct 16, 2015 · 28 comments
Closed

geth attach does not work. #1908

jtremback opened this issue Oct 16, 2015 · 28 comments

Comments

@jtremback
Copy link

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
Copy link
Contributor

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

@jtremback
Copy link
Author

Yes, started geth with geth console

@paulmorriss
Copy link

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
#1908 (comment)
.

Paul Morriss
http://paulmorriss.com

@obscuren
Copy link
Contributor

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

@karalabe
Copy link
Member

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
Copy link

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
Copy link

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
Copy link

ogurcan commented Feb 12, 2017

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
Copy link

jmahhh commented Mar 14, 2017

geth attach http://127.0.0.1:8545

@fjl
Copy link
Contributor

fjl commented Mar 14, 2017

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

@fanxiong
Copy link

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

@ronaldpetty
Copy link

ronaldpetty commented Sep 24, 2017

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
Copy link

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
Copy link

ekotysh commented Nov 5, 2017

On MacOS (for testnet):

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

@AntoniosHadji
Copy link

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
Copy link
Contributor

lmars commented Nov 23, 2017

@AntoniosHadji

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

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

@AntoniosHadji
Copy link

AntoniosHadji commented Nov 24, 2017 via email

@whitehat-coders
Copy link

whitehat-coders commented Dec 19, 2017

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

@arthakdoo
Copy link

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
Copy link

mallapurbharat commented Jan 22, 2018

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
Copy link

pellet commented Feb 10, 2018

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
Copy link

geth attach http://127.0.0.1:8545

that one works for me ok

@RobertChalmers
Copy link

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
Copy link

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
Copy link

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
Copy link

izidorit commented Nov 11, 2021

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
Copy link

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
Copy link
Contributor

holiman commented Dec 12, 2023

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests