3

I added two new lines to my .bashrc so that Bash can find my Go programs:

GOROOT=/Users/jay/work 
PATH=$PATH:$GOROOT/bin 

But as a result, when I launch Emacs, Emacs hangs for several minutes and I get this error:

Tramp: Opening connection for bin using ssh...
Tramp: Sending command `exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none bin'
Tramp: Waiting for prompts from remote shell...
Tramp failed to connect.  If this happens repeatedly, try
    `M-x tramp-cleanup-this-connection'
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for bin using ssh...failed

In a previous question, I found that a path declaration in my .bashrc file caused Tramp to hang. The line was this:

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

That time, I resolved the issue by simply removing the line, since it didn't seem necessary. But this time I kind of need these path declarations.

How do I resolve this error without deleting this path declarations from my .bashrc?

  • 1
    In your previous question, you determined that: "The message Sending command 'exec ssh -e none bin' is a clue that an error is occurring when exec-path-from-shell reads the path from the shell environment." Perhaps the same library -- exec-path-from-shell -- is unable to handle your new addition to .bashrc? You could try closing out all buffers and then exit emacs, and then restart. And you could also try disabling the library exec-path-from-shell. I realize it is a popular library, but there are other methods to set the $PATH in Emacs if that library is causing you problems. – lawlist Jun 24 '16 at 0:07
  • 1
    And, if you determine that exec-path-from-shell is the cause, then consider filing an issue with the author on Github. – lawlist Jun 24 '16 at 0:10
  • Thanks! Disabling exec-path-from-shell resolved the issue. – incandescentman Jun 24 '16 at 0:48
7

I had this exact same problem but it had nothing to do with RVM on ( which I also have ) on my Ubuntu-16.10 machine. It was related to by custom prompt (PS1)

The issue was the prompt PS1.

This fix : https://stackoverflow.com/questions/6954479/emacs-tramp-doesnt-work

Essentially in your .bashrc

     case "$TERM" in
        "dumb")
            export PS1="> "
            ;;
        xterm*|rxvt*|eterm*|screen*)
            tty -s && export PS1="some crazy prompt stuff"
            ;;
    esac
  • Had the same problem with bash-it. Solved replacing your 6th line with tty -s && source "$BASH_IT"/bash_it.sh – Alberto Aug 9 '19 at 13:50
3

It looks like you've run the exec-path-from-shell from a Tramp buffer, so when it runs the shell, it attempts to do its magic on the remote server and then set the environment variables in your local emacs instance. That's almost certainly not what you want, and it's not a case that exec-path-from-shell is designed for. It looks like it's Tramp or your Tramp setup that's not working, though, because in theory any shell command we might execute locally should also work remotely, and that includes those issued by exec-path-from-shell.

0

I ran into this problem, and the issue wasn't PS1--it had something to do with iterm's shell integration. The theory in this iterm2 bug report is that the escape characters used by the shell integration are confusing emacs.

A recent (not yet released) commit to the code disables shell integration for dumb terminals.

Before I saw that fix, I just changed this line in my .bash_profile:

test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"

to this, which disables integration if TERM=dumb:

if [ "$TERM" != "dumb" ]; then
    test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
fi
  • Can you elaborate why you need such a change and what it does exactly? – DoMiNeLa10 Jan 24 '19 at 19:41
  • I edited my answer to include information from an iterm2 bug report related to the issue. – John Wiseman Jan 24 '19 at 22:35

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.