Tmux can not reconnecting after detaching

I install ed tmux on discovery, but each time when I detached a session. When I typed “tmux ls”, I got this erroe message.

error connecting to /tmp//tmux-351365/default (No such file or directory)

So can anyone help me, many thanks in advance

I am having the same problem!
I read somewhere on the web that tmux creates the missing socket file if we send -USR1 signal.

$ tmux ls
error connecting to /tmp//tmux-260065/default (No such file or directory)
$ pkill -USR1 tmux 
 #ignore warnings; the above cmd signals all users' tmux processes,
#  but only your user process will accept it
$ tmux ls
0: 4 windows (created Sat Sep 19 17:32:14 2020)

This is a temporary workaround, and I like to know if there is a permanent fix.
Thanks

1 Like

Thanks Thamme, I tried the way you showed, but I still got the same error.

Do you know why? I doubted the way I installed is wrong, can you please share me your installation?

I sometimes get that problem too; then I try one more time and it works.

I suggest you try once more:

pkill -USR1 tmux 2> /dev/null  && tmux ls 

I don’t really know why this is happening.
In the old HPC, they had installed some policies to kill the inactive sessions after certain timeout.
It was a deliberate act to reduce the load on login nodes.
I wonder if this is similar – my suspicion is that some process on login nodes is actively deleting the tmux socket files thinking tmux is inactive?

2 Likes

Also, another thing to keep in mind about tmux
as you may know - it works as a pair of server and client processes.
Its important to keep the server and client to be of same version.
=> My version of tmux client may not work with your existing tmux server if the versions arent compatible.

So, I suggest using my tmux installation to test the new sessions only, and using your current tmux client if you want to reconnect to the older sessions.

Cheers,
TG

Hello,

There is a working installation of tmux available on Discovery as a module. Could you please try using the tmux module via:
module load tmux/3.0a

GREAT! Thank you very much, now it works.

1 Like

The server socket is stored in /tmp by default, and the /tmp directories are cleared routinely on the login and compute nodes. So that’s why the socket file is missing. If you load the tmux module, then it automatically sets the environment variable TMUX_TMPDIR to /scratch2/$USER and socket files will be stored there. You can also change this location by setting the TMUX_TMPDIR variable yourself.

2 Likes

Thanks. The mystery is now solved!