0

ssh localhost succeeds:

neptune% ssh localhost
Linux neptune 5.16.0-0.bpo.4-amd64 #1 SMP PREEMPT Debian 5.16.12-1~bpo11+1 (2022-03-08) 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: Sat Jun 18 21:11:19 2022 from ::1
neptune% 

C-x C-f /ssh:localhost:~/ gets stuck in a loop and fails.

I am not sure whether this is failure to detect the shell prompt, as described here: How to debug hanging tramp connections? (this did not solve it: https://emacs.stackexchange.com/a/45810/6682)

After setting tramp-verbose higher, I see in the logs:

;; Emacs: 28.1 Tramp: 2.5.2.28.1 -*- mode: outline; coding: utf-8; -*-
18:04:10.075003 tramp-maybe-open-connection (3) # Opening connection nil for localhost using ssh...
18:04:10.077807 tramp-maybe-open-connection (3) # Sending command ‘exec ssh -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none localhost’
18:04:10.078022 tramp-process-actions (3) # Waiting for prompts from remote shell...
18:04:10.078228 tramp-process-one-action (5) # Looking for regexp "\(.*\(user\|login\)\( .*\)?: *\)\'" from remote shell
18:04:10.078405 tramp-process-one-action (5) # Looking for regexp "\(^.*\(\(?:adgangskode\|contrase\(?:\(?:ny\|ñ\)a\)\|decryption key\|encryption key\|geslo\|h\(?:\(?:asł\|esl\)o\)\|iphasiwedi\|jelszó\|l\(?:ozinka\|ösenord\)\|m\(?:ot de passe\|ật khẩu\)\|p\(?:a\(?:rola\|s\(?:ahitza\|s\(?: phrase\|code\|ord\|phrase\|wor[dt]\)\|vorto\)\)\|in\)\|s\(?:alasana\|enha\|laptažodis\)\|wachtwoord\|лозинка\|пароль\|ססמה\|كلمة السر\|गुप्तशब्द\|शब्दकूट\|গুপ্তশব্দ\|পাসওয়ার্ড\|ਪਾਸਵਰਡ\|પાસવર્ડ\|ପ୍ରବେଶ ସଙ୍କେତ\|கடவுச்சொல்\|సంకేతపదము\|ಗುಪ್ತಪದ\|അടയാളവാക്ക്\|රහස්පදය\|ពាក្យសម្ងាត់\|パスワード\|密[码碼]\|암호\)\).*:\0? *\)\'" from remote shell
18:04:10.078614 tramp-process-one-action (5) # Looking for regexp "\(^.*\(Connection \(?:\(?:clo\|refu\)sed\)\|Host key verification failed\.\|Login \(?:[Ii]ncorrect\)\|N\(?:ame or service not known\|o supported authentication methods left to try!\)\|Permission denied\|\(?:Sorry, try again\|Timeout, server not responding\)\.\).*\|^.*\(Received signal [[:digit:]]+\).*\)\'" from remote shell
18:04:10.078776 tramp-process-one-action (5) # Looking for regexp "\(^[^#$%>
]*[#$%>] *\)\'" from remote shell
18:04:10.078926 tramp-process-one-action (5) # Looking for regexp "\(\(?:^\|
\)[^]#$%>
]*#?[]#$%>] *\(\[[[:digit:];]*[[:alpha:]] *\)*\)\'" from remote shell
18:04:10.079059 tramp-process-one-action (5) # Looking for regexp "\(\(Are you sure you want to continue connecting (yes/no\(?:\(?:/\[fingerprint]\)?)\?\)\)\s-*\)\'" from remote shell
18:04:10.079190 tramp-process-one-action (5) # Looking for regexp "\(\(\(?:Store key in cache\? (y/\|Update cached key\? (y/n, Return cancels connectio\)n)\)\s-*\)\'" from remote shell
18:04:10.079316 tramp-process-one-action (5) # Looking for regexp "\(\(TERM = (.*)\|Terminal type\? \[.*\]\)\s-*\)\'" from remote shell
18:04:10.079437 tramp-process-one-action (5) # Looking for regexp "\(Access granted\. Press Return to begin session\. \)\'" from remote shell
18:04:10.079565 tramp-process-one-action (5) # Looking for regexp "\(^
*Confirm user presence for key .*[
]*\)\'" from remote shell
18:04:10.079682 tramp-process-one-action (5) # Looking for regexp "\(\)\'" from remote shell
18:04:10.079808 tramp-process-one-action (5) # Call ‘tramp-action-process-alive’
.
.
.
.
[log after C-g which cancels the TRAMP connection]

[1m[7m%[m[1m[m                                                                               
 
]2;peterbecich@neptune:~]1;~
[m[m[m[Jneptune% [K[?2004h
18:04:16.233084 tramp-accept-process-output (1) # Quit: "Quit", ""
Linux neptune 5.16.0-0.bpo.4-amd64 #1 SMP PREEMPT Debian 5.16.12-1~bpo11+1 (2022-03-08) 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: Sat Jun 18 18:04:00 2022 from 127.0.0.1
[1m[7m%[m[1m[m                                                                               
 

My default shell is zshell:

neptune% echo $SHELL
/bin/zsh

Oddly, the shell shown in the log message above appears to be bash; perhaps that is a clue:

neptune% bash
peterbecich@neptune:~$ 

TRAMP fails to log into localhost regardless of how explicit-shell-file-name is set: https://superuser.com/questions/454288/how-to-specify-for-emacs-tramp-which-remote-shell-to-open


TRAMP succeeds at logging into a Vagrant box:

  /ssh:[email protected]:/home/vagrant:
  total used in directory 16K available 16.2 GiB
  drwx------ 1 vagrant vagrant 112 Aug 11  2019 .
  drwxr-xr-x 1 root    root     14 Aug  5  2019 ..
  -rw------- 1 vagrant vagrant 189 Jun 19 03:53 .bash_history
  -rw-r--r-- 1 vagrant vagrant  21 Apr 30  2019 .bash_logout
  -rw-r--r-- 1 vagrant vagrant  57 Apr 30  2019 .bash_profile
  -rw-r--r-- 1 vagrant vagrant 141 Apr 30  2019 .bashrc
  drwx------ 1 vagrant vagrant  12 Aug 11  2019 .config
  drwx------ 1 vagrant vagrant  30 Aug 11  2019 .ssh

I'm attempting to log into localhost with TRAMP in order to reproduce an unrelated issue.

1
  • 1
    To me looks like tramp isn't recognizing the prompt for whatever reason (like sending back color codes) and keeps waiting for it. Something similar happened to me using expect scripts. I'd start trying the methods they explain in Tramp's FAQ to discard reasons.
    – Muihlinn
    Jun 19, 2022 at 9:58

1 Answer 1

1

I suspect the zsh line editor (zle) is in play. Read the Tramp manual how to handle this.

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.