Linux tmux:挂起不加载,不响应任何选项命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7408068/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:10:40  来源:igfitidea点击:

tmux: hangs and do not load, and do not respond to any option command

linuxtmux

提问by memimo

I have installed tmux from source on my localspace in Fedora. It was working nicely so far. But suddenly can not run it anymore, when run tmux, it just halts. Tried different command options like ls-sessions, none works. Killed all the processes of my user, deleted all the files of tmux and libevnet, and reinstalled them again from scratch. Still same, and tmux command in terminal just freezes without any actual error.

我已经在 Fedora 的本地空间上从源代码安装了 tmux。到目前为止,它运行良好。但是突然不能再运行了,当运行tmux时,它就停止了。尝试了不同的命令选项,如 ls-sessions,没有一个有效。杀了我用户的所有进程,删除了tmux和.tmux的所有文件libevnet,然后从头重新安装。还是一样,终端中的 tmux 命令只是冻结而没有任何实际错误。

采纳答案by memimo

Thanks. I found the problem. The tmux process were in D state, and I had no choice but to reboot the system. The problem came from kerberos ticket expiring after a while. And find a scripts that solves this problem: https://iain.cx/src/ktmux/

谢谢。我发现了问题。tmux进程处于D状态,只能重启系统。问题来自一段时间后过期的 kerberos 票证。并找到解决此问题的脚本:https: //iain.cx/src/ktmux/

回答by Dan Cecile

You should be able to narrow down your problem a bit with a few of these tests:

您应该可以通过以下几个测试来缩小问题的范围:

  1. Give it a shot from outside X11: Ctrl+Alt+F2(or use sshfrom another computer)

  2. Test if other terminal emulators work: scriptand screen

  3. Try another complicated terminal application: htopand mc

  4. Reset your TTY settings: stty sane

  5. Check that your terminal identified: echo $TERM(it should be something like "xterm" or "linux")

  6. Make that your terminal capabilities file exists: ls -lh /usr/share/terminfo/*/$TERM

  1. 给它从外部X11一拍:Ctrl+ Alt+ F2(或使用ssh另一台计算机)

  2. 测试其他终端模拟器是否工作:scriptscreen

  3. 尝试另一个复杂的终端应用程序:htopmc

  4. 重置您的 TTY 设置: stty sane

  5. 检查您的终端是否已识别:(echo $TERM它应该类似于“xterm”或“linux”)

  6. 使您的终端功能文件存在: ls -lh /usr/share/terminfo/*/$TERM

回答by Hashken

I had faced this problem for a long time and after a bit of searching I figured out that this was being caused because I accidently hit Ctrl+S(Ctrl+A+Sis my shortcut for switching panes), and this turns off flow control in terminals and stops the terminal from accepting input. It can be reenabled by pressing Ctrl+Q.

我曾面临这个问题很长一段时间,有点搜索我想通了,这是被造成的,因为我不小心击中后Ctrl+ SCtrl+ A+S是我的切换窗格快捷键),这将关闭流量控制在终端和停止终端接受输入。可以通过按Ctrl+重新启用它Q

Source:https://superuser.com/a/553349/137226

来源:https : //superuser.com/a/553349/137226

回答by kqw

tmuxwas halting right after I started it. Ctrl-Qand Ctrl-Cdidn't do anything.

tmux在我开始后就停止了。Ctrl-QCtrl-C没有做任何事情。

Fixed with

固定与

killall -9 tmux

(May be a different problem, but this question showed up in Google.)

(可能是一个不同的问题,但这个问题出现在谷歌中。)

回答by dsummersl

Had a similar issue, where I had a tmux session with two buffers. I didn't see anything I typed, but when I switched between buffers what I had typed previously would appear onscreen. stty sanedidn't work.

有一个类似的问题,我有一个带有两个缓冲区的 tmux 会话。我没有看到我输入的任何内容,但是当我在缓冲区之间切换时,我之前输入的内容会出现在屏幕上。stty sane没有用。

I detached Ctrl-b+d, and noticed that there was still a client attached when I looked at tmux list-clients. tmux detach-clientremoved it, and then I could reattach and the everything worked again.

我分离了Ctrl-b+ d,并注意到当我查看tmux list-clients. tmux detach-client删除它,然后我可以重新连接,一切又恢复正常。

回答by Rea Haas

I had the same issue. The cause is that the tmuxbuffer is full, and it also may happens cause of multi clients to the tmuxsession.

我遇到过同样的问题。原因是tmux缓冲区已满,也可能是由于tmux会话中有多个客户端而发生。

To solve it you need to detach all the clients from the session, and reattach it.

要解决它,您需要从会话中分离所有客户端,然后重新附加它。

The best way I found to solve it is to add to the ~/.bashrcfile this functions:

我发现解决它的最好方法是将~/.bashrc这个函数添加到文件中:

check_params() {
       if [[  <  ]]; then
               echo -e "Usage:\n"
               ok=0
       else
               ok=1
       fi

}

# detach all the clients from this session, and attach to it.
reattach_client() {
       check_params $# 1 "reattach_client <tmux_session_name>"
       if [[ $ok == 1 ]]; then
               tmux list-client | grep  | awk '{split(, s, ":"); print s[1]}' | xargs tmux detach-client -t | true
               tmux attach -t 
       fi
}

then run source ~/.bashrcto make these changes in the terminal.

然后运行source ~/.bashrc以在终端中进行这些更改。

Now to attach the session type:

现在附加会话类型:

reattach_client <session_name>

solved my issue.

解决了我的问题。

Thanks to Alex Zelichenko for help me with this!

感谢 Alex Zelichenko 帮助我解决这个问题!

回答by Logstar

If it is ok to lose your sessions, try deleting the tmux-NNNNNNNdirectory, where NNNNNNNis a number, under your /tmpdirectory. According to the tmuxmanual, if the TMPDIRenvironment variable is set, the tmux-NNNNNNNwill be put in the TMPDIR.

如果可以丢失会话,请尝试删除tmux-NNNNNNN目录下的目录,其中NNNNNNN是一个数字/tmp。根据tmux手册,如果TMPDIR设置了环境变量,tmux-NNNNNNN将放在TMPDIR.

tmux stores the server socket in a directory under /tmp (or TMPDIR if set);

tmux 将服务器套接字存储在 /tmp(或 TMPDIR,如果设置)下的目录中;

This solved my problem of not being able to run tmuxcommands that are related to sessions. I also tried the following, but they did not work:

这解决了我无法运行tmux与会话相关的命令的问题。我也尝试了以下方法,但没有奏效:

  • killall -9 tmux
  • reinstall tmux
  • restart shell session
  • killall -9 tmux
  • 重新安装 tmux
  • 重新启动外壳会话

I could not easily restart the operating system, because it's a shared server managed by others.

我无法轻松重新启动操作系统,因为它是由其他人管理的共享服务器。

回答by Garrett

A less drastic action (to try before killing the tmux process) is to ssh into the machine and run the following command.

一个不太激烈的操作(在杀死 tmux 进程之前尝试)是通过 ssh 进入机器并运行以下命令。

kill -CONT `pidof tmux`

Source: https://github.com/tmux/tmux/issues/507#issuecomment-271502093

来源:https: //github.com/tmux/tmux/issues/507#issuecomment-271502093