I recently updated my Ubuntu 14 system and the update has made it impossible to have tmux started up automatically. In fact the previous setting made it impossible to log into my Ubuntu account(!), but luckily I had another admin account that I could use to log in and fix the login (comment out the line in my .bashrc). Whew. But the tmux not on startup issues remained.
The problem is:
I've had this at the bottom of my .bashrc for some time:
[ -z "$TMUX" ] && command -v tmux > /dev/null && TERM=xterm-256color && exec tmux
and that worked for years on both Ubuntu and OSX.
Recently it stopped working on Ubuntu
I tried using
[ $TERM != "screen" ] && TERM=xterm-256color && exec tmux
instead but got the same problem and can't even log in.
fyi: the problem goes away once logged in, you have to actually log out and in to test changes. I ended up switching several times between my two accounts to test changes to my .bashrc (I su'd to my account in a terminal in the other login to be the other user and have permissions to do that.
I suspect the problem is with the
exec tmux. I can change those references to just be
tmux and this partially fixes the problem but now requires me to exit twice when quitting any terminal window which is annoying.