80

I'm trying to upgrade to a newer version (that has a bug fix) than my current 1.6. I am on Ubuntu and recently upgraded to Ubuntu 13.04.

Ideally I want to use tmux version 1.8 or even 1.9. I've downloaded newer versions but can't get them working.

I downloaded 1.9a but when I try and run it, it just hangs.

I tried this download: http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/README#l26

and did the

$ sh autogen.sh
$ ./configure && make

but I get

$ ./tmux
$ protocol version mismatch (client 8, server 6)

I tried to download and use a 1.8.4 version but the download didn't seem to have files I could use.

6 Answers 6

250

Pretty awesome hack, if you need your tmux working and not want to lose all your sessions:

$ tmux attach
protocol version mismatch (client 7, server 6)

$ pgrep tmux
3429
$ /proc/3429/exe attach

original post on Google Plus - https://plus.google.com/110139418387705691470/posts/BebrBSXMkBp

8
  • 2
    This looked so cool! But alas, in my debian squeeze -> jessie upgrade (with a temporary stop on wheezy), I got: tmux at == no sessions. /var/run/tmux/tmux-0/default existed, so I tried: tmux -S /var/run/tmux/tmux-0/default at == protocol version mismatch (client 8, server 6). Now /proc/$(pgrep tmux)/exe == /proc/2534/exe: Permission denied and ls -l /proc/$(pgrep tmux)/exe == /proc/2534/exe -> /usr/bin/tmux (deleted). :-( Commented Apr 23, 2015 at 9:33
  • Note, however, that in the Google Plus post which is referenced, tmux developer Thomas Adam writes that he doesn't recommend doing this.
    – Abbafei
    Commented May 27, 2015 at 14:53
  • I get the problem that the file handle at /proc/4705/exe is a stale file handle. Can I still use this trick?
    – Ferrybig
    Commented Jun 6, 2015 at 11:01
  • 1
    @PeterV.Mørch The /proc/$pid/exe files aren't regular symlinks; you should be able to use them to invoke the relevant programs even if they've been unlinked. Commented Nov 30, 2015 at 4:04
  • 1
    pgrep -o tmux gives the (single) pid of the oldest running tmux, presumably the one with the session you need, so /proc/$(pgrep -o tmux)/exe attach might work better than just running pgrep tmux (which can return multiple pids) Commented May 26, 2017 at 0:14
40

This basically tells you, that you already have an (old) tmux-server running and the new tmux can't connect to it because they don't understand each other anymore. Exit all your existing tmux sessions and start a fresh one using the new version and everything should be fine.

3
  • Yeah logging out seemed key. For the 1.6 to 1.7 upgrade I feel that logging out/in was the only fix. Subsequent version upgrades only seemed to require me to log out of all the terminal windows. Commented Mar 30, 2014 at 14:59
  • 10
    Please explain how to exit all tmux-sessions properly if you cannot access them, because tmux is not backward compatible! Killing processes is not what I call exiting, this is more like a massacre. ;)
    – Tino
    Commented Aug 17, 2015 at 9:14
  • 3
    I killed my existing tmux session by using pkill tmux (after seeking a tmux session with pgrep tmux) from a normal terminal. Afterwards, tmux launched/behaved correctly...
    – temuraru
    Commented Jan 26, 2017 at 10:10
3

kill all tmux process should work as I also encountered this problem.

sudo killall -9 tmux
2

This perhaps isn't ideal for you, but I created a chroot, and ran tmux from inside it:

sudo -i
debootstrap stable /chroot
mount -o bind /dev /chroot/dev
mount -o bind /dev/pts /chroot/dev/pts
mount -o bind /sys /chroot/sys
mount -o bind /proc /chroot/proc
chroot /chroot
apt-get install tmux ssh
tmux
ssh user@localhost
apt-get bla bla bla

This ensures that the tmux environment doesn't change during the upgrade

1

Alternatively, you can pass the -L argument to tmux and have it create a new server group (if you don't want to exit your existing sessions -- I ran into this situation while testing a containerized Ubuntu 18.04 on top of my existing Amazon Linux dev box.)

$ tmux    
protocol version mismatch (client 8, server 7)
$ tmux -L /tmp

[in tmux session, then exit out]

[detached (from session 1)]
$ 

0

In my case it was .bash_profile issue for my user with which tmux session are configured. I have updated the .bash_profile for my user like below and things started working fine

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

PATH=$PATH:$HOME/.local/bin:$HOME/bin 
export PATH
1
  • Welcome to the site, and thank you for your contribution. Would you mind editing your post to include some explanation on why this would help solve the protocol version issue? You seem to solve the problem by sourcing the .bashrc inside the .bash_profile so you likely have tmux-related settings in the .bashrc; perhaps you could show those explicitly?
    – AdminBee
    Commented Jul 28, 2021 at 7:46

You must log in to answer this question.

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