4

I have a weird issue in emacs with TRAMP. i can ssh via M-x ssh to a machine (zlap) from within emacs with no issue. yet when i try to use C-x C-f (find file) it hangs after i enter the passphrase. looking at the message buffer i see this:

    Tramp: Opening connection for 132.72.154.204 using ssh...
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none 132.72.154.204’
Tramp: Waiting for prompts from remote shell...
Timeout reached, see buffer ‘*tramp/ssh 132.72.154.204*’ for details
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for 132.72.154.204 using ssh...failed
Tramp: Opening connection for 132.72.154.204 using ssh...
Couldn’t find local shell prompt for /bin/sh
Tramp: Opening connection for 132.72.154.204 using ssh...failed
tramp-file-name-handler: Couldn’t find local shell prompt for /bin/sh
Invalid face reference: quote [21 times]

looking at the ‘tramp/ssh 132.72.154.204’ buffer shows this

    tramp_exit_status 0
$fg[magenta]zeltak$reset_color$fg[cyan]@$reset_color$fg[yellow]zx1voics$reset_color$fg[red]:$reset_color$fg[cyan]~$reset_color$fg[red]|$reset_color$fg[cyan]⇒$reset_color  #$ 

im at loss here, any clue how to resolve this?

zeltak
  • 1,725
  • 12
  • 28
  • 1
    so i found out digging through wiki sites that sshx work. still interested to find out why ssh dosent? – zeltak Sep 28 '16 at 09:47
  • In my case, the failure of matching the prompt was caused by ANSI code used for coloring the prompt. Modifying the regexp with (setq tramp-shell-prompt-pattern "\\(?:^\\|\r\\)[^]#$%>\n]*#?[]#$%>].* *\\(^[\\[[0-9;]*[a-zA-Z] *\\)*") in my ~/.emacs solved it, as explained here: https://www.emacswiki.org/emacs/TrampMode#toc12. – user30747 Oct 26 '18 at 21:06

1 Answers1

7

Your remote prompt is not Tramp compatible. Check the Tramp documentation how to simplify it. Something like this might work:

[ $TERM = "dumb" ] && PS1='$ '

If your remote shell is zsh, you might even need this:

[ $TERM = "dumb" ] && unsetopt zle && PS1='$ '
Michael Albinus
  • 7,027
  • 15
  • 20
  • thx i have that in my zshrc but that dosent solve it. sshx instead of ssh does work for some reason – zeltak Sep 28 '16 at 10:56
  • 1
    sshx adds a pseudo-terminal. This might be necessary on some machines, for example when your local Emacs is the Cygwin-built one. If it works for you just take it, it doesn't harm :-) – Michael Albinus Sep 28 '16 at 11:20
  • Setting (setq tramp-verbose 9) before connecting revealed my issue: sourcing iTerm2's shell integration. Removing that fixed my issue and further confirmed my belief that I shouldn't be using iTerm2.

    edit: oh, and setting tramp-verbose also prevented the "*tramp [...]" log/debug buffers from automatically closing when I attempted to interact with them -- not sure what that was about.

    – Braham Snyder Oct 01 '17 at 21:30