0

Question

I setup a SSH server on a Gentoo machine. I copied my identity file (public key) to the server under both the /root/.ssh and /home/i/.ssh (assuming the username is i). And I edit my /etc/hosts to give an alias (assuming its desktop) to the server IP.

SSH works perfectly in a terminal:

ssh i@desktop # or root@desktop

If I type C-x C-f in Emacs, and enter the path /ssh:root@desktop:/, a Dired buffer pops up showing me all directories in / on the server. But when I enter the path /ssh:i@desktop:/, Emacs hangs.

Update

I'm sorry that the debug information was not provided. I set tramp-verbose to 6 and get the following logs.

14:54:24.705903 tramp-process-one-action (5) # Looking for regexp "\(\(Are you sure you want to continue connecting (yes/no\(?:\(?:/\[fingerprint]\)?)\?\)\)\s-*\)\'" from remote shell
14:54:24.705923 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
14:54:24.705943 tramp-process-one-action (5) # Looking for regexp "\(\(TERM = (.*)\|Terminal type\? \[.*\]\)\s-*\)\'" from remote shell
14:54:24.705962 tramp-process-one-action (5) # Looking for regexp "\(Access granted\. Press Return to begin session\. \)\'" from remote shell
14:54:24.705982 tramp-process-one-action (5) # Looking for regexp "\(^
*Confirm user presence for key .*[
]*\)\'" from remote shell
14:54:24.706001 
14:54:24.708144 tramp-process-actions (3) # Waiting for prompts from remote shell...failed
14:54:24.708216 tramp-maybe-open-connection (3) # Opening connection nil for idesktop using ssh...failed
14:54:24.708297 tramp-process-sentinel (5) # Sentinel called: ‘#<process *tramp/ssh idesktop*>’ ‘killed: 9

It seems to be a shell prompt issue. I did do some investigation but not noticed this. Sorry for this dumb question. Thanks for your kindness.

This link Tramp hangs #3 tells what to do.

4
  • You may want to try the troubleshooting for tramp hanging listed in emacswiki.org/emacs/TrampMode#h5o-4 and report your results. Commented Jun 7, 2023 at 8:58
  • See also Bug reporting and Traces in the Tramp manual. Increase the verbosity level to 6 and check the contents of the *tramp/foo* and * debug tramp/foo* buffers: they might lead you to the problem. That will also be useful if you decode to send a bug report with M-x tramp-bug.
    – NickD
    Commented Jun 7, 2023 at 10:22
  • My crystal ball tells me you have a shell prompt not recognized by Tramp. Follow the Tramp manual for investigation. Or follow what @NickD has proposed. Commented Jun 7, 2023 at 11:50
  • Thank you all. I solved this by the third item of tramp hangs on the wiki. 👏
    – k0takuk1
    Commented Jun 9, 2023 at 7:45

1 Answer 1

2

Echoing the comments, it's possible your prompt is confusing tramp (that's usually the case). As a zsh user, I have this set very early in my ~/.zshrc on host machines:

## 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

This unsets a a couple of features, sets a simple prompt, and bails out on processing the rest of the file. The options and functions we're un-doing are zsh specific. For bash you probably only need.

if [[ "$TERM" == "dumb" ]]; then
    PS1='$ '
    return
fi
1
  • Thank you. This dose work!
    – k0takuk1
    Commented Jun 9, 2023 at 7:46

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.