Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I was trying to re-attach to a long-running tmux session to check up on a python web-application. However tmux attach claims that there is no running session, and ps shows a tmux process (first line), but with a question mark instead of the pts number.

What does this mean---is this tmux session permanently lost, and what could have caused it? Is there still a way to look at the current state of the python process, spawned in the tmux session and running in pts/19 (second line)?

[mhermans@web314 ~]$ ps -ef | grep mhermans
mhermans 16709     1  0 Mar04 ?        00:26:32 tmux
mhermans  8526 16710  0 Mar04 pts/19   00:20:04 python2.7 webapp.py
root      9985  6671  0 10:18 ?        00:00:00 sshd: mhermans [priv]
mhermans 10028  9985  0 10:18 ?        00:00:00 sshd: mhermans@pts/16
mhermans 10030 10028  0 10:18 pts/16   00:00:00 -bash
mhermans 16247 10030  6 10:28 pts/16   00:00:00 ps -ef
mhermans 16276 10030  0 10:28 pts/16   00:00:00 grep mhermans
mhermans 16710 16709  0 Mar04 pts/19   00:00:00 -bash
mhermans 16777 16709  0 Mar04 pts/21   00:00:00 -bash
share|improve this question
    
What does tmux ls show? –  jasonwryan Jun 16 '12 at 9:04
    
"failed to connect to server: Connection refused" –  mhermans Jun 16 '12 at 10:31

2 Answers 2

up vote 7 down vote accepted

Solution courtesy of the Webfaction-support:

As the process was still running, the issue was a deleted socket, possibly caused by a purged tmp-directory.

According to the tmux mapage:

If the socket is accidentally removed, the SIGUSR1 signal may be sent to the tmux server process to recreate it.

So sending the signal and attaching works:

killall -s SIGUSR1 tmux
tmux attach
share|improve this answer

Terminal absence is a sign of detached session. And all your tmux session names can be found thus:

ls $TMP/tmux-$(id -u) or ls /var/run/tmux/tmux-$(id -u)

— this is kinda distro-dependent. Almost distro-independent (and more hardcore) would be:

lsof -n -p 16709 | awk '{if($5 == "unix") print;}'

where 16709 is the PID of tmux in your listing.

share|improve this answer
    
id -u gives 532 and /tmp/tmux-532 contains a single file "default". How does this help me further? –  mhermans Jun 16 '12 at 20:27
    
Try tmux -S /tmp/tmux-532/default at, but default socket-name should be just ok with tmux at. What does lsof-version say? –  poige Jun 17 '12 at 2:31
    
The first command results in a "no sessions" response. lsof -v output. –  mhermans Jun 17 '12 at 22:11
    
lsof as given in my answer, dude. :) –  poige Jun 18 '12 at 2:31
    
@mhermans, I meant lsof-version of my answer, we don't need its software version. :) –  poige Jun 18 '12 at 3:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.