Cardano-cli: Network.Socket.connect: <socket: 11>: does not exist

I ran the cardano node in background, so that I could logout of the machine and still have the process running.

nohup cardano-node run
–topology testnet-topology.json
–database-path db
–socket-path db/node.socket
–host-addr x.x.x.x
–port 3001
–config testnet-config.json &

I logged out, and logged back in. However, running the query tip throws exception

cardano-cli shelley query tip --testnet-magic 1097911063
cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (No such file or directory)

I’m seeing cardano-node running in the top command

96660 akhilaash+ 20 0 1.001t 586020 41992 S 175.8 7.2 39:42.98 cardano-node

akhilaash@cardano-node-test:~$ ps -aux | grep cardano
akhilaash+ 96660 178 7.2 1074955240 586020 ? Sl 06:56 45:54 cardano-node run --topology testnet-topology.json --database-path db --socket-path db/node.socket --host-addr x.x.x.x
56 --port 3001 --config testnet-config.json
akhilaash+ 97418 0.0 0.0 14852 1012 pts/0 S+ 07:22 0:00 grep --color=auto cardano

I have the same issue and after running your recommended command @ADAfrog I continue to receive the same <socket: 11> error.

Can you confirm the node is indeed up, running and on tip?

Also, the node will need to synced to a point where it has passed the hard fork into the shelley era for this command to work.

And I assume you are on testnet as well, correct?

Yes I am on the Testnet.

Whenever I run the following command to show if I’m up and running, I get the following live view image and don’t think I’m up and running.

’ cardano-node run
–topology testnet-topology.json
–database-path db
–socket-path relay/db/node.socket
–host-addr X.XX.XX.XX
–port 3001
–config testnet-config.json’

The following live view image:

My ‘epoch / slot’ are not increasing which makes me believe it is not connect. Is this a valid way of confirming if my node is running?

I’m seeing the blocks increasing:

However, unable to get the tip info or the utxo address info

akhilesh890@cardano-node-test:~/keysnaddresses$ cardano-cli shelley query utxo --address $(cat payment.addr) --testnet-magic 1097911063

cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (No such file or directory)akhilesh890@cardano-node-test:~/keysnaddresses$

akhilesh890@cardano-node-test:~/keysnaddresses$ cardano-cli shelley query tip --testnet-magic 1097911063

cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (No such file or directory)akhilesh890@cardano-node-test:~/keysnaddresses$

So seems like this env variable needs to be set explicitly every time, irrespective of being set in .bashrc and restarting it.Super weird. I never realized it because whenever I did echo on CARDANO_NODE_SOCKET_PATH, it gave me the right path so I “assumed” it was properly being set from .bashrc

export CARDANO_NODE_SOCKET_PATH=~/relay/db/node.socket;

1 Like

I’m confused at what I’m supposed to do. No matter how many times I run the “export CARDANO_NODE_SOCKET_PATH=~/relay/db/node.socket” in the terminal I continue to receive the same <socket: 11> after I re-testing using “ardano-cli shelley query tip --testnet-magic 1097911063”

Any assistance provided would be greatly appreciated.

Thank you

Hi Ash,

First try export CARDANO_NODE_SOCKET_PATH=~/relay/db/node.socket (remove trailing semicolon) in your .bashrc

Then try adding this to your test .bash_profile:

test -f ~/.bashrc && source ~/.bashrc

save and exit this source your .bash_profile
souce .bash_profile

2 Likes

Interesting thing is that now I get almost the same error when I run the “cardano-cli shelley query tip --testnet-magic 1097911063” within my home directory

cardano-cli: Network.Socket.connect: <socket: 10>: does not exist (Connection refused)

And receive the standard error after running the same function as above “cardano-cli shelley query tip --testnet-magic 1097911063” within my relay directory

cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (Connection refused)

Idk what I’m doing wrong with this tbh… Thank you for anymore assistance.

Check if you are correctly pointing to the socket:

#check if you have variable set:
echo $CARDANO_NODE_SOCKET_PATH
#check if the path is correct:
ls -al $CARDANO_NODE_SOCKET_PATH

if you get No such file or directory, then the path to socket file is wrong

2 Likes

Hi Lauris,

No matter how many times I verify and execute the correct path for the socket file to be exported into the db folder it doesn’t work. I go back and verify within the db folder if the socket file get’s placed there it doesn’t show up.

What could this mean?

Thanks,
Andres

try to run the command with ~/
~/db/node.socket

Can you check the path you have set for db in your start script?
check for something similar:
–database-path ~/cnode/db/…

this will be the correct path which you have to edit and set with:
export CARDANO_NODE_SOCKET_PATH=~/relay/db/node.socket

Let us know if this is helpful.

1 Like

Maybe because when you kill your cardano node process, this doesn’t kill the established socket connection that the database uses, and so to “reset it” and let your system know that a new socket connection needs to be created because the db is using the old one, so in order to run a new instance of cardano node, maybe you have to ‘kill the socket connection’, and export the “path socket” again because the system thinks it doesn’t exist because it’s still in use even though you shut down the node,or it could be that if you wait too long to restart your node, maybe there is a socket timeout, and if you don’t restart it soon enough, the cardano-cli or system will treat the socket as being open when it actually isn’t…I don’t know anything about it…I’m just taking a wild stab…what else would explain the bizarre intermittently working behavior of the “export path” command for the socket when you have already written it to .bashrc and ‘sourced’ it? I’m just taking a wild guess…maybe this weird behavior can be pinpointed by using a combination of commands like netstat -a | grep -i socket, echo $CARDANO_NODE_SOCKET_PATH, etc.

I didn’t bother trying to pinpoint to figure out why it fails sometimes, I just make a short alias to circumvent this ‘headache’ whenever it appears. Yes, it appears to be a persistent problem for many users.

I can’t believe what a difference a “~/” would make to a path and made my “CARDANO_NODE_SOCKET_PATH” to match. I used this path to make it work.

cardano-node run
–topology testnet-topology.json
–database-path ~/relay/db
–socket-path ~/relay/db/node.socket
–host-addr x.x.x.x
–port 3001
–config testnet-config.json

I hope that other people can find this solution and it’ll help them maneuver this issue. It’s taken me days to get passed this small issue using the Stake Pool School guide and know that others will face this same tiny issue.

Thank you so much everyone for all of your assistance!

1 Like

Yes, absolute paths and relative paths make a big difference, your cardano-cli ‘’–socket-path ~/relay/db/node.socket" flag will work from anywhere because you’re using an absolute path which specifies the location independently of whatever location (directory) you run cardano-cli command from as long as you don’t change to some other user like root; whereas, a relative path like ‘–socket-path db/node.socket’ only works when you do the command inside the directory that contains the ‘db’ directory.

1 Like

Understood so I will definitely need to be aware once I do start making changes to my users and such once I start working towards releasing my Mainnet version.

Thank you all so much!

1 Like

I still get <socket: 11> error often. That’s one of the most persistent issues on cardano node.

One way to deal with it is add the following line to ~/.bashrc:

alias xnp=“export CARDANO_NODE_SOCKET_PATH=~/relay/db/node.socket && source ~/.bashrc”

Then whenever the problem arises just type “xnp” without the quotes in the command line. You only need to source .bashrc the first time, then after than you can just type “xnp” without quotes to ‘eXport Node-socket Path’ and ‘source ~/.bash’ with a single command, you can call the alias whatever you want, just make it something you can remember and that it doesn’t
clash with an existing bash command. :wink:

Note: This only works for people who have their ‘relay’ folder in their home directory. If you have your relay folder insider your cardano-node directory, and cardano-node directory is in your home directory, then change the line in .bashrc to…

alias xnp=“export CARDANO_NODE_SOCKET_PATH=~/cardano-node/relay/db/node.socket && source ~/.bashrc”

1 Like

I realize now why this is a persistent issue (one of the reasons if not the only reason).
Source .bashrc only works on a ‘per terminal window’ basis.
if you open a terminal (emulation) window using xterm, terminator, terminal, etc. then ‘sourcing’ .bashrc only works within that window; i.e., alias, functions, etc. within .bashrc only work within the ‘sourced’ term window. If you open up a new terminal window and try to run an alias from that window, it won’t work. You have to ‘re-source’ .bashrc from within that new term window.
The exception to this rule is that ‘sourcing’ . bashrc from any terminal window will enable aliases, etc. within .bashrc to be executed within console windows after you log into them, regardless of which console window you’re using;i.e., you don’t need to ‘re-source’ .bashrc for consoles (console windows).

Note: This isn’t the case for every term window you use. Only certain term windows need to have .bashrc ‘re-sourced’. Still can’t figure that one out.

should I see the node socket path just like I see ~/.local/bin and ~/.cabal/bin because I see those two but I have yet (never) seen the socket one show up in that same place (environment path).