You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 15, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 15, 2026. It is now read-only.
Upon connecting to an SSH target, this exception is raised:
File "testtarget.py", line 16, in <module>
target = Target(kind='linux', host='myip', username='myuser', password='mypassword'),
File "/home/dourai01/Data/Git/lisa/repo/lisa/target.py", line 270, in __init__
self.target = self._init_target(
File "/home/dourai01/Data/Git/lisa/repo/lisa/target.py", line 637, in _init_target
target.connect(check_boot_completed=wait_boot, timeout=wait_boot_timeout)
File "/home/dourai01/Data/Git/lisa/repo/external/devlib/devlib/target.py", line 267, in connect
self._resolve_paths()
File "/home/dourai01/Data/Git/lisa/repo/external/devlib/devlib/target.py", line 1074, in _resolve_paths
self.working_directory = self.path.join(self.execute("pwd").strip(), 'devlib-target')
File "/home/dourai01/Data/Git/lisa/repo/external/devlib/devlib/target.py", line 399, in execute
return self.conn.execute(command, timeout=timeout,
File "/home/dourai01/Data/Git/lisa/repo/external/devlib/devlib/utils/ssh.py", line 223, in execute
raise TargetStableError(
devlib.exception.TargetStableError: cannot split reply (target misconfiguration?):
It seems that the output of any command is just \r\r rather than being the actual output, but the command is still being executed (checked with touch foobar).
That's my host computer so x86-64. I am both able to SSH into my machine using ssh client, and using devlib as well since target.execute('touch /home/myuser/foobar') did work. The problem seems to be related to stdout capture in one way or another, since echoing something does not work.
I've not seen anywhere else apart from another host with same distribution (Archlinux), but OTH OpenSSH 8.1 was released on 2019-10-09 so only bleeding edge setups would be affected, assuming that's related to ssh client or server version. If you are interested, I could send you the full_output content so you can easily mock my case.
Thanks for the information, I have created a VM with the latest arch live stick, OpenSSH 8.1p1-2 and pexpect 4.7 and I'm still not able to recreate the problem.
Are there any notable similarities between the 2 machines you're having this problem with which could be causing that response?
that's strange, what was your Target() invocation ?
The only common point between them is that I'm administrating both, but they are otherwise not sharing anything except my emacs configuration ...
Do you end up with the same self.conn.before content when executing the dummy echo command ?
So the content I get in self.conn.before is what I would expect including the echoed return code. Could this be some sort of locale mismatch causing this?
\x1b[ => Control Sequence Introducer
K => Erase in Line
\r\r => carriage return x2
\x1b[ => Control Sequence Introducer
m => Select Graphics Rendition
\x1b[ => Control Sequence Introducer
m => Select Graphics Rendition
\x1b[ => Control Sequence Introducer
m => Select Graphics Rendition
\x1b[ => Control Sequence Introducer
J = Erase in Display
This looks like something that is resetting a terminal or something like that. That is not the output I get from reset or clear though.
That would make sense however I'm not sure what would be causing that to happen. Would it be possible to place a break point before the send_line and step through the code to get a better picture of what's going on?
I'll give that a go. I also searched for similar issues, and ended up in that issue: iris-GmbH/MONK#108
As a maintainer of pexpect, I highly recommend using paramiko instead of pexpect for ssh :) pexpect's ssh support is from long ago where no native-ssh option existed, it only remains for compatibility.
With paramiko, remote programs will not detect you as a terminal and will not likely write terminal sequences.
That's a comment from 2014, so I assume that paramiko is nowadays in a relatively good shape, so even more relevant. If I find the time to implement it, would that sound like a good idea to you to either move SshConnection to paramiko, or introduce a new connection class ? This should eliminate issues like this one, and also the terminal size issue hanging over our head that will surely bite us again, since we allow unbounded amount of output from commands (and we even use that to dump files content with grep).
EDIT: it already took more time trying to understand the issue that it took to move SshConnection to paramiko (by far), so I propose we do ourselves the favor of closing this issue and spending time on polishing #450 instead :-)
Activity
marcbonnici commentedon Nov 26, 2019
What kind of target are you attempting to use? And are you able to SSH into the device directly?
douglas-raillard-arm commentedon Nov 26, 2019
That's my host computer so x86-64. I am both able to SSH into my machine using ssh client, and using devlib as well since
target.execute('touch /home/myuser/foobar')did work. The problem seems to be related to stdout capture in one way or another, since echoing something does not work.marcbonnici commentedon Nov 26, 2019
Right ok. And the output of
\r\ris that what you get as the value offull_output? (https://github.com/ARM-software/devlib/blob/master/devlib/utils/ssh.py#L237)douglas-raillard-arm commentedon Nov 26, 2019
Yes, sorry if that was confusing
marcbonnici commentedon Nov 26, 2019
Ok just double checking.
Have you seen this when connecting to other machine or just your host machine?
douglas-raillard-arm commentedon Nov 26, 2019
I've not seen anywhere else apart from another host with same distribution (Archlinux), but OTH OpenSSH 8.1 was released on 2019-10-09 so only bleeding edge setups would be affected, assuming that's related to ssh client or server version. If you are interested, I could send you the
full_outputcontent so you can easily mock my case.marcbonnici commentedon Nov 27, 2019
Ah that's interesting and yes please send that over.
Also which version of
pexpectdo you have installed?douglas-raillard-arm commentedon Nov 29, 2019
Ok, so here it is:
Inside
_execute_and_wait_for_prompt():This makes the parent function (
Target.execute()) choke with:douglas-raillard-arm commentedon Nov 29, 2019
Pexpect version:
marcbonnici commentedon Nov 29, 2019
Thanks for the information, I have created a VM with the latest arch live stick, OpenSSH 8.1p1-2 and pexpect 4.7 and I'm still not able to recreate the problem.
Are there any notable similarities between the 2 machines you're having this problem with which could be causing that response?
douglas-raillard-arm commentedon Nov 29, 2019
that's strange, what was your Target() invocation ?
The only common point between them is that I'm administrating both, but they are otherwise not sharing anything except my emacs configuration ...
Do you end up with the same
self.conn.beforecontent when executing the dummyechocommand ?marcbonnici commentedon Nov 29, 2019
This is my reproducer:
So the content I get in
self.conn.beforeis what I would expect including the echoed return code. Could this be some sort of locale mismatch causing this?douglas-raillard-arm commentedon Nov 29, 2019
According to that page, my
self.conn.beforeoutput contains some "erase line" sequences:https://notes.burke.libbey.me/ansi-escape-codes/
This looks like something that is resetting a terminal or something like that. That is not the output I get from
resetorclearthough.marcbonnici commentedon Nov 29, 2019
That would make sense however I'm not sure what would be causing that to happen. Would it be possible to place a break point before the
send_lineand step through the code to get a better picture of what's going on?douglas-raillard-arm commentedon Nov 29, 2019
I'll give that a go. I also searched for similar issues, and ended up in that issue:
iris-GmbH/MONK#108
That's a comment from 2014, so I assume that paramiko is nowadays in a relatively good shape, so even more relevant. If I find the time to implement it, would that sound like a good idea to you to either move SshConnection to paramiko, or introduce a new connection class ? This should eliminate issues like this one, and also the terminal size issue hanging over our head that will surely bite us again, since we allow unbounded amount of output from commands (and we even use that to dump files content with grep).
EDIT: it already took more time trying to understand the issue that it took to move SshConnection to paramiko (by far), so I propose we do ourselves the favor of closing this issue and spending time on polishing #450 instead :-)
marcbonnici commentedon Mar 20, 2020
Should be fixed with #450