SSH master start command returns non-zero value
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- embedded-iot, networking
Research direction
Review labgrid/util/ssh.py, especially SSHConnection._start_own_master and its handling of _master.wait(). Reproduce the shown SSH command against the affected Yocto exporter and compare its return status with the Ubuntu result. Done means the issue has a verified explanation and SSH master startup behaves correctly for the affected exporters.
Written by the indexing model from the issue text.
Description
Hi,
I have issues with labgrid exporters build with Yocto.
Creating SSH ControlSocket for those machines returns non-zero value and this in turn produces the following error:
$ labgrid-client -p regnum-rack video -q low
WARNING: Ticket authentication is deprecated. Please update your coordinator.
Traceback (most recent call last):
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/remote/client.py", line 1785, in main
args.func(session)
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/remote/client.py", line 1102, in video
drv.stream(quality, controls=controls)
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/binding.py", line 96, in wrapper
return func(self, *_args, **_kwargs)
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/driver/usbvideodriver.py", line 133, in stream
tx_cmd = self.video.command_prefix + ["gst-launch-1.0", "-q"]
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/resource/common.py", line 86, in command_prefix
conn = sshmanager.get(host)
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/util/ssh.py", line 50, in get
instance.connect()
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/util/ssh.py", line 399, in connect
self._open_connection()
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/util/ssh.py", line 174, in _open_connection
self._start_own_master()
File "/home/prix/labgrid/venv/lib/python3.8/site-packages/labgrid/util/ssh.py", line 457, in _start_own_master
raise ExecutionError(
labgrid.driver.exception.ExecutionError: failed to connect to root@192.168.69.51 with args ['ssh', '-x', '-o', 'LogLevel=ERROR', '-o', 'PasswordAuthentication=no', '-n', '-MN', '-o', 'ConnectTimeout=30', '-o', 'ControlPersist=300', '-o', 'ControlMaster=yes', '-o', 'ControlPath=/tmp/lg-con-ud3o_03l/control-root@192.168.69.51', '-o', 'StrictHostKeyChecking=yes', 'root@192.168.69.51'], returncode=2 b'',b''
However if I change labgrid/utils/ssh.py:
diff --git a/labgrid/util/ssh.py b/labgrid/util/ssh.py
index fac4ede4b7b5..bafda59413e5 100644
--- a/labgrid/util/ssh.py
+++ b/labgrid/util/ssh.py
@@ -452,7 +452,7 @@ class SSHConnection:
)
try:
- if self._master.wait(timeout=connect_timeout) != 0:
+ if self._master.wait(timeout=connect_timeout) == 255:
stdout, stderr = self._master.communicate()
raise ExecutionError(
f"failed to connect to {self.host} with args {args}, returncode={self._master.returncode} {stdout},{stderr}" # pylint: disable=line-too-long
All works, meaning SSH ControlSocket is created and video starts playing!
According to man ssh:
ssh exits with the exit status of the remote command or with 255 if an error occurred.
hence the proposed change in ssh.py.
I then tried to manually create SSH ControlSocket independently of labgrid:
$ ssh -x -o LogLevel=ERROR -o PasswordAuthentication=no -n -MN -o ConnectTimeout=30 -o ControlPersist=30 -o ControlMaster=yes -o ControlPath=/tmp/test -o StrictHostKeyChecking=yes root@192.168.69.51
$ echo $?
2
$
And the return value is indeed 2. Then I tried another board built with yocto and the return value was 1 :)
Both boards have root login enabled without password! (I also tried setting up user with password on those boards but return values were always the same/non-zero).
Finally I tried with another machine running Ubuntu 22.04 and return value was 0.
So my questions:
- Did anyone experience the same thing with Yocto built exporters?
- Any idea why this happens?
- Shall we check for
sshreturn value of 255 instead of different than non-zero as proposed?
- Dominant language
- Python
- Stars
- 528
- Forks
- 278
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from labgrid-project/labgrid
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
labgrid-project/labgrid#1868 · 3 comments ·
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
labgrid-project/labgrid#1493 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
labgrid-project/labgrid#1953 · 3 comments ·
-
enhancement question
Difficulty 5/5 Over a week Newbie friendliness 35/100
labgrid-project/labgrid#1945 · 5 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
labgrid-project/labgrid#1941 ·
All issues in labgrid-project/labgrid
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100