bug#25050: 25.1; Tramp: Trying to connect to an
Android device

Arash <pbqbqp@xxxxxxxxx> writes:

Hi Arash,

> I'm trying to connect to my Android device which runs SSHelper as ssh
> daemon but tramp hangs on "Tramp: Found remote shell prompt on
> ‘’".
> I also followed the guide
> (https://www.gnu.org/software/emacs/manual/html_node/tramp/Android-shell-setup.html)
> but it isn't working.

Thanks for the report. Let's see what's up:

> 14:31:08.801416 tramp-send-command (6) # exec ssh -l u0_a82 -o
> ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none
> 14:31:09.137629 tramp-process-actions (6) #
> SSHelper Version 8.5 Copyright 2014, P. Lutus
> Odroid-c2:3.14.29
> u0_a82@odroidc2:/data/data/com.arachnoid.sshelper/home $

That's good. Tramp is able to connect your Android device via ssh.

> 14:31:09.138347 tramp-send-command (6) # exec env ENV=''
> HISTFILE=.tramp_history PROMPT_COMMAND='' PS1=\#\$\ PS2='' PS3='' sh

Now Tramp tries to open a local shell. It also tries to set the prompt
to "#$ ".

> 14:31:19.184572 tramp-accept-process-output (10) # *tramp/ssh
> u0_a82@* run *tramp/ssh u0_a82@*
> exec env ENV='' HISTF.xec env ENV='' HISTF
> <^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HILE=.tramp_history
> PROMPT_COMMAND='' PS1=\#\$\ PS2='' PS3.tramp_history PROMPT_COMMAND=''
> PS1=\#\$\ PS2='' PS3
> <^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H='' sh .
> u0_a82@odroidc2:/data/data/com.arachnoid.sshelpe...

r/home $

This fails badly, as we see :-(

For readability, I've replaced the character C-h (code 8) by ^H.

Do you see a chance to use another shell but "sh" on your Android
device? And alternatively, would Tramp's "adb" method an option for you?

Best regards, Michael.