0

I am a new emacs user. Previously, for work, I would ssh into my work machine by activating my VPN and then running ssh work (work is an ssh nickname defined in .ssh/config) in my terminal. This would bring me to my virtual machine. From here I would fire up my configured vim-tmux setup.

I am now converting to emacs (specifically spacemacs), but I can't seem to connect to my virtual machine with emacs GNU. I have tried two methods of connecting with TRAMP

  1. I run helm-find-files (SPC f f) and type /ssh:work:
  2. open an eshell and type /ssh:work:`

In both cases, emacs GNU freezes up and says Waiting for prompts from remote shell... for quite some time. Then a mini buffer pops up resembling the azure virtual machine I work on. However, any button press immediately closes the mini buffer. Then the bottom says /ssh:work:/: command not found

I have tried to the best of my ability to read the docs to figure out what I need to do, but I quickly get overwhelmed by the scope of TRAMP. Any guidance would be greatly appreciated.

  • My crystal ball tells me you have trouble with the remote shell prompt. This needs debugging. Since this is out of the sx scope, I recommend to contact the Tramp mailing list. See the Tramp manual for details. – Michael Albinus Feb 22 at 8:03
1

I routinely use multi-hop nicknames with ssh and tramp and it works just fine. As @MichaelAlbinus said, tramp is probably getting hung up on your prompt. It doesn't like all the cool features we cram in to our prompts now-a-days. The trick is to dumb your shell down when using tramp. I'm a zsh user, so early in my shell init (at the top of my ~/.zshrc) I have the following:

## tramp gets hung up on precmd(), unset some features
if [[ "$TERM" == "dumb" ]]; then
   unsetopt zle
   unsetopt prompt_cr
   unsetopt prompt_subst
   unfunction precmd
   unfunction preexec
   PS1='$ '
   return
fi

In bash you can probably get away with just

if [[ "$TERM" == "dumb" ]]; then
   PS1='$ '
   return
fi

at the top of your ~/.bash_profile or ~/.bashrc

  • Seems sensible, although I always thought that tramp explicitly used /bin/sh (or at least the default tramp-methods does not define any remote shell value other than that). Surely you don't have zsh at /bin/sh ? – phils Feb 27 at 6:21
  • This worked great. To clarify, I added the bash code snippet to the remote terminal -- not the local. (Probably obvious but I wasn't totally sure at first) – Andrew Kraemer Feb 28 at 22:56
  • I should have clarified! My shell init stuff is in version control so it’s all then same to me ;) – nega Feb 28 at 22:58

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.