Cannot connect to target within visual studio code

I am trying to connect to a target from within visual studio code (Linux).

Unfortunately this does not work and I see the following message:

[06-25 16:13:47.015] Trying to connect to 192.168.252.21
[06-25 16:14:30.802] ERROR :: Error trying to connect to .local : undefined

What could be the reason?
It should not be the target because it works with the installation on an another computer (also Linux).

Best regards
René

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

The error message you’re encountering suggests there might be an issue with the network configuration or the way Visual Studio Code is set up to connect to your target device. Given that the connection works from another computer, we can narrow down the potential causes. Here are a few steps to troubleshoot and possibly resolve the issue:

  1. Check Network Configuration: Ensure that the computer you’re using to connect to the target device is on the same network and can ping the target device’s IP address (192.168.252.21 in this case). Use the command ping 192.168.252.21 to verify network connectivity.

  2. Verify SSH Configuration: Since Visual Studio Code uses SSH for remote connections, ensure that SSH is correctly configured and running on your target device. You can test this by attempting to SSH into the target device from your terminal using ssh user@192.168.252.21, replacing user with the appropriate username.

  3. Review Visual Studio Code Configuration: Ensure that your Visual Studio Code configuration for the remote connection is correctly set up. This includes checking the .vscode/settings.json and any relevant configuration files for your project to ensure they match the configuration that works on the other Linux computer.

  4. Check for Extension Issues: If you’re using an extension in Visual Studio Code for the connection (e.g., Remote - SSH), ensure that the extension is up to date. Also, consider disabling other extensions temporarily to rule out any conflicts.

  5. Inspect Firewall Settings: Both on your computer and the target device, check if any firewall settings might be blocking the connection. You might need to allow traffic on specific ports (typically port 22 for SSH) for the connection to succeed.

  6. Review Error Logs: Both Visual Studio Code and your system may provide logs that could offer more insights into what’s causing the connection issue. Check the Output panel in Visual Studio Code for any extension-related errors and review your system’s logs for any network-related errors.

Given the error message does not directly indicate a common issue and considering it works from another setup, the problem likely lies in a specific configuration or environmental difference between the two computers.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

Troubleshooting | Toradex Developer Center.

Thank you.

There is no network issue:

ping -qc3 192.168.252.21
PING 192.168.252.21 (192.168.252.21) 56(84) bytes of data.
--- 192.168.252.21 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2027ms

Connect with ssh is possible:

ssh torizon@192.168.252.21
Last login: Tue Jun 25 18:15:50 2024 from 192.168.252.218

** WARNING **
THIS DEVICE IS IN ENGINEERING MODE

Even more the debug console in vsc shows that a ssh connection to the target ist possible:

[Extension Host] [06-25 18:31:52.670] Trying to connect to 192.168.252.21
console.ts:137
[Extension Host] first login success, checking if we should change the default password...
console.ts:137
[Extension Host] Last login: Tue Jun 25 18:28:01 2024 from 192.168.252.218

** WARNING **
THIS DEVICE IS IN ENGINEERING MODE

[Extension Host] torizon@v80-15289951:~$  console.ts:137
[Extension Host] loged in! console.ts:137
[Extension Host] exit console.ts:137 
Extension Host] logout console.ts:137
[Extension Host] ret from easy pairing ... console.ts:137
[Extension Host] ret from easy pairing :: 1 console.ts:137
[Extension Host] ret from mkdir docker.service.d ... console.ts:137
[Extension Host] ret from daemon.json... console.ts:137
[Extension Host] ret from override.conf... console.ts:137 
[Extension Host] ret from daemon-reload... console.ts:137 
Extension Host] ret from docker restart... console.ts:137 
Extension Host] [06-25 18:32:20.318] ERROR :: Error trying to connect to .local : undefined
notificationsAlerts.ts:42 Error trying to connect to .local : undefined

What versions of visual studio code are supported? I have 1.90.2.

Best regards
René

Greetings @rema,

It should not be the target because it works with the installation on an another computer (also Linux).

So connection worked fine on computer A let’s say, but you get this error on computer B?

Is there any major difference in terms of networking setup between computer A and B?

What versions of visual studio code are supported? I have 1.90.2.

This is the same version of VSCode I’m running. I have no issues so this probably is not a factor here.

Connect with ssh is possible:

I see when you manually connect with SSH the device console has THIS DEVICE IS IN ENGINEERING MODE. This message is set by the extension when it connects to the device. I assume this message was set by the previous connection to computer A?

If that’s the case could you try re-flashing the device with Torizon OS from scratch. Then try connecting with just computer B. Perhaps the issue is that since the device connected with computer A, it can’t connect to another computer running the extension since it’s already associated with computer A. I only have one computer at the moment so I can’t test this theory, but give this a try and see.

Best Regards,
Jeremias

Thank you very much for the answer!

So connection worked fine on computer A let’s say, but you get this error on computer B?

Yes

Is there any major difference in terms of networking setup between computer A and B?

As far as we can see, there is no difference, but A=Ubuntu Linux, B=Arch-Linux.

If that’s the case could you try re-flashing the device with Torizon OS from scratch. Then try connecting with just computer B.

Done! Unfortunately, this does not help.
This is the visual studio code OUTPUT:

[06-26 10:38:49.848] Activating Torizon IDE ...
[06-26 10:38:49.848] Torizon IDE version :: 2.5.1
[06-26 10:38:50.218] Latest Torizon IDE published :: 2.5.168
[06-26 10:38:50.218] Telemetry is enabled
[06-26 10:38:50.218] Extension collects completely anonymous telemetry data about templates usage. Participation in this anonymous program is optional, and you may opt-out if you'd not like to share any information. Check: https://developer.toradex.com/torizon/application-development/ide-extension/reference-documentation/data-collection/#how-to-opt-in-or-out
[06-26 10:38:50.218] Telemetry allows us to accurately gauge templates usage. This data will help us to focus better on the most used templates, adding new features and putting effort in the right place.
[06-26 10:38:50.218] Resolving host IP address ...
[06-26 10:38:50.251] Host IP address OK
[06-26 10:38:50.267] Docker installed OK
[06-26 10:38:50.345] Docker running OK
[06-26 10:38:50.532] Docker compose OK
[06-26 10:38:50.545] PowerShell OK
[06-26 10:38:50.564] git OK
[06-26 10:38:50.578] dig OK
[06-26 10:38:50.585] avahi-resolve OK
[06-26 10:38:50.597] nmap OK
[06-26 10:38:50.607] iputils-ping OK
[06-26 10:38:50.615] file OK
[06-26 10:38:50.628] sshpass OK
[06-26 10:38:50.635] net-tools OK
[06-26 10:38:50.635] Cloning project templates
[06-26 10:38:50.647] Project templates clone OK
[06-26 10:38:51.720] Project templates fetched OK
[06-26 10:38:51.742] Checkout templates repo to v2.5.1 OK
[06-26 10:38:51.744] Checking connected devices ...
[06-26 10:38:51.744] Scanning Torizon devices ...
[06-26 10:38:51.750] Configuring debug id_rsa ...
[06-26 10:38:51.750] Debug id_rsa OK
[06-26 10:38:51.751] Torizon IDE extension activated
[06-26 10:38:52.639] Debian bookworm packages list load OK
[06-26 10:39:16.902] Trying to connect to 192.168.252.21
[06-26 10:39:41.449] ERROR :: Error trying to connect to .local : undefined

Best regards
René

Okay that rules that possibility out. So it’s probably nothing wrong with the device since computer A can connect just fine. This would lead me to think it’s something about how computer B is setup, but it’s not obvious what it could be. Unfortunately, the error message here is pretty generic. As you said you can ssh manually from computer B to the device so network connection shouldn’t be a problem.

Let me ask our team here internally if they have an idea. Maybe the extension runs some checks or other tasks while trying to connect that are failing on computer B for some reason.

Best Regards,
Jeremias

I spoke with the team internally and there is one idea. You mentioned computer B here was running Arch Linux, correct?

Normally when the extension runs it checks for any missing dependencies. However, these checks seem to not work on non Ubuntu/Debian based distributions. Meaning computer B might be missing some dependencies for the extension to work correctly. For connectivity purposes the common requirements for all projects are:

        "openssh-client",
        "sshpass"

At least these are the Ubuntu/Debian name for the packages, not sure what they are in Arch, but should be simple to find out. Could you check if these packages are installed and if not, install them and try again.

Best Regards,
Jeremias

Thanks for your answer!

For connectivity purposes the common requirements for all projects are:
“openssh-client”,
“sshpass”

sshpas is installed and in the visual studio code output we can see that it is ok:
[06-26 10:38:50.628] sshpass OK

The debian ssh-client package includes:

This package provides the ssh, scp and sftp clients, the ssh-agent and ssh-add programs to make public key authentication more convenient, and the ssh-keygen, ssh-keyscan, ssh-copy-id and ssh-argv0 utilities.

All of these - except ssh-argv0 - are included in the openssh package from arch linux (which is of course installed). ssh-argv0 does not exist in arch, I would have to rebuild it.

Is it possible that it is the missing ssh-argv0?

Best regrads
René

Is it possible that it is the missing ssh-argv0?

Possibly. We really only test our VSCode extension on Ubuntu/Debian based Linux distributions. Anything outside of this like Arch can be a bit of an unknown. Especially with package feeds and versions of things differing between each distribution.

Best Regards,
Jeremias