Run and Debug only runs 1 on 5 times Visual Studio Code

Hi,

My application only build/starts in 1 of 3 times when I press “Run And Debug” in Visual Studio

This Is the Error i’m getting : Connection refused

This looks to me like a timing issue, Container has just started but ssh is not ready to container.
Any recommendations how to fix this ?

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello there!

If you’re encountering SSH connection issues with your Toradex device running Torizon, here are some steps you can follow to troubleshoot:

  1. Using PuTTY:

    • Ensure you have the latest version of PuTTY. Older versions might not support the key exchange algorithms used by Torizon properly. You can find more details on this here.
  2. For Visual Studio Code Debugging:

    • Check your Docker registry configuration on the device by reviewing the /etc/docker/daemon.json file. This file should include the correct insecure-registries configuration pointing to your development PC’s IP address. More information can be found here.
  3. Establishing SSH Connections:

    • Torizon uses systemd’s socket mechanism to start an SSH server on demand. Ensure you can connect using either the board’s IP address (e.g., 192.168.10.2) or the board’s hostname with mDNS (e.g., apalis-imx8-06438725.local). Additional tips and known issues are available here.

I hope these steps help resolve your SSH connection issues. If you have any more questions or need further assistance, feel free to ask!

Best regards,
Toradex AI Assistant.

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

SSH - Connect Through Network | Toradex Developer Center.

Greetings @timb,

This looks to me like a timing issue, Container has just started but ssh is not ready to container.

What makes you think this is a timing issue specifically? Did you observe or test something on your side that supports this idea?

Not saying it’s impossible, but I haven’t encountered this yet so it would be a new issue if it were true.

One thing you could try is to add a sleep/delay between the two tasks you thinkg there is a timing issue. For example if you think the ssh task is happening before the container is actually ready, then try adding a delay between the container start task and the ssh task.

To clarify for us, is it always on this step in the screenshot where your process fails? Specifically this “rm -rf /home/torizon/app” step? Or do you observe the process failing on other steps as well? When it fails is it always the same error?

Also what version of the Torizon Extension is this? Also, what is your hardware you are connecting to, and what version of Torizon OS is running on that hardware?

Best Regards,
Jeremias

HI @jeremias.tx ,

Could you tell me where to add the delay/sleep ?

When I face the issue, it’s always on the same step.
My setup is as follows:

  • Verdin AM62
  • dahlia carrier board
  • Visual studio code setup using quickstart guide (WSL)
  • Verdin runnning Torizon OS 7.1.0+build.4 (scarthgap)
  • Docker container runnning Debian GNU/Linux 12 (bookworm)
  • lighttpd as torizonpackage
  • Docker container on WSL Torzin Development Environment for WSL 2 (Debian Bookworm)

@timb

could you report first witch kind of template are you using? C++, .NET, ASP.NET etc?

Thanks in advance.

Hi @matheus.tx ,

i’m using the C++ template.