2

I log into a system via ssh (ubuntu). Recently, when I start up mc directly from the command prompt, it takes ages to start and finally present the familiar two-pane screen. Also, I can't drop to the command prompt subshell (using ctrl-o). If I start it under tmux, it starts up instantly, and ctrl-o works normally.

It seems some environment setting is causing a tremendous stall, but I can't pinpoint it. Can someone help, please?

Thanks, Jon

2

mc is timing out waiting for a response from bash (the shell it forks for the command line at the bottom of the screen). You can find the timeout by scrolling through the timestamps. As per man select, the system call in question waits for input on specified file descriptors. In the successful trace, FD 7 is created earlier by pipe() - it's a pipe to the child process. In the successful case I found the bash prompt jon@sonic:~$ being successfully read out of the pipe. I don't remember how I found that last, sorry.

Searching for execv confirms the pid which writes jon@sonic:~$ is bash. Then I happened to notice tmux being started somewhere in the failure case. I doubt mc likes running tmux as a shell!

You must have some sort of bash startup script which runs tmux. It avoids running it if it's already inside tmux. So mc inside tmux is fine, but not outside.

I would make sure to start tmux from a login script, not the scripts which are run for bash sub-shells. This means .bash_profile and not .bashrc. There's some information about this here which matches my thinking: https://apple.stackexchange.com/questions/71929/how-to-change-mc-midnight-command-bash-prompt-on-os-x

1

Thanks, sourcejedi - you hit the nail on the head. I had recently added some lines to my .bashrc in order to autostart tmux on login - duh! I should have realised the connection. This is also why I couldn't drop into a subshell (using ctrl-o) from within mc. For info, the lines to start tmux were the following:

# enable autostart of tmux
if [[ "$TERM" != "screen" ]] ; then
# &&  [[ "$SSH_CONNECTION" == "" ]]; then
    # Attempt to discover a detached session and attach 
    # it, else create a new session

    WHOAMI=$(whoami)
    if tmux has-session -t $WHOAMI 2>/dev/null; then
        tmux -2 attach-session -t $WHOAMI
    else
        tmux -2 new-session -s $WHOAMI
    fi
fi

Big fail. I have now moved this into .bash_profile, and everything works! Thanks!

Jon

(btw, I'm the original poster.. hiccup with not logging in with openauth caused posting under wrong / new account)

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