首页 > 解决方案 > tmux - 连接失败:连接被拒绝

问题描述

我想在 rhel 7 上使用 tmux。我在这台机器上没有 root 权限,所以我按照以下步骤从源代码构建它:https ://jdhao.github.io/2018/10/16/tmux_build_without_root_priviledge/ 。

我已经在本地构建并安装了 libevent 2.1.8、ncurses 6.1 和 tmux 2.8。它们都安装在 ~/local 中。

当我启动 tmux 时,它没有启动。我得到的信息是:

[退出]

我再次使用选项 -vv 开始,我得到了日志。

在服务器端,我得到:

1552914150.215313 server started (1698): version 2.8, socket /tmp/tmux-130772/default, protocol 8
1552914150.215360 on Linux 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015; libevent 2.1.8-stable (poll)
1552914150.224069 bind-key: argv[0]=bind
...
1552914150.293655 cmd_find_from_session_window: s=$0 0
1552914150.293661 cmd_find_from_session_window: wl=0 1 w=@0 ksh
1552914150.293666 cmd_find_from_session_window: wp=none
1552914150.293671 cmd_find_from_session_window: idx=0
1552914150.293677 session_add_ref: 0 notify_add, now 4
1552914150.293682 window_add_ref: @0 notify_add, now 3
1552914150.293687 session_add_ref: 0 notify_add, now 5
1552914150.293694 window_remove_ref: @0 winlink_remove, now 2
1552914150.293700 session 0 destroyed (session_detach)
1552914150.293706 cmd_find_best_session: 0 sessions to try
1552914150.293712 session_add_ref: 0 notify_add, now 6
1552914150.293719 session_remove_ref: 0 session_destroy, now 5
1552914150.293731 cmdq_next <global>: enter
1552914150.293744 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293750 notify_callback: pane-exited
1552914150.293756 cmd_find_best_session: 0 sessions to try
1552914150.293761 session_remove_ref: 0 notify_callback, now 4
1552914150.293768 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293773 notify_callback: window-layout-changed
1552914150.293779 cmd_find_best_session: 0 sessions to try
1552914150.293784 window_remove_ref: @0 notify_callback, now 1
1552914150.293790 session_remove_ref: 0 notify_callback, now 3
1552914150.293795 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293800 notify_callback: window-unlinked
1552914150.293806 cmd_find_best_session: 0 sessions to try
1552914150.293811 session_remove_ref: 0 notify_callback, now 2
1552914150.293817 window_remove_ref: @0 notify_callback, now 0
1552914150.293822 window @0 destroyed (0 references)
1552914150.293828 session_remove_ref: 0 notify_callback, now 1
1552914150.293834 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293839 notify_callback: session-closed
1552914150.293845 cmd_find_best_session: 0 sessions to try
1552914150.293851 session_remove_ref: 0 notify_callback, now 0
1552914150.293859 cmdq_next <global>: exit (empty)
1552914150.293865 cmdq_next <0x2363520>: empty
1552914150.293870 cmdq_next <global>: empty
1552914150.293875 cmdq_next <0x2363520>: empty
1552914150.293881 cmd_find_best_session: 0 sessions to try
1552914150.293889 sending message 203 to peer 0x2363d60 (4 bytes)
1552914150.293903 session 0 freed (0 references)
1552914150.293922 cmdq_next <global>: enter
1552914150.293930 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293935 notify_callback: client-detached
1552914150.293941 cmd_find_best_session: 0 sessions to try
1552914150.293947 unref client 0x2363520 (2 references)
1552914150.293952 cmdq_next <global>: exit (empty)
1552914150.293957 cmdq_next <0x2363520>: empty
1552914150.293962 cmdq_next <global>: empty
1552914150.293967 cmdq_next <0x2363520>: empty
1552914150.302142 peer 0x2363d60 message 205
1552914150.302286 sending message 204 to peer 0x2363d60 (0 bytes)
1552914150.302301 cmdq_next <global>: empty
1552914150.302308 cmdq_next <0x2363520>: empty
1552914150.302333 cmdq_next <global>: empty
1552914150.302340 cmdq_next <0x2363520>: empty
1552914150.311857 lost client 0x2363520
1552914150.311902 remove peer 0x2363d60
1552914150.311935 unref client 0x2363520 (1 references)
1552914150.311975 free client 0x2363520 (0 references)
1552914150.311988 cmdq_next <global>: empty
1552914150.312000 server loop exit

在客户端:

1552914150.208220 client started (1696): version 2.8, socket /tmp/tmux-130772/default, protocol 8
1552914150.208308 on Linux 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015; libevent 2.1.8-stable (poll)
1552914150.208351 socket is /tmp/tmux-130772/default
1552914150.208370 trying connect
1552914150.208401 connect failed: Connection refused
1552914150.208419 lock file is /tmp/tmux-130772/default.lock
1552914150.208478 flock succeeded
1552914150.208486 got lock (6)
1552914150.208495 trying connect
1552914150.208509 connect failed: Connection refused
1552914150.208779 add peer 0x23302e0: 7 ((nil))
...

我唯一能看到的是客户端无法连接套接字。我没有注意到服务器端有任何错误。

我会知道是什么阻止了 tmux 正常启动。

标签: tmux

解决方案


详细分析表明,tmux 使用的默认 shell 在我的环境中退出并出现错误。

我通过强制使用另一个外壳解决了问题。我把它放在 .tmux.conf:set-option -g default-shell /bin/zsh中。


推荐阅读