0

Been wrestling with this for a few hours and it’s driving me crazy. When I SSH into my machine at home, my default shell is zsh. I can confirm this with echo $SHELL, which outputs /usr/bin/zsh

When I call tmux from zsh, it brings me into a tmux pane with a bash shell. If I run echo $SHELL, it outputs /bin/bash. If I then run chsh -s /usr/bin/zsh <user>, the $SHELL variable doesn’t actually get updated and still outputs \bin\bash.

I’m aware from the tmux manpage that the default shell is set in the ~/.tmux.conf file, which I‘ve also done, to seemingly no effect. I’ll include my relevant configuration files here.

I should mention, the other configurations from my .tmux.conf are taking effect; my keybinds work, colors match up, etc. Can’t figure it out, any help is very much appreciated.

Hardware is a Raspberry Pi 4 running the newest release of raspbian.

~/.tmux.conf:

unbind C-b
set-option -g prefix C-q
bind-key C-q send-prefix

bind h split-window 
bind v split-window -h

#set-option -g pane-border-fg colour235 #base02
#set-option -g pane-active-border-fg colour240 #base01

set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000

setw -g mode-keys vi
setw -g monitor-activity on

bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5

bind-key -n M-K resize-pane -U 5
bind-key -n M-J resize-pane -D 5
bind-key -n M-H resize-pane -L 5
bind-key -n M-L resize-pane -R 5

# Shift arrow to switch windows
bind -n M-N  previous-window
bind -n M-M next-window

set -sg escape-time 0

# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h"  "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j"  "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k"  "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l"  "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"

set -g status-bg "black"
set -g status-fg "white"

~/.zshrc for good measure:

# OMZ home directory
export ZSH=/home/joe/.oh-my-zsh

# Set OMZ theme
ZSH_THEME=spaceship
SPACESHIP_CHAR_SUFFIX=' '
SPACESHIP_HOST_SHOW=always
SPACESHIP_USER_SHOW=always
SPACESHIP_PROMPT_ORDER=(
user          # Username section
host          # Hostname section
dir           # Current directory section
git           # Git section (git_branch + git_status)
exec_time     # Execution time
battery       # Battery level and status
vi_mode       # Vi-mode indicator
jobs          # Background jobs indicator
exit_code     # Exit code section
char          # Prompt character
)

# Couple OMZ settings
COMPLETION_WAITING_DOTS="true"
plugins=(git sudo wd tmux)

# Source OMZ file, needs to be *before* other aliases
source $ZSH/oh-my-zsh.sh

# Fixes some undesirable behavior in Termite with OMZ
export LC_CTYPE="en_US.UTF-8"
export ANDROID_HOME="/home/joe/Android/Sdk/"

# User Specified Aliases
alias ekeymap="vim /home/joe/qmk_firmware/keyboards/ergodox_ez/keymaps/josephemorgan91"
alias rename=perl-rename
alias zconfig="vim ~/.zshrc"
alias zsource="source ~/.zshrc"
alias ls="ls --color=auto"
alias la="ls -a --color=auto"
alias ll="ls -la --color=auto"
alias keyswapper="~/Scripts/keyswapper"
alias sheader="~/Scripts/student_header.sh"
alias ctags="ctags -R -f ./.git/tags ."
alias tmux="tmux -u"
alias R="R --quiet"
alias update-grub="sudo zsh ~/Scripts/update-grub"
alias vimconfig="vim ~/.vimrc"
alias emacs="emacs -nw"

# Setup folder for dev
    alias cconfig="cp ~/Scripts/ycm_c_config ./.ycm_extra_config.py"
    alias gitignore="cp ~/.dotfiles/.gitignore ./.gitignore"
    alias readme="cp ~/.dotfiles/.README_TEMPLATE ./README"
    alias gogit="readme & gitignore & git init"

    set_wallpaper() {
        echo "Setting wallpaper: $PWD/$1\n"
        ln -s -f -v $PWD/$1 /home/joe/.wallpaper.jpg
        ln -s -f -v $PWD/$2 /home/joe/.wallpaper-lh.jpg
        feh --bg-scale $PWD/$2 --bg-scale $PWD/$1
    }

# Uses xclip application to pipe output to clipboard.
# Usage - $ cat /path/to/a/file | xclip
# Works on any utility that produces output
alias xclip="xclip -selection c"

export EDITOR='vim'

export term="xterm-256color"

# if command -v tmux>/dev/null; then
#   [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux
# fi

stty -ixon

xset r rate 200 45
  • 4
    chsh won't updated $SHELL, you need to login again for that. I don't see any mention of shells in ~/.tmux.conf. Are you just happening to open an older tmux session from before you changed your shell? – muru Jan 23 at 0:24
  • There should be a line that says set-option -g default-shell /bin/zsh. When I was trying to find the best way to copy/paste my .tmux.conf from the server to this question, my idea was to take it from my .dotfiles repository on github. I didn't push a commit after adding the default shell line to my tmux.conf, so it's not showing up there. Sorry, silly mistake. After messing with it all day, I gave up. When I tried again the next day, default shell was working correctly. Wish I knew why. I not only tried logging out/back in, but restarted the server multiple times while troubleshooting. – Joseph Morgan Jan 27 at 22:38
1

The solution was to actually add the following line to .tmux.conf

set-option -g default-shell /bin/zsh

What's dumb is I definitely knew that and actually did add the line, but I seem to have either not saved the file or not restarted the server after doing so. Everything started working just fine when I connected the next day.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.