紹介する
私はCentOS 7システムにtmuxをインストールしましたが、混乱した問題が発生しました。tmux
セッションを使用または開始しようとするたびに、tmux new -s session-name
プロンプトにランダムな文字列が出力され、開始されません。
$ tmux
$ 1;2c
私は何をすべきかわかりません。
tmux.conf
私のtmux設定は~/.tmux.conf
次のように配置され設定されています。
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"
また、以下のようにいくつかのエラーログが生成されることを確認しました。
tmux-クライアント-6310.log
got 18 from server
got 3 from server
tmux-サーバー-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 C-a
/etc/tmux.conf: bind C-a send-prefix
/etc/tmux.conf: unbind C-b
/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 C-c run "tmux save-buffer - | xclip -i -sel clipboard"
/etc/tmux.conf: bind C-v 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 C-h select-window -t :-
/etc/tmux.conf: bind -r C-l 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 C-a (client -1)
cmdq 0x6afde0: bind-key C-a send-prefix (client -1)
cmdq 0x6afde0: unbind-key C-b (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 C-c run "tmux save-buffer - | xclip -i -sel clipboard" (client -1)
cmdq 0x6afde0: bind-key C-v 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 C-h select-window -t :- (client -1)
cmdq 0x6afde0: bind-key -r C-l 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%d q
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 (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: /bin/bash --
session 0 destroyed
writing 18 to client 8
writing 3 to client 8
lost client 8
このブログの一部のコンテンツは私のコンテンツからのものです.tmux.conf
。
どんなアイデアがありますか?
編集#1
@jasonwryanの回答を読んだ後、最後まで読んだ。ソースフォージページtmuxの場合、TERM環境設定を理解することは潜在的な問題です。
現在の$TERM値は次のとおりです。
$ echo $TERM
xterm-256color
変更を試みるために、次のコマンドを実行してみました。
$ export TERM=screen
$ tmux
$ echo $TERM
screen
前と同じ結果を得た後 $TERM 値をxterm-256color
。
編集#2
tmux
rootでセッションを実行すると問題はありませんが、tmux
特権ユーザーとして使用すると常に上記の問題が発生します。
答え1
CentOS 7にバンドルされているtmuxバイナリでもこの問題が発生しました。私のユーザーをttyグループに入れる必要があることがわかりました。
# /etc/group
tty:x:5:<username>
私のptmx権限が次のような場合でも、これを行う必要があります。
crw-rw-rw- 1 root tty 5, 2 Dec 9 23:17 /dev/ptmx
答え2
設定などに関する様々な意見がTERM
実際の問題を解決できないようです。
最も可能性の高い説明は問題があることです。特権これにより、tmux
疑似端末接続が開かれるのを防ぎます。たとえば、誰かがプログラムを作成したり壊したりした可能性がchmod
あります。たとえば、chown
結果を見ると、これが真であることを確認できます。strace
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)
「/dev/ptmx」マスターまたは「/dev/pts/」失敗ダブルX「奴隷は止まるでしょうtmux
。
サーバーログは、プロセスの作成後すぐに終了することを示します。ソースコードでは、疑似端末を開くことが始まります(例:window.c
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);
次のサーバーメッセージはで引用session_destroy
されます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);
次の関数から呼び出されます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;
}
}
を実行すると、strace
どの信号が処理されているかを確認できます。
予期しない文字は、Freeによって実行された通常の初期化で発生しますtmux
。その中には「\033[c」」を使って端末に何があるのか尋ねます(参照XTerm制御シーケンスこれを説明してください)。通常の初期化では、tmux
複数のエスケープシーケンスが送信されます。このリクエストにはレスポンスが必要で、レスポンスが来ると、もはやリッスンせずにシェルにtmux
エコーのみが表示されます。
在庫VT100を使用すると、特定の応答を得ることができます。
その価値があるのは初期化された可視レンダリングです。ここでは次の\E
ようになります。\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
答え3
Macでも同じ問題があります。問題はクリップボード構成行で発生します。
set-option -g default-command "reattach-to-user-namespace -l zsh"
端末で実行して問題を解決しました。
brew install reattach-to-user-namespace
答え4
私の問題は/ dev / ptmxファイル(0600)に対する無効な権限でした。 man ptmxで述べたように0666に変更すると、tmuxは問題なく起動します。