tmux no puede comenzar una nueva session? "1; 2c"

Introducción

Acabo de instalar tmux en mi máquina CentOS 7, pero me he encontrado con un problema desconcertante. Cada vez que trato de intentar iniciar una session usando tmux o tmux new -s session-name , emite una cadena aleatoria de caracteres en mi post y no se puede iniciar.

 $ tmux $ 1;2c 

No tengo ni idea de qué hacer con esto.

tmux.conf

Mi configuration para tmux se encuentra en ~/.tmux.conf y está configurada de la siguiente manera.

 setw -g mode-keys vi # 12 hour clock set-window-option -g clock-mode-style 12 # reload tmux.conf bind r source-file ~/.tmux.conf \; display-message " ✱ ~/.tmux.conf is reloaded" 

También noté que se generaron algunos loggings de errores, y son los siguientes.

tmux-client-6310.log

 got 18 from server got 3 from server 

tmux-server-6312.log

 server started, pid 6312 socket path /tmp/tmux-1000/default new client 8 loading /etc/tmux.conf /etc/tmux.conf: #Prefix is Ctrl-a /etc/tmux.conf: set -g prefix Ca /etc/tmux.conf: bind Ca send-prefix /etc/tmux.conf: unbind Cb /etc/tmux.conf: /etc/tmux.conf: set -sg escape-time 1 /etc/tmux.conf: set -g base-index 1 /etc/tmux.conf: setw -g pane-base-index 1 /etc/tmux.conf: /etc/tmux.conf: #Mouse works as expected /etc/tmux.conf: setw -g mode-mouse on /etc/tmux.conf: set -g mouse-select-pane on /etc/tmux.conf: set -g mouse-resize-pane on /etc/tmux.conf: set -g mouse-select-window on /etc/tmux.conf: /etc/tmux.conf: setw -g monitor-activity on /etc/tmux.conf: set -g visual-activity on /etc/tmux.conf: /etc/tmux.conf: set -g mode-keys vi /etc/tmux.conf: set -g history-limit 10000 /etc/tmux.conf: /etc/tmux.conf: # y and p as in vim /etc/tmux.conf: bind Escape copy-mode /etc/tmux.conf: unbind p /etc/tmux.conf: bind p paste-buffer /etc/tmux.conf: bind -t vi-copy 'v' begin-selection /etc/tmux.conf: bind -t vi-copy 'y' copy-selection /etc/tmux.conf: bind -t vi-copy 'Space' halfpage-down /etc/tmux.conf: bind -t vi-copy 'Bspace' halfpage-up /etc/tmux.conf: /etc/tmux.conf: # extra commands for interacting with the ICCCM clipboard /etc/tmux.conf: bind Cc run "tmux save-buffer - | xclip -i -sel clipboard" /etc/tmux.conf: bind Cv run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" /etc/tmux.conf: /etc/tmux.conf: # easy-to-remember split pane commands /etc/tmux.conf: bind | split-window -h /etc/tmux.conf: bind - split-window -v /etc/tmux.conf: unbind '"' /etc/tmux.conf: unbind % /etc/tmux.conf: /etc/tmux.conf: # moving between panes with vim movement keys /etc/tmux.conf: bind h select-pane -L /etc/tmux.conf: bind j select-pane -D /etc/tmux.conf: bind k select-pane -U /etc/tmux.conf: bind l select-pane -R /etc/tmux.conf: /etc/tmux.conf: # moving between windows with vim movement keys /etc/tmux.conf: bind -r Ch select-window -t :- /etc/tmux.conf: bind -r Cl select-window -t :+ /etc/tmux.conf: /etc/tmux.conf: # resize panes with vim movement keys /etc/tmux.conf: bind -r H resize-pane -L 5 /etc/tmux.conf: bind -r J resize-pane -D 5 /etc/tmux.conf: bind -r K resize-pane -U 5 /etc/tmux.conf: bind -r L resize-pane -R 5 /etc/tmux.conf: /etc/tmux.conf: # I'm not hardcore enough for military time /etc/tmux.conf: set-window-option -g clock-mode-style 12 /etc/tmux.conf: /etc/tmux.conf: # reload tmux.conf /etc/tmux.conf: bind r source-file /etc/tmux.conf \; display-message " ✱ ~/.tmux.conf is reloaded" /etc/tmux.conf: /etc/tmux.conf: # tmux is so slow by default (this allows for faster key repetition) /etc/tmux.conf: set -sg escape-time 190 cmdq 0x6afde0: set-option -g prefix Ca (client -1) cmdq 0x6afde0: bind-key Ca send-prefix (client -1) cmdq 0x6afde0: unbind-key Cb (client -1) cmdq 0x6afde0: set-option -gs escape-time 1 (client -1) cmdq 0x6afde0: set-option -g base-index 1 (client -1) cmdq 0x6afde0: set-window-option -g pane-base-index 1 (client -1) cmdq 0x6afde0: set-window-option -g mode-mouse on (client -1) cmdq 0x6afde0: set-option -g mouse-select-pane on (client -1) cmdq 0x6afde0: set-option -g mouse-resize-pane on (client -1) cmdq 0x6afde0: set-option -g mouse-select-window on (client -1) cmdq 0x6afde0: set-window-option -g monitor-activity on (client -1) cmdq 0x6afde0: set-option -g visual-activity on (client -1) cmdq 0x6afde0: set-option -g mode-keys vi (client -1) cmdq 0x6afde0: set-option -g history-limit 10000 (client -1) cmdq 0x6afde0: bind-key Escape copy-mode (client -1) cmdq 0x6afde0: unbind-key p (client -1) cmdq 0x6afde0: bind-key p paste-buffer (client -1) cmdq 0x6afde0: bind-key -t vi-copy v begin-selection (client -1) cmdq 0x6afde0: bind-key -t vi-copy y copy-selection (client -1) cmdq 0x6afde0: bind-key -t vi-copy Space halfpage-down (client -1) cmdq 0x6afde0: bind-key -t vi-copy Bspace halfpage-up (client -1) cmdq 0x6afde0: bind-key Cc run "tmux save-buffer - | xclip -i -sel clipboard" (client -1) cmdq 0x6afde0: bind-key Cv run "tmux set-buffer "$(xclip -o -sel clipboard)"; tmux paste-buffer" (client -1) cmdq 0x6afde0: bind-key | split-window -h (client -1) cmdq 0x6afde0: bind-key - split-window -v (client -1) cmdq 0x6afde0: unbind-key " (client -1) cmdq 0x6afde0: unbind-key % (client -1) cmdq 0x6afde0: bind-key h select-pane -L (client -1) cmdq 0x6afde0: bind-key j select-pane -D (client -1) cmdq 0x6afde0: bind-key k select-pane -U (client -1) cmdq 0x6afde0: bind-key l select-pane -R (client -1) cmdq 0x6afde0: bind-key -r Ch select-window -t :- (client -1) cmdq 0x6afde0: bind-key -r Cl select-window -t :+ (client -1) cmdq 0x6afde0: bind-key -r H resize-pane -L 5 (client -1) cmdq 0x6afde0: bind-key -r J resize-pane -D 5 (client -1) cmdq 0x6afde0: bind-key -r K resize-pane -U 5 (client -1) cmdq 0x6afde0: bind-key -r L resize-pane -R 5 (client -1) cmdq 0x6afde0: set-window-option -g clock-mode-style 12 (client -1) cmdq 0x6afde0: bind-key r source-file /etc/tmux.conf ; display-message " ✱ ~/.tmux.conf is reloaded" (client -1) cmdq 0x6afde0: set-option -gs escape-time 190 (client -1) got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 14 from client 8 got 6 from client 8 got 0 from client 8 cmdq 0x6af9d0: new-session (client 8) new term: xterm-256color xterm-256color override: colors 256 xterm-256color override: XT xterm-256color override: Ms ]52;%p1%s;%p2%s xterm-256color override: Cc ]12;%p1%s xterm-256color override: Cr ]112 xterm-256color override: Cs [%p1%dq xterm-256color override: Csr [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 (CS-F1) new key [12@: 0xd003 (CS-F2) new key [13@: 0xd004 (CS-F3) new key [14@: 0xd005 (CS-F4) new key [15@: 0xd006 (CS-F5) new key [17@: 0xd007 (CS-F6) new key [18@: 0xd008 (CS-F7) new key [19@: 0xd009 (CS-F8) new key [20@: 0xd00a (CS-F9) new key [21@: 0xd00b (CS-F10) new key [23@: 0xd00c (CS-F11) new key [24@: 0xd00d (CS-F12) new key [25@: 0xd00e (CS-F13) new key [26@: 0xd00f (CS-F14) new key [28@: 0xd010 (CS-F15) new key [29@: 0xd011 (CS-F16) new key [31@: 0xd012 (CS-F17) new key [32@: 0xd013 (CS-F18) new key [33@: 0xd014 (CS-F19) new key [34@: 0xd015 (CS-F20) new key [2@: 0xd016 (CS-IC) new key [3@: 0xd017 (CS-DC) new key [7@: 0xd018 (CS-Home) new key [8@: 0xd019 (CS-End) new key [6@: 0xd01a (CS-NPage) new key [5@: 0xd01b (CS-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 (MS-DC) new key [3;5~: 0x5017 (C-DC) new key [3;6~: 0xd017 (CS-DC) new key [3;7~: 0x7017 (CM-DC) new key [1;2B: 0x901e (S-Down) new key [1;3B: 0x301e (M-Down) new key [1;4B: 0xb01e (MS-Down) new key [1;5B: 0x501e (C-Down) new key [1;6B: 0xd01e (CS-Down) new key [1;7B: 0x701e (CM-Down) new key [1;2F: 0x9019 (S-End) new key [1;3F: 0x3019 (M-End) new key [1;4F: 0xb019 (MS-End) new key [1;5F: 0x5019 (C-End) new key [1;6F: 0xd019 (CS-End) new key [1;7F: 0x7019 (CM-End) new key [1;2H: 0x9018 (S-Home) new key [1;3H: 0x3018 (M-Home) new key [1;4H: 0xb018 (MS-Home) new key [1;5H: 0x5018 (C-Home) new key [1;6H: 0xd018 (CS-Home) new key [1;7H: 0x7018 (CM-Home) new key [2;2~: 0x9016 (S-IC) new key [2;3~: 0x3016 (M-IC) new key [2;4~: 0xb016 (MS-IC) new key [2;5~: 0x5016 (C-IC) new key [2;6~: 0xd016 (CS-IC) new key [2;7~: 0x7016 (CM-IC) new key [1;2D: 0x901f (S-Left) new key [1;3D: 0x301f (M-Left) new key [1;4D: 0xb01f (MS-Left) new key [1;5D: 0x501f (C-Left) new key [1;6D: 0xd01f (CS-Left) new key [1;7D: 0x701f (CM-Left) new key [6;2~: 0x901a (S-NPage) new key [6;3~: 0x301a (M-NPage) new key [6;4~: 0xb01a (MS-NPage) new key [6;5~: 0x501a (C-NPage) new key [6;6~: 0xd01a (CS-NPage) new key [6;7~: 0x701a (CM-NPage) new key [5;2~: 0x901b (S-PPage) new key [5;3~: 0x301b (M-PPage) new key [5;4~: 0xb01b (MS-PPage) new key [5;5~: 0x501b (C-PPage) new key [5;6~: 0xd01b (CS-PPage) new key [5;7~: 0x701b (CM-PPage) new key [1;2C: 0x9020 (S-Right) new key [1;3C: 0x3020 (M-Right) new key [1;4C: 0xb020 (MS-Right) new key [1;5C: 0x5020 (C-Right) new key [1;6C: 0xd020 (CS-Right) new key [1;7C: 0x7020 (CM-Right) new key [1;2A: 0x901d (S-Up) new key [1;3A: 0x301d (M-Up) new key [1;4A: 0xb01d (MS-Up) new key [1;5A: 0x501d (C-Up) new key [1;6A: 0xd01d (CS-Up) new key [1;7A: 0x701d (CM-Up) spawn: /bin/bash -- session 0 destroyed writing 18 to client 8 writing 3 to client 8 lost client 8 

Algunas de las cosas en este logging provienen de una versión anterior de mi .tmux.conf .

¿Algunas ideas?

Editar # 1

Después de leer la respuesta de @ jasonwryan, leí la página de Sourceforge para tmux y leí que la configuration del entorno TERM es un problema potencial.

Mi valor actual para $ TERM fue el siguiente:

 $ echo $TERM xterm-256color 

Traté de ejecutar los siguientes commands para tratar de cambiarlo.

 $ export TERM=screen $ tmux $ echo $TERM screen 

Después de lograr los mismos resultados que antes, volví a exportar mi valor de $ TERM a xterm-256color .

Editar # 2

Ejecutar sesiones de tmux como el usuario raíz funciona bien; sin embargo, usar tmux como cualquier usuario privilegiado siempre dará como resultado los problemas anteriores.

Los diversos comentarios sobre la configuration TERM , etc., no parecen abordar el problema real.

La explicación más probable es un problema con los permissions que impide que tmux abra la connection pseudo-terminal. Por ejemplo, alguien puede haber hecho un chmod o chown que rompió el progtwig. Puede ver si este es el caso al observar los resultados de strace , por ejemplo,

 TERM=xterm-256color script -c "strace -fo strace.out -s 2048 tmux -v" 19603 open("/tmp/tmux-1001/default.lock", O_WRONLY|O_CREAT, 0600) = 6 19603 open("tmux-client-19603.log", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 6 19603 open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 8 19603 sendmsg(7, {msg_name(0)=NULL, msg_iov(43)=[{"\16\0\0\0\20\4\0\0\7\0\0\0\377\377\377\377TERM=xterm-256color\0008\177\0\0o\356\343\3738\177\0\0\201bP\217\3\200\377\377\17> 19605 open("/dev/null", O_RDWR) = 7 19605 open("tmux-server-19605.log", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 7 19605 open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 9 19605 open("/users/tom/.tmux.conf", O_RDONLY) = 6 19605 open("/usr/share/terminfo/x/xterm-256color", O_RDONLY) = 10 19605 open("/dev/ptmx", O_RDWR) = 10 19605 open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 11 19605 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 11 19605 open("/lib64/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 11 19605 open("/etc/group", O_RDONLY|O_CLOEXEC) = 11 19605 open("/dev/pts/2", O_RDWR|O_NOCTTY) = 11 19605 open("/proc/0/cmdline", O_RDONLY) = -1 ENOENT (No such file or directory) 19605 open("/proc/0/cmdline", O_RDONLY) = -1 ENOENT (No such file or directory) 19605 open("/proc/0/cmdline", O_RDONLY) = -1 ENOENT (No such file or directory) 

Una falla para el maestro "/ dev / ptmx" o el esclavo "/ dev / pts / xx " detendría tmux .

El logging del server muestra que muere inmediatamente después de generar un process, que en el código fuente es el punto donde comienza a abrir el pseudo-terminal, por ejemplo, (citando de window.c en tmux 1.8):

  log_debug("spawn: %s -- %s", wp->shell, wp->cmd); memset(&ws, 0, sizeof ws); ws.ws_col = screen_size_x(&wp->base); ws.ws_row = screen_size_y(&wp->base); switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) { case -1: wp->fd = -1; xasprintf(cause, "%s: %s", cmd, strerror(errno)); return (-1); 

El siguiente post del server proviene de session_destroy (citando de session.c ):

 /* Destroy a session. */ void session_destroy(struct session *s) { struct winlink *wl; log_debug("session %s destroyed", s->name); RB_REMOVE(sessions, &sessions, s); notify_session_closed(s); 

que se llama desde esta function en server.c :

 /* Signal handler. */ void server_signal_callback(int sig, unused short events, unused void *data) { switch (sig) { case SIGTERM: server_shutdown = 1; server_send_shutdown(); break; case SIGCHLD: server_child_signal(); break; case SIGUSR1: event_del(&server_ev_accept); close(server_fd); server_fd = server_create_socket(); server_add_accept(0); break; } } 

Cuando ejecutas strace , puedes ver qué señal está siendo procesada.

Los caracteres inesperados provienen de la initialization normal realizada por tmux . Parte de eso le pregunta al terminal de qué tipo es, usando "\ 033 [c" (ver XTerm Control Sequences para una explicación de eso). En una initialization normal, tmux envía varias secuencias de escape. Este pide una respuesta, y para cuando llega la respuesta, tmux ya no lo está escuchando, y simplemente hace eco en tu caparazón.

Obtendrás esa respuesta particular para un VT100 regular.

Por lo que vale, aquí hay una representación visible de la initialization, donde \E es \033 :

 Script started on Sun Jun 26 06:16:07 2016 \n \E[?1049h \E(B \E[m \E[?1l \E> \E[H \E[2J \E[?12l \E[?25h \E[?1000l \E[?1006l \E[?1005l \E[c \E[>4;1m \E[?1004h \E]112^G \E[?25l \E[1;1H \E[K\r 

Tenía el mismo problema en mac. El problema era de la línea de configuration del portapapeles:

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

El problema se resolvió ejecutando en la terminal:

 brew install reattach-to-user-namespace 

También tuve este problema con CentOS 7 y el binary tmux incluido. Resulta que tuve que poner a mi usuario en el grupo tty:

 # /etc/group tty:x:5:<username> 

Tuve que hacer esto incluso si mis permissions de ptmx se ven así:

 crw-rw-rw- 1 root tty 5, 2 Dec 9 23:17 /dev/ptmx 

Tenía el mismo problema en mi CentOS 7 VPS, y lo resolví ahora.

He instalado tmux antes por: yum install tmux

Luego lo elimino e instalo por source code . Entonces tengo el mismo problema de problema que tú.

Me di count de que acababa de instalar muchas bibliotecas, así que tal vez debería reboot el server.

¡Así que reinicié el server, el problema simplemente desapareció!

Mi problema fue con las malas permmissions del file / dev / ptmx (0600). Cuando lo cambié a 0666 como se menciona en el hombre ptmx, tmux no tiene problema para comenzar.