tmux-plugins / tpm

Tmux Plugin Manager
MIT License
11.95k stars 420 forks source link

TMUX not starting with TPM #175

Closed harshasrisri closed 4 years ago

harshasrisri commented 4 years ago

I use the same tmux.conf on 4 different hosts, 3 of which aren't posing this problem. On the problematic host, however, starting a new session is hanging. I don't have any existing sessions to test attach. I tried to trace the issue and found that line ~/.tmux/plugins/tpm/tpm:21 is freezing when tpm is starting up. I don't know what to do further. OS: Ubuntu 20.04 Tmux versions tried: 3.0a(Ubuntu) and 3.1b(linuxbrew)

jonlorusso commented 4 years ago

I am seeing this behavior on OSX (10.14.6) as well (tmux 3.1b).

albertfgu commented 4 years ago

I am also experiencing hanging issues on Ubuntu 16.04.2, although they aren't the same as yours. I can start a new tmux session, but none of the plugins are loaded. Furthermore, if I run tmux source ~/.tmux.conf outside of tmux, it hangs when the last line of ~/.tmux.conf is run '~/.tmux/plugins/tpm/tpm'. (It doesn't hang with the -b flag, but the current README says to remove the flag. Either way, plugins aren't loaded in a new tmux session.)

@harshasrisri, how did you trace your issue?

harshasrisri commented 4 years ago

I traced the good old way using some echo statements to see at what point the statements stop showing. The last line in tmux.conf is invoking the tpm shell script.

run -b simply runs the script in the background, so tmux can start in that case, but the plugins may not load. At least, thats what happened when I used run -b

albertfgu commented 4 years ago

I tried echo statements, but am not seeing any at all (even at the beginning of the main function).

albertfgu commented 4 years ago

I reproduced the hanging issue after disabling my ~/.zshrc, deleting my ~/.tmux/plugins and installing a fresh copy of tpm, and using a .tmux.conf that only loads and runs the tpm plugin:

set -g @plugin 'tmux-plugins/tpm'
run '~/.tmux/plugins/tpm/tpm'

Here is an example of a session:

$ tmux -V
tmux 3.1b
$ tmux ls
no server running on /tmp/tmux-16655/default
$ tmux
^\zsh: quit (core dumped)
$ tmux ls
$ tmux
[exited]
$ tmux ls
$ tmux kill-server
$ tmux ls
no server running on /tmp/tmux-16655/default
$ tmux
^\zsh: quit (core dumped)

Some notable behaviors are:

  1. tmux hangs when running the tpm script
  2. After killing it, it is able to start up seemingly normally. However, tpm still doesn't work (e.g. the prefix+Shift-I binding is not set)
  3. Additionally, tmux ls neither displays any servers nor prints the usual message, which I've never seen before
  4. After kill-server, the state is reset back to the beginning
harshasrisri commented 4 years ago

I can confirm that this reflects my experience too. I forgot to mention earlier that I ran the tpm script directly from the shell to trace.

albertfgu commented 4 years ago

Installing a tmux binary using the zinit plugin manager resolved this issue for me, but I have no idea why.

harshasrisri commented 4 years ago

Could you please share how you installed a tmux binary using zinit?

albertfgu commented 4 years ago

Check out the installation instructions on the page. The relevant snippets in my .zshrc are:

### Added by Zinit's installer
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
    print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
    command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
    command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
        print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
        print -P "%F{160}▓▒░ The clone has failed.%f%b"
fi

source "$HOME/.zinit/bin/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit

# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
    zinit-zsh/z-a-rust \
    zinit-zsh/z-a-as-monitor \
    zinit-zsh/z-a-patch-dl \
    zinit-zsh/z-a-bin-gem-node

### End of Zinit's installer chunk

zinit ice from"gh-r" as"program" mv"tmux* -> tmux"
zinit light tmux/tmux
harshasrisri commented 4 years ago

Issue couldn't be reproduced from tmux master branch. https://github.com/tmux/tmux/issues/2360