28

This sucks.

$ tmux attach-session
no sessions

My sysadmin upgraded tmux and now I can't reattach. My processes are still running according to ps ux. Is there any hope of recovering my session?

Update: There's a socket in /tmp/tmux-1234, so I tried tmux -L /tmp/tmux-1234/default attach, but tmux does nothing. Hooray.

3 Answers 3

50

This quickest way to determine if you can recover is:

killall -10 tmux

That will send the signal to recreate all socket files for any running tmux processes. If you're not root, no problem it will only signal your tmux process anyway.

Long story short, if tmux is not running (ps xu | grep tmux), you're screwed :(

4
  • 5
    This works, but I was confused about why it works. It turns out that signal 10 is a user-defined signal, and tmux says it will "recreate the server socket on SIGUSR1".
    – DaoWen
    Jan 19, 2015 at 19:47
  • 4
    As it might help others: I had to find the PID of the tmux process running my lost session and do kill -10 "PID".
    – user35915
    Mar 26, 2018 at 7:35
  • 2
    (1) Thanks for this answer, it saved me a ton of work :) (2) I think it would be helpful to mention that the messages you get when another user is also running tmux, namely tmux(12345): Operation not permitted, are expected.
    – David Z
    Jul 2, 2018 at 18:38
  • @DaoWen according to man signal (7), the signal value 10 does correspond to SIGUSR1, so all is well Feb 16, 2019 at 2:08
2

tmux is not guaranteed to be compatible across updates; ask your sysadmin to let you know before doing upgrades or use a copy you built locally that he is less likely to mess with.

0

Some updates to h0tw1r3's answer.

I encountered this error when using the following command to create named tmux sessions:

tmux -CC -L my-session-name

You can list the existing sessions on Ubuntu Linux 20.04 with (as root):

ls -lha /tmp/tmux-0

Or

pf -Af|grep -i tmux

Then you can send signal SIGUSER1 or 10 to tmux with:

pkill -f 10 tmux

Then you can try to attach

tmux -CC -L my-session-name attach

If you are still getting

tmux failed with error: “no sessions”

Make sure you are spelling your session name as the same as it is under ps -Af|grep -i tmux

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .