Go-ethereum: geth attach ignores command line args: --datadir, --ipcpath

Created on 28 May 2016  路  13Comments  路  Source: ethereum/go-ethereum

System information

Geth version: 1.4.5-stable-a269a713
OS & Version: Linux

Expected behaviour

./geth --datadir /tmp/geth --ipcpath /tmp/geth/geth.ipc attach

attaches to a geth instances running with ./geth --datadir /tmp/geth

Actual behaviour

$ ./geth --datadir /tmp/geth --ipcpath /tmp/geth/geth.ipc attach
Fatal: Unable to attach to geth: dial unix /home/redfish/.ethereum/geth.ipc: connect: no such file or directory

So, it incorrectly looks in the default location: $HOME/.ethereum

I also tried relative path for --ipcpath, and various combinations of ./geth attach --datadir --ipcpath.

WORKAROUND: symlink from default location to true location: ln -s /tmp/geth/geth.ipc $HOME/.ethereum/geth.ipc

Steps to reproduce the behaviour

./geth --datadir /tmp/geth
# open other terminal
 ./geth --datadir /tmp/geth --ipcpath /tmp/geth/geth.ipc attach
triage

Most helpful comment

Attach expects the ipc (or any other rpc endpoint) after the attach subcommand. You can find some examples in in the wiki. In your case the command should be something like: geth attach ipc:/tmp/geth/geth.ipc.

All 13 comments

Attach expects the ipc (or any other rpc endpoint) after the attach subcommand. You can find some examples in in the wiki. In your case the command should be something like: geth attach ipc:/tmp/geth/geth.ipc.

Ok, thanks for the info. This was not at all obvious. I also did check geth attach --help.

The behavior of ignoring the "global-scope" ipcpath argument is counterintuitive. I close this issue, but to really resolve it the current behavior should be documented in geth attach --help and/or the attach command should honor the "global-scope" ipcpath argument (that would be intuitive).

geth attach --help
attach [arguments...]

                The Geth console is an interactive shell for the JavaScript runtime environment
                which exposes a node admin interface as well as the 脨app JavaScript API.
                See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console.
                This command allows to open a console on a running geth node.

I swear this used to just connect to morden automatically if it was the one running. So now this is what works for me:

geth --testnet
geth attach ipc:/Users/zmitton/Library/Ethereum/testnet/geth.ipc

That is correct, this was changed for geth 1.4. Geth 1.3 would open the ipc endpoint for the testnet on the same location as it would have been started for the mainnet. Therefore you didn't have to specify the endpoint location. For geth 1.5 we are moving to a different ipc endpoint which is more generic and can be used by other implementation.

You could drop the --testnet flag. It is ignored for attach, just the part after ipc: is used.

It would be good to update the documentation, seems like the --ipcpath arg is superfluous; the ipc:/... worked fine for me too.

@cisaacson-rms Not really, I believe it's for you to specify the path of the ipc file that is going to be placed. (I don't have the environment now, so can't 100% confirm)

Hey guys, seems like it still is not reflected in documentation? Would have saved a bit of my and other developers time if it was 馃槃

user@ubuntu# geth --help
NAME:
   geth - the go-ethereum command line interface

   Copyright 2013-2017 The go-ethereum Authors

USAGE:
   geth [options] command [command options] [arguments...]

VERSION:
   1.7.3-stable-4bb3c89d
user@ubuntu# geth --datadir "/mnt/volume-nyc3-01/blockchains/tmp.JZ07ZCiqmi" attach
Fatal: Unable to attach to remote geth: dial unix /root/.ethereum/geth.ipc: connect: no such file or directory
user@ubuntu# geth attach --help
attach [command options] [arguments...]

The Geth console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the 脨app JavaScript API.
See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console.
This command allows to open a console on a running geth node.

ETHEREUM OPTIONS:
  --datadir "/root/.ethereum"  Data directory for the databases and keystore

API AND CONSOLE OPTIONS:
  --jspath loadScript  JavaScript root path for loadScript (default: ".")
  --exec value         Execute JavaScript statement
  --preload value      Comma separated list of JavaScript files to preload into the console

@radfish Please reopen. This documentation is incomplete.

Asked to re-open so that documention can get updated.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Upgrade to the new version of mist can not connect to the private network
The original order was
Upgrade to the new version of mist can not connect to the private network
The original order was
$electron . --rpc /work/blockchain/eth-private/ipc

The new version of the connection method is to specify the path of the ipc to the fixed ipc location when starting the geth.
$ geth --datadir /my/chain/ --networkid 23 --ipcpath ~/Library/Ethereum/geth.ipc

then
Yarn dev:election

Connect

Mist 0.9.3 杩炴帴绉佹湁geth缃戠粶

This now works:

[user@work go-ethereum]$ build/bin/geth --datadir /tmp/foo attach 
Fatal: Unable to attach to remote geth: dial unix /tmp/foo/geth.ipc: connect: no such file or directory

Having support for ipcpath is sily, because it's the ipcpath that is the main argument to attach

Was this page helpful?
0 / 5 - 0 ratings

Related issues

362228416 picture 362228416  路  3Comments

keitaj picture keitaj  路  3Comments

bgrieder picture bgrieder  路  3Comments

AdrianScott picture AdrianScott  路  3Comments

aakilfernandes picture aakilfernandes  路  3Comments