20

I'm trying to start with tmux but am failing to even run it. Immediately after starting it exits, similar to this question.

It happens both without a .tmux.conf, and (following some examples) with this .tmux.conf:

set -g default-shell /usr/bin/zsh
set -g status on
set -g history-limit 10000000
set -g prefix C-t
set -g status-bg green
setw -g window-status-current-bg cyan
setw -g window-status-current-attr bold

set -g status-right '#7H | %F %s'

bind-key C-t last-window

setw -g monitor-activity on
set -g visual-activity on

Adding new-session in the beginning of the .tmux.conf, as suggested some places doesn't help, and this happens when I use tmux new $SHELL also (again suggested to solve this somewhere).

I am using:

  • tmux 1.9a
  • Ubuntu 14.04
  • zsh 5.0.2

My tmux-server.log file shows this after tmux -v:

server started, pid 19654
socket path /tmp/tmux-1000/default
new client 7
loading /home/alon/.tmux.conf
/home/alon/.tmux.conf: new-session
/home/alon/.tmux.conf: set -g default-shell /usr/bin/zsh
/home/alon/.tmux.conf: set -g status on
/home/alon/.tmux.conf: set -g history-limit 10000000
/home/alon/.tmux.conf: set -g prefix C-t
/home/alon/.tmux.conf: set -g status-bg green
/home/alon/.tmux.conf: setw -g window-status-current-bg cyan
/home/alon/.tmux.conf: setw -g window-status-current-attr bold
/home/alon/.tmux.conf: 
/home/alon/.tmux.conf: set -g status-right '#7H | %F %s'
/home/alon/.tmux.conf: 
/home/alon/.tmux.conf: bind-key C-t last-window
/home/alon/.tmux.conf: 
/home/alon/.tmux.conf: setw -g monitor-activity on
/home/alon/.tmux.conf: set -g visual-activity on
cmdq 0x7f75d1784b50: new-session (client -1)
spawn: /usr/bin/zsh -- 
session 0 created
cmdq 0x7f75d1784b50: set-option -g default-shell /usr/bin/zsh (client -1)
cmdq 0x7f75d1784b50: set-option -g status on (client -1)
cmdq 0x7f75d1784b50: set-option -g history-limit 10000000 (client -1)
cmdq 0x7f75d1784b50: set-option -g prefix C-t (client -1)
cmdq 0x7f75d1784b50: set-option -g status-bg green (client -1)
cmdq 0x7f75d1784b50: set-window-option -g window-status-current-bg cyan (client -1)
cmdq 0x7f75d1784b50: set-window-option -g window-status-current-attr bold (client -1)
cmdq 0x7f75d1784b50: set-option -g status-right "#7H | %F %s" (client -1)
cmdq 0x7f75d1784b50: bind-key C-t last-window (client -1)
cmdq 0x7f75d1784b50: set-window-option -g monitor-activity on (client -1)
cmdq 0x7f75d1784b50: set-option -g visual-activity on (client -1)
got 100 from client 7
got 101 from client 7
got 102 from client 7
got 103 from client 7
got 104 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 105 from client 7
got 106 from client 7
got 200 from client 7
cmdq 0x7f75d176b260: new-session (client 7)
new term: xterm
xterm override: XT 
xterm override: Ms ]52;%p1%s;%p2%s
xterm override: Cs ]12;%p1%s
xterm override: Cr ]112
xterm override: Ss [%p1%d q
xterm override: Se [2 q
new key Oo: 0x1021 (KP/)
new key Oj: 0x1022 (KP*)
new key Om: 0x1023 (KP-)
new key Ow: 0x1024 (KP7)
new key Ox: 0x1025 (KP8)
new key Oy: 0x1026 (KP9)
new key Ok: 0x1027 (KP+)
new key Ot: 0x1028 (KP4)
new key Ou: 0x1029 (KP5)
new key Ov: 0x102a (KP6)
new key Oq: 0x102b (KP1)
new key Or: 0x102c (KP2)
new key Os: 0x102d (KP3)
new key OM: 0x102e (KPEnter)
new key Op: 0x102f (KP0)
new key On: 0x1030 (KP.)
new key OA: 0x101d (Up)
new key OB: 0x101e (Down)
new key OC: 0x1020 (Right)
new key OD: 0x101f (Left)
new key [A: 0x101d (Up)
new key [B: 0x101e (Down)
new key [C: 0x1020 (Right)
new key [D: 0x101f (Left)
new key OH: 0x1018 (Home)
new key OF: 0x1019 (End)
new key [H: 0x1018 (Home)
new key [F: 0x1019 (End)
new key Oa: 0x501d (C-Up)
new key Ob: 0x501e (C-Down)
new key Oc: 0x5020 (C-Right)
new key Od: 0x501f (C-Left)
new key [a: 0x901d (S-Up)
new key [b: 0x901e (S-Down)
new key [c: 0x9020 (S-Right)
new key [d: 0x901f (S-Left)
new key [11^: 0x5002 (C-F1)
new key [12^: 0x5003 (C-F2)
new key [13^: 0x5004 (C-F3)
new key [14^: 0x5005 (C-F4)
new key [15^: 0x5006 (C-F5)
new key [17^: 0x5007 (C-F6)
new key [18^: 0x5008 (C-F7)
new key [19^: 0x5009 (C-F8)
new key [20^: 0x500a (C-F9)
new key [21^: 0x500b (C-F10)
new key [23^: 0x500c (C-F11)
new key [24^: 0x500d (C-F12)
new key [25^: 0x500e (C-F13)
new key [26^: 0x500f (C-F14)
new key [28^: 0x5010 (C-F15)
new key [29^: 0x5011 (C-F16)
new key [31^: 0x5012 (C-F17)
new key [32^: 0x5013 (C-F18)
new key [33^: 0x5014 (C-F19)
new key [34^: 0x5015 (C-F20)
new key [2^: 0x5016 (C-IC)
new key [3^: 0x5017 (C-DC)
new key [7^: 0x5018 (C-Home)
new key [8^: 0x5019 (C-End)
new key [6^: 0x501a (C-NPage)
new key [5^: 0x501b (C-PPage)
new key [11$: 0x9002 (S-F1)
new key [12$: 0x9003 (S-F2)
new key [13$: 0x9004 (S-F3)
new key [14$: 0x9005 (S-F4)
new key [15$: 0x9006 (S-F5)
new key [17$: 0x9007 (S-F6)
new key [18$: 0x9008 (S-F7)
new key [19$: 0x9009 (S-F8)
new key [20$: 0x900a (S-F9)
new key [21$: 0x900b (S-F10)
new key [23$: 0x900c (S-F11)
new key [24$: 0x900d (S-F12)
new key [25$: 0x900e (S-F13)
new key [26$: 0x900f (S-F14)
new key [28$: 0x9010 (S-F15)
new key [29$: 0x9011 (S-F16)
new key [31$: 0x9012 (S-F17)
new key [32$: 0x9013 (S-F18)
new key [33$: 0x9014 (S-F19)
new key [34$: 0x9015 (S-F20)
new key [2$: 0x9016 (S-IC)
new key [3$: 0x9017 (S-DC)
new key [7$: 0x9018 (S-Home)
new key [8$: 0x9019 (S-End)
new key [6$: 0x901a (S-NPage)
new key [5$: 0x901b (S-PPage)
new key [11@: 0xd002 (C-S-F1)
new key [12@: 0xd003 (C-S-F2)
new key [13@: 0xd004 (C-S-F3)
new key [14@: 0xd005 (C-S-F4)
new key [15@: 0xd006 (C-S-F5)
new key [17@: 0xd007 (C-S-F6)
new key [18@: 0xd008 (C-S-F7)
new key [19@: 0xd009 (C-S-F8)
new key [20@: 0xd00a (C-S-F9)
new key [21@: 0xd00b (C-S-F10)
new key [23@: 0xd00c (C-S-F11)
new key [24@: 0xd00d (C-S-F12)
new key [25@: 0xd00e (C-S-F13)
new key [26@: 0xd00f (C-S-F14)
new key [28@: 0xd010 (C-S-F15)
new key [29@: 0xd011 (C-S-F16)
new key [31@: 0xd012 (C-S-F17)
new key [32@: 0xd013 (C-S-F18)
new key [33@: 0xd014 (C-S-F19)
new key [34@: 0xd015 (C-S-F20)
new key [2@: 0xd016 (C-S-IC)
new key [3@: 0xd017 (C-S-DC)
new key [7@: 0xd018 (C-S-Home)
new key [8@: 0xd019 (C-S-End)
new key [6@: 0xd01a (C-S-NPage)
new key [5@: 0xd01b (C-S-PPage)
new key [I: 0x1031 ((null))
new key [O: 0x1032 ((null))
new key OP: 0x1002 (F1)
new key OQ: 0x1003 (F2)
new key OR: 0x1004 (F3)
new key OS: 0x1005 (F4)
new key [15~: 0x1006 (F5)
new key [17~: 0x1007 (F6)
new key [18~: 0x1008 (F7)
new key [19~: 0x1009 (F8)
new key [20~: 0x100a (F9)
new key [21~: 0x100b (F10)
new key [23~: 0x100c (F11)
new key [24~: 0x100d (F12)
new key [1;2P: 0x100e (F13)
new key [1;2Q: 0x100f (F14)
new key [1;2R: 0x1010 (F15)
new key [1;2S: 0x1011 (F16)
new key [15;2~: 0x1012 (F17)
new key [17;2~: 0x1013 (F18)
new key [18;2~: 0x1014 (F19)
new key [19;2~: 0x1015 (F20)
new key [2~: 0x1016 (IC)
new key [3~: 0x1017 (DC)
replacing key OH: 0x1018 (Home)
replacing key OF: 0x1019 (End)
new key [6~: 0x101a (NPage)
new key [5~: 0x101b (PPage)
new key [Z: 0x101c (BTab)
replacing key OA: 0x101d (Up)
replacing key OB: 0x101e (Down)
replacing key OD: 0x101f (Left)
replacing key OC: 0x1020 (Right)
new key [3;2~: 0x9017 (S-DC)
new key [3;3~: 0x3017 (M-DC)
new key [3;4~: 0xb017 (M-S-DC)
new key [3;5~: 0x5017 (C-DC)
new key [3;6~: 0xd017 (C-S-DC)
new key [3;7~: 0x7017 (C-M-DC)
new key [1;2B: 0x901e (S-Down)
new key [1;3B: 0x301e (M-Down)
new key [1;4B: 0xb01e (M-S-Down)
new key [1;5B: 0x501e (C-Down)
new key [1;6B: 0xd01e (C-S-Down)
new key [1;7B: 0x701e (C-M-Down)
new key [1;2F: 0x9019 (S-End)
new key [1;3F: 0x3019 (M-End)
new key [1;4F: 0xb019 (M-S-End)
new key [1;5F: 0x5019 (C-End)
new key [1;6F: 0xd019 (C-S-End)
new key [1;7F: 0x7019 (C-M-End)
new key [1;2H: 0x9018 (S-Home)
new key [1;3H: 0x3018 (M-Home)
new key [1;4H: 0xb018 (M-S-Home)
new key [1;5H: 0x5018 (C-Home)
new key [1;6H: 0xd018 (C-S-Home)
new key [1;7H: 0x7018 (C-M-Home)
new key [2;2~: 0x9016 (S-IC)
new key [2;3~: 0x3016 (M-IC)
new key [2;4~: 0xb016 (M-S-IC)
new key [2;5~: 0x5016 (C-IC)
new key [2;6~: 0xd016 (C-S-IC)
new key [2;7~: 0x7016 (C-M-IC)
new key [1;2D: 0x901f (S-Left)
new key [1;3D: 0x301f (M-Left)
new key [1;4D: 0xb01f (M-S-Left)
new key [1;5D: 0x501f (C-Left)
new key [1;6D: 0xd01f (C-S-Left)
new key [1;7D: 0x701f (C-M-Left)
new key [6;2~: 0x901a (S-NPage)
new key [6;3~: 0x301a (M-NPage)
new key [6;4~: 0xb01a (M-S-NPage)
new key [6;5~: 0x501a (C-NPage)
new key [6;6~: 0xd01a (C-S-NPage)
new key [6;7~: 0x701a (C-M-NPage)
new key [5;2~: 0x901b (S-PPage)
new key [5;3~: 0x301b (M-PPage)
new key [5;4~: 0xb01b (M-S-PPage)
new key [5;5~: 0x501b (C-PPage)
new key [5;6~: 0xd01b (C-S-PPage)
new key [5;7~: 0x701b (C-M-PPage)
new key [1;2C: 0x9020 (S-Right)
new key [1;3C: 0x3020 (M-Right)
new key [1;4C: 0xb020 (M-S-Right)
new key [1;5C: 0x5020 (C-Right)
new key [1;6C: 0xd020 (C-S-Right)
new key [1;7C: 0x7020 (C-M-Right)
new key [1;2A: 0x901d (S-Up)
new key [1;3A: 0x301d (M-Up)
new key [1;4A: 0xb01d (M-S-Up)
new key [1;5A: 0x501d (C-Up)
new key [1;6A: 0xd01d (C-S-Up)
new key [1;7A: 0x701d (C-M-Up)
spawn: /usr/bin/zsh -- 
session 1 created
writing 207 to client 7
got 208 from client 7
keys are 9 ([?62;9;c)
received service class 62
complete key [?62;9;c 0xfff
session 0 destroyed
session 1 destroyed
writing 203 to client 7
got 205 from client 7
writing 204 to client 7
lost client 7

UPDATE: Here are the results from running strace tmux:

execve("/usr/bin/tmux", ["tmux"], [/* 103 vars */]) = 0 brk(0)        
= 0x7f86ea097000 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f86e817b000 access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=117788, ...}) = 0 mmap(NULL, 117788, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f86e815e000 close(3)               
= 0 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libutil.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\17\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=10680, ...}) = 0 mmap(NULL, 2105624, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f86e7d58000 mprotect(0x7f86e7d5a000, 2093056, PROT_NONE) = 0 mmap(0x7f86e7f59000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7f86e7f59000 close(3)                                = 0 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\303\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=167096, ...}) = 0 mmap(NULL, 2264288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f86e7b2f000 mprotect(0x7f86e7b54000, 2093056, PROT_NONE) = 0 mmap(0x7f86e7d53000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x24000) = 0x7f86e7d53000 close(3)                                = 0 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/libevent-2.0.so.5", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\236\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=276880, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f86e815d000 mmap(NULL, 2373864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f86e78eb000 mprotect(0x7f86e792d000, 2097152, PROT_NONE) = 0 mmap(0x7f86e7b2d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x42000) = 0x7f86e7b2d000 close(3)                                = 0 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320:\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=101240, ...}) = 0 mmap(NULL, 2206376, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f86e76d0000 mprotect(0x7f86e76e7000, 2097152, PROT_NONE) = 0 mmap(0x7f86e78e7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f86e78e7000 mmap(0x7f86e78e9000, 6824, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f86e78e9000 close(3) 
= 0 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1845024, ...}) = 0 mmap(NULL, 3953344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f86e730a000 mprotect(0x7f86e74c5000, 2097152, PROT_NONE) = 0 mmap(0x7f86e76c5000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bb000) = 0x7f86e76c5000 mmap(0x7f86e76cb000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f86e76cb000 close(3) 
= 0 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0po\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=141574, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f86e815c000 mmap(NULL, 2217264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f86e70ec000 mprotect(0x7f86e7105000, 2093056, PROT_NONE) = 0 mmap(0x7f86e7304000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7f86e7304000 mmap(0x7f86e7306000, 13616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f86e7306000 close(3)                                = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f86e815b000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f86e8159000 arch_prctl(ARCH_SET_FS, 0x7f86e8159740) = 0 mprotect(0x7f86e76c5000, 16384, PROT_READ) = 0 mprotect(0x7f86e7304000, 4096, PROT_READ) = 0 mprotect(0x7f86e78e7000, 4096, PROT_READ) = 0 mprotect(0x7f86e7b2d000, 4096, PROT_READ) = 0 mprotect(0x7f86e7d53000, 16384, PROT_READ) = 0 mprotect(0x7f86e7f59000, 4096, PROT_READ) = 0 mprotect(0x7f86e83ea000, 36864, PROT_READ) = 0 mprotect(0x7f86e817d000, 4096, PROT_READ) = 0 munmap(0x7f86e815e000, 117788)          = 0 set_tid_address(0x7f86e8159a10)         = 13671 set_robust_list(0x7f86e8159a20, 24)     = 0 futex(0x7fffc947f210, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 7f86e8159740)
= -1 EAGAIN (Resource temporarily unavailable) rt_sigaction(SIGRTMIN, {0x7f86e70f29f0, [], SA_RESTORER|SA_SIGINFO, 0x7f86e70fc340}, NULL, 8)
= 0 rt_sigaction(SIGRT_1, {0x7f86e70f2a80, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f86e70fc340}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 brk(0)                                 
= 0x7f86ea097000 brk(0x7f86ea0b8000)                     = 0x7f86ea0b8000 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=4427728, ...}) = 0 mmap(NULL, 4427728, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f86e6cb3000 close(3)                                = 0 getcwd("/tmp", 4096)                    = 5 access("/usr/bin/zsh", X_OK)            = 0 access("/home/alon/.tmux.conf", R_OK)   = 0 getuid()                                = 1000 mkdir("/tmp/user/1000/tmux-1000", 0700) = -1 EEXIST (File exists) lstat("/tmp/user/1000/tmux-1000", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=126976, ...}) = 0 lstat("/tmp/user", {st_mode=S_IFDIR|0711, st_size=4096, ...}) = 0 lstat("/tmp/user/1000", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 lstat("/tmp/user/1000/tmux-1000", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 getuid()                                = 1000 geteuid()                               = 1000 getgid()               
= 1000 getegid()                               = 1000 getuid()                                = 1000 geteuid()                               = 1000 getgid()                                = 1000 getegid()                               = 1000 socketpair(PF_LOCAL, SOCK_STREAM, 0, [3, 4]) = 0 fcntl(3, F_GETFD)    
= 0 fcntl(3, F_SETFD, FD_CLOEXEC)           = 0 fcntl(4, F_GETFD)                       = 0 fcntl(4, F_SETFD, FD_CLOEXEC)           = 0 fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR) fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK)    = 0 fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR) fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0 getuid()                           
= 1000 geteuid()                               = 1000 getgid()                                = 1000 getegid()                               = 1000 socket(PF_LOCAL, SOCK_STREAM, 0)        = 5 connect(5, {sa_family=AF_LOCAL, sun_path="/tmp/user/1000/tmux-1000/default"}, 34) = -1 ECONNREFUSED (Connection refused) close(5)                                = 0 open("/tmp/user/1000/tmux-1000/default.lock", O_WRONLY|O_CREAT, 0600)
= 5 fcntl(5, F_SETLK, {type=F_WRLCK, whence=SEEK_CUR, start=0, len=0}) = 0 unlink("/tmp/user/1000/tmux-1000/default") = 0 socketpair(PF_LOCAL, SOCK_STREAM, 0, [6, 7]) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f86e8159a10) = 13672 close(7)                         
= 0 close(5)                                = 0 fcntl(6, F_GETFL)                       = 0x2 (flags O_RDWR) fcntl(6, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13672, si_status=0, si_utime=0, si_stime=0} --- fcntl(0, F_GETFL)            
= 0x8002 (flags O_RDWR|O_LARGEFILE) fcntl(0, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0 rt_sigaction(SIGINT, {SIG_IGN, [], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, NULL, 8) = 0 rt_sigaction(SIGPIPE, {SIG_IGN, [], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, NULL, 8) = 0 rt_sigaction(SIGUSR2, {SIG_IGN, [], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, NULL, 8) = 0 rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, NULL, 8) = 0 rt_sigaction(SIGHUP, {0x7f86e790c770, ~[RTMIN RT_1], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGCHLD, {0x7f86e790c770, ~[RTMIN RT_1], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGCONT, {0x7f86e790c770, ~[RTMIN RT_1], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGTERM, {0x7f86e790c770, ~[RTMIN RT_1], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGUSR1, {0x7f86e790c770, ~[RTMIN RT_1], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGWINCH, {0x7f86e790c770, ~[RTMIN RT_1], SA_RESTORER|SA_RESTART, 0x7f86e7340c30}, {SIG_DFL, [], 0}, 8) = 0 ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 16), ...}) = 0 readlink("/proc/self/fd/0", "/dev/pts/16", 4095) = 11 stat("/dev/pts/16", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 16), ...}) = 0 open(".", O_RDONLY)                     = 5 dup(0)          
= 7 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN|POLLOUT}], 2, 4294967295) = 1 ([{fd=6, revents=POLLOUT}]) sendmsg(6, {msg_name(0)=NULL, msg_iov(4)=[{"d\0\0\0\24\0\0\0\10\0\0\0\377\377\377\377\0\0\1\0", 20}, {"e\0\0\0\26\0\0\0\10\0\0\0\377\377\377\377xterm\0", 22}, {"f\0\0\0\34\0\0\0\10\0\0\0\377\377\377\377/dev/pts/16\0", 28}, {"g\0\0\0\20\0\1\0\10\0\0\0\377\377\377\377", 16}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {5}}, msg_flags=0}, 0) = 86 close(5)                                = 0 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN|POLLOUT}], 2, 4294967295) = 1 ([{fd=6, revents=POLLOUT}]) sendmsg(6, {msg_name(0)=NULL, msg_iov(1)=[{"h\0\0\0\20\0\1\0\10\0\0\0\377\377\377\377", 16}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {7}}, msg_flags=0}, 0) = 16 close(7)            
= 0 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN|POLLOUT}], 2, 4294967295) = 1 ([{fd=6, revents=POLLOUT}]) sendmsg(6, {msg_name(0)=NULL, msg_iov(106)=[{"i\0\0\0\37\0\0\0\10\0\0\0\377\377\377\377XDG_SEAT=seat0\0", 31}, {"i\0\0\0\"\0\0\0\10\0\0\0\377\377\377\377XDG_SESSION_ID=c"..., 34}, {"i\0\0\0.\0\0\0\10\0\0\0\377\377\377\377LC_IDENTIFICATIO"..., 46}, {"i\0\0\0r\0\0\0\10\0\0\0\377\377\377\377SESSION_MANAGER="..., 114}, {"i\0\0\0003\0\0\0\10\0\0\0\377\377\377\377GIO_LAUNCHED_DES"..., 51}, {"i\0\0\0\33\0\0\0\10\0\0\0\377\377\377\377DISPLAY=:0\0", 27}, {"i\0\0\0&\0\0\0\10\0\0\0\377\377\377\377TMPDIR=/tmp/user"..., 38}, {"i\0\0\0\31\0\0\0\10\0\0\0\377\377\377\377JOB=dbus\0", 25}, {"i\0\0\0D\0\0\0\10\0\0\0\377\377\377\377GNOME_KEYRING_CO"..., 68}, {"i\0\0\0<\0\0\0\10\0\0\0\377\377\377\377GNOME_DESKTOP_SE"..., 60}, {"i\0\0\0C\0\0\0\10\0\0\0\377\377\377\377DEFAULTS_PATH=/u"..., 67}, {"i\0\0\0001\0\0\0\10\0\0\0\377\377\377\377QT_QPA_PLATFORMT"..., 49}, {"i\0\0\0\35\0\0\0\10\0\0\0\377\377\377\377LOGNAME=alon\0", 29}, {"i\0\0\0%\0\0\0\10\0\0\0\377\377\377\377TEXTDOMAIN=im-co"..., 37}, {"i\0\0\0\32\0\0\0\10\0\0\0\377\377\377\377INSTANCE=\0", 26}, {"i\0\0\0$\0\0\0\10\0\0\0\377\377\377\377LC_TIME=en_US.UT"..., 36}, {"i\0\0\0#\0\0\0\10\0\0\0\377\377\377\377SHELL=/usr/bin/z"..., 35}, {"i\0\0\0!\0\0\0\10\0\0\0\377\377\377\377PAPERSIZE=letter"..., 33}, {"i\0\0\0\200\1\0\0\10\0\0\0\377\377\377\377PATH=/home/alon/"..., 384}, {"i\0\0\0'\0\0\0\10\0\0\0\377\377\377\377LC_NUMERIC=en_US"..., 39}, {"i\0\0\0%\0\0\0\10\0\0\0\377\377\377\377LC_PAPER=en_US.U"..., 37}, {"i\0\0\0\"\0\0\0\10\0\0\0\377\377\377\377IM_CONFIG_PHASE="..., 34}, {"i\0\0\0%\0\0\0\10\0\0\0\377\377\377\377WEBIDE_JDK=/opt/"..., 37}, {"i\0\0\0$\0\0\0\10\0\0\0\377\377\377\377XMODIFIERS=@im=n"..., 36}, {"i\0\0\0\"\0\0\0\10\0\0\0\377\377\377\377QT4_IM_MODULE=xi"..., 34}, {"i\0\0\0J\0\0\0\10\0\0\0\377\377\377\377XDG_SESSION_PATH"..., 74}, {"i\0\0\0\37\0\0\0\10\0\0\0\377\377\377\377SESSION=ubuntu\0", 31}, {"i\0\0\0001\0\0\0\10\0\0\0\377\377\377\377TEXTDOMAINDIR=/u"..., 49}, {"i\0\0\0@\0\0\0\10\0\0\0\377\377\377\377SSH_AUTH_SOCK=/r"..., 64}, {"i\0\0\0002\0\0\0\10\0\0\0\377\377\377\377XAUTHORITY=/home"..., 50}, {"i\0\0\0'\0\0\0\10\0\0\0\377\377\377\377XDG_MENU_PREFIX="..., 39}, {"i\0\0\0\"\0\0\0\10\0\0\0\377\377\377\377GDMSESSION=ubunt"..., 34}, ...], msg_controllen=0, msg_flags=0}, 0) = 5415 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 2, 4294967295) = 1 ([{fd=6, revents=POLLIN}]) recvmsg(6, {msg_name(0)=NULL, msg_iov(1)=[{"\314\0\0\0\20\0\0\0\10\0\0\0\377\377\377\377", 65535}], msg_controllen=0, msg_flags=0}, 0) = 16 poll([{fd=4, events=POLLIN}], 1, 0)     = 0 (Timeout) fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 16), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f86e817a000 write(1, "[exited]\n", 9[exited] )               = 9 getppid()                               = 13668 fcntl(0, F_GETFL)     
= 0x8002 (flags O_RDWR|O_LARGEFILE) fcntl(0, F_SETFL, O_RDWR|O_LARGEFILE)   = 0 exit_group(0)                           = ?
+++ exited with 0 +++
  • 1
    Not sure if this is related, but I had a similar issue recently and fixed it by changing the default shell setting from '/usr/bin/env bash' to simply '/bin/bash'. Possibly related to use of the usr directory? – user7089 May 10 '14 at 21:14
  • Nice idea, but didn't help :( sorry! – alonisser May 11 '14 at 13:32
  • chmod 666 /dev/ptmx fixed that for me. – Pavel Šimerda Jan 27 '17 at 7:49
21

I took the following steps:

  • commented out my whole tmux.conf, restart tmux to see if it doesn't exit
  • comment out 50% of my tmux.conf, restart tmux to see if it doesn't exit
  • keep on doing this until I see which part of my tmux configuration is to blame, then fix that

In my case it was because I was using the following setting on OSX and Linux:

set-option -g default-command "reattach-to-user-namespace -l bash"

Which broke in my Linux because I didn't install it there. It's probably not even available in Linux.

4

If screen does not work as well, make sure you have read-write access to /dev/ptmx. If not, no new pty can be spawned and especially tmux terminates without an error message.

  • At last! yes screen terminates too. this is the /dev/ptmx permissions: crw-rw-rw- 1 root tty What should I change? – alonisser Jan 1 '15 at 8:08
  • rw-rw-rw should work, then your problem might be another one. Maybe check in /dev/pts (there should pty devices be created for terminal instances/screen windows. Maybe you can check with strace, what is access shortly before the session terminates. – allo Jan 1 '15 at 20:49
  • /dev/pts is drwxr-xr-x 2 root root Ok? How should I run strace for that? – alonisser Jan 1 '15 at 21:47
  • Updated my question with strace results – alonisser Jan 1 '15 at 22:01
  • /dev/pts/16 seems to be accessible, not sure if its the parent terminal or the tmux session. You can try to check the files in $HOME and /tmp, but at the moment i cannot see the error in there. – allo Jan 2 '15 at 0:33
2

When I had this problem, it was caused by having old sessions lingering and causing problems. Try tmux ls and see if you find anything. You can reattach to an old session with tmux -S <session> --- this worked for me even though a regular tmux failed to start a new session.

You could also kill all the sessions with tmux ls -F "#S" | xargs -n 1 tmux kill-session to list sessions by name and kill them automatically. (Make sure to check those sessions first or you might lose information!)

2

If your tmux session is closed immediately and you see the [exited] message in the terminal you are probably missing the reattach-to-user-namespace package to install it simply do

    brew install reattach-to-user-namespace
  • 2
    As far as I know Ubuntu is using apt as default package manager not brew – mrc02_kr Oct 22 '18 at 14:33
  • Hey @H.Li Welcome to stackoverflow, Thanks for the attempt. But 1. answering a question from 4 years ago is a strange place to start from. 2. obviously you didn't read the question thoroughly - ubuntu is specified. Brew is osx specific 3. There is already an answer suggesting that – alonisser Oct 23 '18 at 18:03
1

I noticed this problem again. It is on an OpenVZ guest. The tmux command exited immediately without any error messages.

The solution was:

chmod 666 /dev/ptmx

After this change I have no issues like that. This is a bug in tmux. It should at least complain about the specific problem.

  • I hope I will find this next time I need it... (pavlix) – Pavel Šimerda Mar 16 '17 at 20:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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