Search code examples
sshterminaltmuxtty

TMUX print dots continuously


Description

I'm using tmux on the server side to start the os installer. I have modified the file /etc/passwd so that the installer will be started immediately when using ssh to login the server.

/etc/passwd :

install:x:0:0:root:/root:/usr/bin/installer

installer:

#!/bin/sh
TMUX="/bin/tmux"
START="-u -f /etc/tmux.conf start"
ATTACH="-u attach -t kvm"
export PYTHONPATH=/opt/installer/:$PYTHONPATH
$TMUX $START
$TMUX $ATTACH

tmux.conf:

set-option -g status-bg black
set-option -g status-fg white
set-option -g status-left-length 12
set-option -g status-left "KVM"
set-option -g status-right "C-right/C-left to switch"
set-option -g status-right-length 30
set-window-option -g window-status-current-bg blue
set-option -s exit-unattached off
set-option -g base-index 1
set-option -g set-remain-on-exit on
new-session -s kvm -n installer "python /opt/installer/main.py"
new-window -d -n shell "bash --login"
new-window -d -n debug "touch /tmp/installer.log && tail -f /tmp/installer.log | grep -E '(INFO|CRITICAL)' "
bind-key -n "C-Left" select-window -t :-
bind-key -n "C-Right" select-window -t :+
detach-client -s kvm

Defect

The installer works well if I use this command :

$ssh -t root@*.*.*.* installer

or :

$ssh root@*.*.*.*
#installer // on the server

But when using ssh command on the client like this:

$ssh install@*.*.*.*

the tmux was started but the screen print dots continuously.

And on the server side, it seems that the tmux attach command was executes 4 times:

$ps aux | grep tmux

root       2089 77.0  0.0   4252  2076 ?        Rs   03:05   0:03 /bin/tmux -u -f /etc/tmux.conf start
root       2093  0.0  0.0   3720  1140 pts/1    S+   03:05   0:00 /bin/tmux -u attach -t kvm
root       2096  0.0  0.0   3720  1140 pts/2    S+   03:05   0:00 /bin/tmux -u attach -t kvm
root       2098  0.0  0.0   3720  1136 pts/3    S+   03:05   0:00 /bin/tmux -u attach -t kvm
root       2099  0.0  0.0   3720  1140 pts/4    S+   03:05   0:00 /bin/tmux -u attach -t kvm

Anyone who knows what's happening and how to fix this?


Solution

  • This problem has been resolved by Nicholas Marriott. The solution is add the line below to tmux.conf:

    set -g default-shell '/bin/bash'