spacemacs
spacemacs copied to clipboard
Spacemacs freezes when using tramp to scp or ssh
Description :octocat:
Spacemacs freezes when using tramp to scp or ssh
Reproduction guide :beetle:
- Start Emacs
- press SPC f f
- type /ssh:192.168.10.22:/ or /scp:192.168.10.22:/ or /ssh:[email protected]:/ or /scp:[email protected]:/
Observed behaviour: :eyes: :broken_heart: Spacemacs locks up, sometimes splits the view into two windows
Tried: replacing .spacemacs with a default config, resetting PATH to barebones
Expected behaviour: :heart: :smile: ssh or scp to remote system
System Info :computer:
- OS: darwin
- Emacs: 27.0.50
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. f1f8db002)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
(html colors shell python osx helm auto-completion emacs-lisp git markdown neotree org spell-checking syntax-checking)
- System configuration features: RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS LCMS2
Backtrace :paw_prints:
<<BACKTRACE IF RELEVANT>>
Once you type the remote host into helm, it will try to connect. It should connect eventually (few seconds). Can you connect to the hosts using M-x find-file?
This issue doesn't make sense as I don't think tramp is async yet. It has to be solved at Emacs tramp level and not at spacemacs level.
@CeleritasCelery When I use find-file, I get to a "Are you sure you want to continue connecting" prompt, with a solid yellow cursor. I cannot enter y or n, and spacemacs seems completely unresponsive.
I ssh'd into the same machine in an external shell, an added the machine to my known hosts. I then tried find-file again, which now gets stuck on "Tramp: sending password" despite never showing a password entry prompt
Does pkill -SIGUSR2 emacs get a response (and a backtrace, if we're lucky)?
Unfortunately not.
I switched to using https://github.com/railwaycat/homebrew-emacsmacport which is a distribution of emacs 26.01 instead of the recommended https://github.com/d12frosted/homebrew-emacs-plus which is emacs 27.0.50
Using 26.01 I can ssh/scp with no issue
Tramp also froze on my Spacemacs after prompting me to enter the password (immediately after entering /ssh:username@server:). I have to press C-g to stop the helm minibuffer.
- OS: gnu/linux
- Emacs: 26.1
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 47f50b16c)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
(helm speed-reading auto-completion better-defaults spell-checking syntax-checking
(semantic :config
(setq-mode-local emacs-lisp-mode semanticdb-find-default-throttle
(default-value 'semanticdb-find-default-throttle)))
lsp rcirc git github version-control
(shell :variables shell-default-full-span nil shell-default-position 'right shell-default-term-shell "/bin/zsh" shell-enable-smart-eshell t)
(ranger :variables ranger-show-preview t ranger-show-literal nil ranger-parent-depth 3 ranger-cleanup-eagerly t ranger-show-hidden t ranger-max-preview-size 10)
typography chrome search-engine restclient dash fasd pandoc colors themes-megapack gtags imenu-list evil-snipe emacs-lisp
(haskell :variables haskell-completion-backend 'intero haskell-enable-hindent-style "gibiansky")
erlang elixir org
(latex :variables latex-enable-auto-fill nil latex-enable-magic t)
markdown python html yaml shell-scripts tern
(javascript :variables javascript-backend 'tern)
json
(c-c++ :variables c-c++-default-mode-for-headers 'c++-mode c-c++-enable-clang-support t)
rust docker csv
(ess :variables ess-disable-underscore-assign t)
major-modes nginx systemd tmux bm
(mu4e :variables mu4e-view-show-images t mu4e-view-show-addresses t mu4e-view-prefer-html t shr-color-visible-luminance-min 70)
treemacs command-log bibtex cmake ipython-notebook)
- System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2
I had the same issue and found a fix. My problem was from X11 forwarding.
My solution is to use /sshx:user@server: instead of ssh.
I ran into the same issue.
The workaround with /sshx:user@server: is working.
The Documentation is saying the following:
sshx Works like ssh but without the extra authentication prompts. sshx uses ‘ssh -t -t host -l user /bin/sh’ to open a connection with a “standard” login shell.
The important thing is that it launches /bin/sh. My Server is running fish as the default login shell for my user. Could that be the problem?
@Regrau sshx works for me and I too am using fish for the remote server, so it seems likely.
Hi, sshx also works here. All computers have a pure bash setup though, just to let you know!
Hi, sshx also works for me :+1:
Fancy MOTD messages and other stuff in .bashrc that sets prompt can confuse Tramp. I use a line
if [[ $TERM = dumb ]]; then return; fi
at the start of remote .bashrc to disable processing of the rest of .bashrc when Tramp connects.
if that does not work, you might also need something like export PS1="> " in .bashrc to reset your prompt.
Emacs seems to always hang whenever I do basically anything in a workspace that has an /ssh file after I resume my laptop from suspending. Presumably this has something do with a broken connection. I am going to try setting ServerAliveInterval 2 in my ~/.ssh/config and I will edit this comment with the results. (Edit: it appears tramp no longer hangs after resuming from suspend now that I've set ServerAliveInterval)
The following was taken after pkill -sigusr2 emacs. I've replaced the host name with HOST and the directory of the file I was editing with FILE_DIR. However, I see all of the paths use FILE_DIR/remote a subdirectory which does not exist.
Debugger entered--entering a function:
* symbol-overlay-refresh(1 5 0)
accept-process-output(#<process *tramp/sshx HOST*> 1 nil 0)
tramp-accept-process-output(#<process *tramp/sshx HOST*> 1)
tramp-wait-for-regexp(#<process *tramp/sshx HOST*> nil "\\(^\\|\0\\)[^#$\n]*///0b1e16ebe8e674451ee29be1f258458a#\\$\\(\033[[0-9]+n\\)?\015?$")
tramp-wait-for-output(#<process *tramp/sshx HOST*>)
tramp-send-command((tramp-file-name #("sshx" 0 4 (helm-ff-file t ws-butler-chg chg)) nil nil #("HOST" 0 12 (helm-ff-file t ws-butler-chg chg)) nil "FILE_DIR/remote" nil) "test -d FILE_DIR/remote 2>/dev/null; echo tramp_exit_status $?")
tramp-send-command-and-check((tramp-file-name #("sshx" 0 4 (helm-ff-file t ws-butler-chg chg)) nil nil #("HOST" 0 12 (helm-ff-file t ws-butler-chg chg)) nil "FILE_DIR/remote" nil) "test -d FILE_DIR/remote")
tramp-run-test("-d" #("/sshx:HOST:FILE_DIR/remote" 1 5 (ws-butler-chg chg helm-ff-file t) 6 18 (ws-butler-chg chg helm-ff-file t)))
tramp-sh-handle-file-directory-p(#("/sshx:HOST:FILE_DIR/remote" 1 5 (ws-butler-chg chg helm-ff-file t) 6 18 (ws-butler-chg chg helm-ff-file t)))
apply(tramp-sh-handle-file-directory-p #("/sshx:HOST:FILE_DIR/remote" 1 5 (ws-butler-chg chg helm-ff-file t) 6 18 (ws-butler-chg chg helm-ff-file t)))
tramp-sh-file-name-handler(file-directory-p #("/sshx:HOST:FILE_DIR/remote" 1 5 (ws-butler-chg chg helm-ff-file t) 6 18 (ws-butler-chg chg helm-ff-file t)))
apply(tramp-sh-file-name-handler file-directory-p #("/sshx:HOST:FILE_DIR/remote" 1 5 (ws-butler-chg chg helm-ff-file t) 6 18 (ws-butler-chg chg helm-ff-file t)))
tramp-file-name-handler(file-directory-p #("/sshx:HOST:FILE_DIR/remote" 1 5 (ws-butler-chg chg helm-ff-file t) 6 18 (ws-butler-chg chg helm-ff-file t)))
file-directory-p("remote")
spaceline-ml-main()
eval((spaceline-ml-main))
redisplay_internal\ \(C\ function\)()
I have the same problem
Same here however when I use sshx it doesn't register my rolling token doesn't prompt. If I use tramp-term then it register the rolling token but I can't input anything.
I was also facing this problem while using emacsclient when I first tried to connect through /ssh:. I could not get my emacsclient to start up again even after killing it and multiple reboots. For all those who are facing the same thing as I did, I found a way to get your emacsclient back up to running so you can use the working /sshx: method instead.
I figured that the problem why my emacsclient could not start up properly was that tramp was trying to connect over and over again even despite failing and going past the timeout limit I set in my ~/.ssh/config. I had to delete all the new entries in the tramp files to get tramp to stop reconnecting. For the record, the files in question are located in:
~/.emacs.d/tramp~/.emacs.d/.cache/tramp
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Try adding something like:
if [[ $TERM = dumb ]]; then return; fi
to the top of your .bashrc on your remote machine.
https://www.gnu.org/software/emacs/manual/html_node/tramp/Frequently-Asked-Questions.html
Bash and Zsh users can also detect whether their shell is interactive via something like:
# .bashrc or .zshrc
if [[ "${-}" = *i* ]] ; then
# Interactive shell stuff
else
# Non-interactive shell stuff, e.g. unsetopt zle for .zshrc
fi
That's probably overkill for those who keep the default value of tramp-terminal-type as dumb, but may be useful if (for whatever reason) you need to change it.
My remote server also requires a verification on top of a password. That is why it is freezing for me.