2

I am trying to connect to a remote server through SSH to edit some projects.

I do C-x C-f and then /ssh:username:ip:. It displays a password prompt. I type my password and press RET. It takes very long time to connect and even after that, it is barely usable. I can't really type any directory-file names because it takes ~20 seconds for each character to appear etc. And when I am finally able to type the path I want as in /ssh:username:ip:/file/i/want, it hangs up and does not open the file. Maybe it will at some point but it is so slow that I was never able to wait enough. Same issue when I try to use dired to open a remote directory as well, with C-x C-d. Of course, I am able to connect through ssh on bash just fine.

I tried some of the suggestions mentioned here like adding some stuff that mentioned in EmacsWiki which supposedly should help with slowness of tramp, using a fixed Projectile powerline etc. but none of them helped. What might be the cause?

I am using Emacs 29.0.50 and it is used as a GUI app run through WSL2 Debian on Windows.

Additional Info

I set the tramp logging level to 6 and got the following logs.

12:41:12.920688 tramp-process-actions (6) # 

user@ip's password: 
Linux Kafa1500 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) 
x86_64

The programs included with the Debian GNU/Linux system are free 
software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Thu Jan  6 12:40:07 2022 from 172.29.252.94
xrdb: Can't open display ''
Can't open display 
Can't open display 
[0;30m[45m 12:40:15 [0;35m[43m▶[0;30m[43m meguli 
[0;30m[43m│[0;30m[43m ╤ ip [0;33m[44m▶[0;30m[44m ~ 
[0;34m[49m▶
[0;30m[45m $ [0;35m[49m▶[0m 
12:41:12.920812 tramp-process-sentinel (5) # Sentinel called: ‘# 
<process *tramp/ssh user@ip*>’ ‘killed
’
12:41:12.922779 tramp-process-actions (1) # File error: Timeout 
reached, see buffer ‘*tramp/ssh user@ip*’ for details

user@ip's password: 
Linux Kafa1500 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) 
x86_64

The programs included with the Debian GNU/Linux system are free 
software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Thu Jan  6 12:40:07 2022 from 172.29.252.94
xrdb: Can't open display ''
Can't open display 
Can't open display 
[0;30m[45m 12:40:15 [0;35m[43m▶[0;30m[43m meguli 
[0;30m[43m│[0;30m[43m ╤ ip [0;33m[44m▶[0;30m[44m ~ 
[0;34m[49m▶
[0;30m[45m $ [0;35m[49m▶[0m 
12:41:38.731775 tramp-process-actions (3) # Waiting for prompts 
from remote shell...failed
12:41:38.732061 tramp-maybe-open-connection (3) # Opening 
connection nil for user@ip using ssh...failed

It looks like it actually connects and opens the terminal but then receives a timeout. Upon further research, it seems like this might be due to TRAMP not recognizing fancy prompt on my remote shell, but I don't know a workaround for this.

3
  • Is emacs comparably slow when running with -Q?
    – choroba
    Jan 6, 2022 at 11:35
  • No, it is pretty fast except for the case above, having the same slow SSH issue for -Q as well.
    – meguli
    Jan 6, 2022 at 11:41
  • try scp: instead, it will be fast. as long there is only one hope. i.e. no ssh: over tunneling allowed with scp
    – Raj
    Jan 6, 2022 at 22:28

1 Answer 1

6

Indeed, Tramp doesn't like your fancy prompt. The Tramp manual explains what to do, the FAQ section. In short, you shall add to your remote .profile

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

If the shell on the remote host is zsh, you need to set

           [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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