failed to init L1: failed to get L1 RPC client: failed to dial L1 address
Hey guys, trying to set a fullnode on Ubuntu 22.04 and it's been frustrating and confusing to say the least. The instructions don't make clear at all what the different fields in the composer file even mean, and what are the clear boundaries between my L1 node and the BASE node.
The specific problem is, my base Docker node seems unable to connect to my L1 geth node at http://localhost:8545. I have verified that localhost:8545 is up and running and works as expected to send ETH transactions.
From .env.mainnet:
# [recommended] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=http://localhost:8545
My docker-compose.yml:
version: '3.8'
services:
geth: # this is Optimism's geth client
build: .
ports:
# https://github.com/base-org/node/issues/79
- 8645:8545 # RPC - changed to avoid port conflict
# https://github.com/base-org/node/issues/79
- 8646:8546 # websocket - changed to avoid port conflict
- 36303:30303 # P2P TCP (currently unused) - changed to avoid port conflict
- 36303:30303/udp # P2P UDP (currently unused) - changed to avoid port conflict
- 7301:6060 # metrics
command: [ "bash", "./geth-entrypoint" ]
volumes:
- ${GETH_HOST_DATA_DIR}:/data
env_file:
# select your network here:
# - .env.sepolia
- .env.mainnet
node:
build: .
depends_on:
- geth
ports:
- 7545:8545 # RPC
- 9222:9222 # P2P TCP
- 9222:9222/udp # P2P UDP
- 7300:7300 # metrics
- 6060:6060 # pprof
command: [ "bash", "./op-node-entrypoint" ]
env_file:
# select your network here:
# - .env.sepolia
- .env.mainnet
It seems like the BASE node can't connect to the world outside of the Docker container, i.e. it can't "see" localhost:8545 from inside its container.
I tried this change to .env.mainnet, but it didn't help:
OP_NODE_L1_ETH_RPC=http://host.docker.internal:8545
The exact log output of the error is:
node_1 | t=2024-03-26T15:41:58+0000 lvl=eror msg="Error initializing the rollup node" err="failed to init L1: failed to get L1 RPC client: failed to dial L1 address (http://host.docker.internal:8545): operation failed permanently after 10 attempts: address unavailable (http://host.docker.internal:8545)"
node_1 | t=2024-03-26T15:41:58+0000 lvl=crit msg="Application failed" message="failed to setup: unable to create the rollup node: failed to init L1: failed to get L1 RPC client: failed to dial L1 address (http://host.docker.internal:8545): operation failed permanently after 10 attempts: address unavailable (http://host.docker.internal:8545)"
base-fullnode_node_1 exited with code 1
Same issue here, I also tried adding
extra_hosts:
- "host.docker.internal:host-gateway"
in the docker compose config but with no luck
In "normal" (non-composer) Docker you need to "expose" ports of the host computer explicitly to the Docker container. You can do so by adding --expose=8545 to the docker command line and then host.docker.internal:8545 becomes an "alias" for localhost:8545.
For sh*ts and giggles I added the docker-compose equivalent field expose to the .yml but still doesn't help anything:
expose:
- "8545"
Added this to both the geth and the node section for good measure, but no luck, with or without quotes around 8545.
I literally tried everything suggested here, docker-compose can't "see" the host computer's localhost:8545:
https://forums.docker.com/t/how-to-reach-localhost-on-host-from-docker-container/113321/15
@webhype
Hello, thanks for opening this issue (also @Jeko83 for additional details). The Base Node also needs to run on 8545, so it will conflict ports with your L1 node if it's also running on the same port. Can you please update and confirm that you're able to fetch the latest block of your L1 from inside the docker container?
Hi, as the originl logs cited show, there is no connection to the L1 node (geth on Ubuntu 22.04) whatsoever. So obviously it can't get even one block. That's the whole point of the issue. Did you read it? Also, I avoided port conflicts by making the changes marked here:
services:
geth: # this is Optimism's geth client
build: .
ports:
# https://github.com/base-org/node/issues/79
- 8645:8545 # RPC - changed to avoid port conflict
# https://github.com/base-org/node/issues/79
- 8646:8546 # websocket - changed to avoid port conflict
- 36303:30303 # P2P TCP (currently unused) - changed to avoid port conflict
- 36303:30303/udp # P2P UDP (currently unused) - changed to avoid port conflict
- 7301:6060 # metrics
I have shown all the steps to reproduce it. Just follow the instructions at https://docs.base.org/guides/run-a-base-node/ with a L1 node running already on 8545/8546 (default config that 99% of your users will have) and it just doesn't work. Please investigate because I fear that the instructions that you published are missing a critical aspect. According to the links I posted, there may be a Docker issue, so it works on Mac but not on Ubuntu. Whatever the problem is, it should documented and perhaps there's a workaround.
Also super helpful would be a docker-less tutorial. Why even use docker, it's not like we "spin up" and "spin down" a 2.5 TB BASE fullnode that takes 2 weeks to sync, multiple times a day.
I am connecting to my L1 local node via ssh and forwarding ports. I can reach both rpc and ws on 9545 and 9546 respectively. No issues there. The beacon port is also forwarded and working fine. The issues comes from the fact that the docker container cannot reach the host in any way. Me and @webhype tried everything, from the standard container host ip to the host.docker.internal method, expose and chancing the docker-compose config. Nothing seems to work, it's like the container is locked tight. I also changed the network mode, trying bridge and host, without success.
I think this might be some weird configuration going on inside the image itself.
@webhype
Thanks for the additional details and also the feedback regarding the docs. Indeed, I read the original issue but apologies that I did not catch what you meant in your first post. There are other people successfully setting up nodes with this docker image so I suspect something else here may be the cause. Also, I set up a node using the latest release, in a clean install of Ubuntu 22.04 and was also able to set up the Base node and see it begin syncing without issue.
Would it be an option to revert docker-compose back to the original settings, without updating the ports, and update the ports on the L1 node instead? Just trying to rule that out also.
@Jeko83
Are you running the same config as @webhype or the default one, with just the L1 and Beacon endpoints added? Any other changes?
Thanks and appreciate the patience.
Thanks, but you did not address the issue of being unable to reach localhost:8545 (L1 geth node) from within the docker container; that’s all we’re talking about here for days and you have ignored that so far. Not trying to be provocative, just trying to steer the conversation to the actual problem.
When you said you were able to set BASE up successfully on a clean machine, you mean without a full Etherum geth runinng on the machine? So this is not at all what we are taking about. You did not detail how you connect to L1, which Ethereum RPC node (local or some paid external URL/service) and on which port. These details seem of the essence here.
99% of people who have an Etherum geth node already on the machine that they intend to install BASE on, have it running on 8545 and 8546. Since BASE is L2 it would be smart to give it a different set of ports by default, which is exactly what we’re trying to do by modifying the docker compose file.
Avoiding the port conflict seems to work but from inside docker it can’t reach the local L1 fullnode.
Unfortunately you did not comment at all about the real-world situation of an L1 geth node running on the same machine on ports 8545/8546 and how a BASE node can coexist with it, which I believe to be a very common use case.
Again, to drive home the point, and o can only find so many words to say the same thing: the only issue here is that the docker container can’t reach localhost:8545 (local geth Ethereum node as L1). Perhaps external RPC URLs work, but we need localhost:8545 to be reachable from within Docker.
I can imagine how busy you are, and we appreciate all you do here at no charge.
Thanks again.
Thanks, but you did not address the issue of being unable to reach localhost:8545 (L1 geth node) from within the docker container; that’s all we’re talking about here for days and you have ignored that so far. Not trying to be provocative, just trying to steer the conversation to the actual problem.
When you said you were able to set BASE up successfully on a clean machine, you mean without a full Etherum geth runinng on the machine? So this is not at all what we are taking about. You did not detail how you connect to L1, which Ethereum RPC node (local or some paid external URL/service) and on which port. These details seem of the essence here.
99% of people who have an Etherum geth node already on the machine that they intend to install BASE on, have it running on 8545 and 8546. Since BASE is L2 it would be smart to give it a different set of ports by default, which is exactly what we’re trying to do by modifying the docker compose file.
Avoiding the port conflict seems to work but from inside docker it can’t reach the local L1 fullnode.
Unfortunately you did not comment at all about the real-world situation of an L1 geth node running on the same machine on ports 8545/8546 and how a BASE node can coexist with it, which I believe to be a very common use case.
Again, to drive home the point, and o can only find so many words to say the same thing: the only issue here is that the docker container can’t reach localhost:8545 (local geth Ethereum node as L1). Perhaps external RPC URLs work, but we need localhost:8545 to be reachable from within Docker.
I can imagine how busy you are, and we appreciate all you do here at no charge.
Thanks again.
exact same situation here.
Same here, trying to get this running with a local reth install. Would be helpful to have docs to show the right port setup. I assume they should be on the same network. Reth creates its own so just adjust the base docker-compose to use that network? At first I thought I had this set right, but when I start the geth/node docker-compose for base I get this error:
node-1 | t=2024-04-04T12:47:34+0000 lvl=eror msg="failed to fetch runtime config data" err="failed to fetch unsafe block signing address from system config: failed to fetch proof of storage slot 0x65a7ed542fb37fe237fdfbdd70b31598523fe5b32879e307bae27a0bd9581c08 at block 0x88d0a43196fede430dfeb10d1cf09a1782a8825fdfd9a6d79f036b34ba419e6d: eth_getProof is unimplemented for historical blocks"
Agree easily working with a local node seems to be a very common use case that should be easy to get working.
Making progress. I used these settings, where the URLs are the names of my containers
# [required] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=http://reth-reth-1:8545
# [required] replace with your preferred L1 CL beacon endpoint:
OP_NODE_L1_BEACON=http://reth-lighthouse-1:5052
I set the ports in the base docker-compose to be:
geth:
- 8547:8545 # RPC
- 8548:8546 # websocket
- 30304:30303 # P2P TCP (currently unused)
- 30304:30303/udp # P2P UDP (currently unused)
node:
- 7545:8547 # RPC
Then made sure the base docker-compose was using the reth network
networks:
reth_default:
external: true
And adding these to both geth and node service definitions:
networks:
- reth_default
Final step was to uncomment the OP_GETH_SYNCMODE and set it to full rather than snap, sounds like snap is busted right now? I used a snapshot so hopefully this won't take too long...
Of course will be different depending on your L1, but it appears to be syncing now. We'll see.
Just to summarize the thread and make sure I follow, there are two different setups that people are discussing here:
- @salparadi is running reth in docker
- @webhype & @Jeko83 are running their L1 outside of docker on the localhost on Ubuntu.
I'm going to focus on the L1 node on localhost case, as the other example is working.
You can use 172.17.0.1:<port> to access services on a localhost on Ubuntu. For this to work, you'll need to ensure that the L1 is listening on address 0.0.0.0 and not 127.0.0.1.
If you have done the above and it still doesn't work you can try to debug this with telnet and netcat, example below:
# In a terminal session outside of docker, listen for TCP connections with netcat
nc -l 0.0.0.0 2222
# In a second terminal session, start geth, connect to it and install telnet
docker-compose up -d geth
docker-compose exec geth bash
apt-get update && apt-get install telnet
# Test connectivity to the external host
telnet 172.17.0.1 2222
# if it works you'll see
Trying 172.17.0.1...
Connected to 172.17.0.1.
Escape character is '^]'.
# if it doesn't work you'll see
root@5bf3a5ac38c2:/app# telnet 172.17.0.1 3333
Trying 172.17.0.1...
telnet: Unable to connect to remote host: Connection refused
If you can try using 172.17.0.1:<port> and if that doesn't work please share the output from the telnet/netcat test.
Hello,
I was having almost the same problem @webhype & @Jeko83 when running my L1 outside of docker on the localhost on Ubuntu.
I tought my input on how I solved the problem might help, it closely resemble @danyalprout solution and his is probably better.
Basicly, giving 127.0.0:"port" to a container in docker doesn't make sense since it tells the container to look for a service inside the same container on the port "port", but the L1 node is running outisde the container.
So what I did to solve the problem is:
- I made the L1 node to list to 0.0.0.0 and not 127.0.0.1 (for both the execusion and consensus node: geth and prysm in my case)
- I made the my .env.mainnet variables to be the following:
OP_NODE_L1_ETH_RPC=http://192.168.1.57:8545
OP_NODE_L1_ETH_BEACON=htttp://192.168.1.57:3500
The address "192.168.1.57" is the local ip address on the computer that is running geth and prysm and that was given by the router to that computer. (I configured it to be static in my case).
And this steps solved the problem for me.
Thanks for your answers guys, but ummm... isn't running geth on 0.0.0.0 (glob on to all IPs internal and external) discouraged? Yes I could configure a firewall to then fix that security hole but...
Thanks for your answers guys, but ummm... isn't running geth on 0.0.0.0 (glob on to all IPs internal and external) discouraged? Yes I could configure a firewall to then fix that security hole but...
I didn't concern myself about that as I'm running everything inside my local home network hidden behind my router which has no port open or forwarded to the outside, so it the geth is only visble inside my local network only.
but Yep I guess you could make some firewaall rule so that geth port is only acceble to the base node docker.
I'm going to close this issue as we have an understanding of the problem and workaround. Another option here is to run op-geth and op-node using systemd instead of docker (may require remapping some ports, but it should be doable).