Problems getting extension to work

Hi,
I have had a bunch of problems getting the extension to work today, I only use it occasionally but really need it to work when I do, not spend 4 hours trying to persuade it.

I have managed to solve a number of error messages partly by reinstalling just about everything but now I am stumped by this building the container error:

#7 [vs_device_application-debug 2/8] RUN apt-get -q -y update &&     apt-get -q -y install     openssl     openssh-server     rsync     file     screen         libgfortran5     && apt-get clean && apt-get autoremove &&     rm -rf /var/lib/apt/lists/*
#7 0.317 exec /bin/sh: exec format error
#7 ERROR: process "/bin/sh -c apt-get -q -y update &&     apt-get -q -y install     openssl     openssh-server     rsync     file     screen \tlibgfortran5     && apt-get clean && apt-get autoremove &&     rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 255

It looks like a problem installing libraries into the container. All suggestions very welcome.

Ed

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!

It sounds like you’re encountering an ‘exec format error,’ which often happens when there’s an architecture mismatch—essentially trying to run a binary built for one architecture on a different one. Let’s go through some steps to help you resolve this issue:

  1. Configure Your Build Environment:

    • Ensure your build environment is set up correctly for Torizon containers. You can follow the initial setup guide here: Torizon Quickstart Guide.
  2. Package Installation Tips:

    • Always update your package list first using apt-get update.
    • When installing packages, specify the correct architecture to avoid mismatches. More details can be found here: Community Discussion on Package Issues.
    • After installation, clean up with apt-get clean && apt-get autoremove to keep your environment tidy.
  3. Using Visual Studio Code:

    • Make sure you have Visual Studio Code installed along with the Torizon extension and the Remote Containers extension from Microsoft. This setup is crucial for a smooth development experience. Here’s a helpful blog post: Importing Qt Project into Torizon.
  4. Troubleshooting Persistent Issues:

    • Try restarting the Docker daemon on your host machine if problems continue.
    • If you’re using Windows, you might need to run wsl --shutdown in PowerShell with administrative privileges. More troubleshooting tips are available here: Torizon FAQ.

I hope these steps help you get back on track! If you have more details about your development environment or target architecture, feel free to share, and I can provide more tailored advice.

Best regards,
Toradex AI Assistant

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

Torizon Frequently Asked Questions (FAQ) | Toradex Developer Center.

Hello @edwaugh,

Are you using it to build an existing project?
Or is it a new project?
Which template is being used as a base?

Regardless, this error is caused by the lack of ARM emulation on the system.
The extension should take care of this, so we need to understand what may be wrong here.

Can you run the run-torizon-binfmt task and try again?
It is under the task-runner pane of the explorer view.
You will need to click on the little eye highlighted to unhide it.

If this task fails for any reason, please send me the logs you see.

Best Regards,
Bruno

Hi @bruno.tx,

It ran ok, output:

 *  Executing task: pwsh /home/edwaugh/cloudbox_v3_bba/v3DeviceApplication/.conf/runContainerIfNotExists.ps1 -ContainerRuntime docker -RunArguments "--rm --privileged commontorizon/binfmt:9.0.2" -ContainerName binfmt 

Container Runtime: docker
Run Arguments: --rm --privileged commontorizon/binfmt:9.0.2
Container Name: binfmt
Error response from daemon: No such container: binfmt
Container does not exist. Starting ...
Unable to find image 'commontorizon/binfmt:9.0.2' locally
9.0.2: Pulling from commontorizon/binfmt
c2e6b12a30f6: Pull complete 
10c0800f9ae9: Pull complete 
3063715dccfe: Pull complete 
Digest: sha256:95f6fdec8daa850f05c5870e73f97a38dbd9e698f75d36096b95411327179f13
Status: Downloaded newer image for commontorizon/binfmt:9.0.2
 *  Terminal will be reused by tasks, press any key to close it. 

Also the build seems to continue now. I will let you know if I get stuck again. Thanks very much.

1 Like

@bruno.tx, ok next sticking point which I think I was before I reinstalled everything:

 *  Executing task: DOCKER_HOST=192.168.203.2:2375 LOCAL_REGISTRY=192.168.178.23 TAG=arm64 GPU=-imx8 DEBUG_SSH_PORT=6502 DEBUG_PORT1=6512 DEBUG_PORT2= DEBUG_PORT3= docker compose --ansi never pull vs_device_application-debug 

WARN[0000] The "DOCKER_LOGIN" variable is not set. Defaulting to a blank string. 
 vs_device_application-debug Pulling 
 vs_device_application-debug Warning Get "http://192.168.178.23:5002/v2/": dial tcp 192.168.178.23:5002: connect: network is unreachable
WARNING: Some service image(s) must be built from source by running:
    docker compose build vs_device_application-debug
1 error occurred:
        * Error response from daemon: Get "http://192.168.178.23:5002/v2/": dial tcp 192.168.178.23:5002: connect: network is unreachable



 *  The terminal process "/usr/bin/bash '-c', 'DOCKER_HOST=192.168.203.2:2375 LOCAL_REGISTRY=192.168.178.23 TAG=arm64 GPU=-imx8 DEBUG_SSH_PORT=6502 DEBUG_PORT1=6512 DEBUG_PORT2= DEBUG_PORT3= docker compose --ansi never pull vs_device_application-debug'" failed to launch (exit code: 1).

Hello @edwaugh,

Can you remove and re-add your device to the extension?
After it is added again, please remember to set is as default again.

I think the current configuration is for a previous network and this is the cause of the issue.

Best Regards,
Bruno

Still the same error unfortunately, the device IP is
“torizon_ip”: “192.168.203.2”,

The connection fails to:
“host_ip”: “192.168.178.23”,

I guess this is trying to talk to docker installed in WSL? I can see that it is present:

(.venv) 🐧 edwaugh @CloudCycleEW~/cloudbox_v3_bba/v3DeviceApplication: docker --version
Docker version 28.0.2, build 0442a73

Hello @edwaugh,

Can you test with a new project to see if the same issue is present?
We may need to change something at project level or at system level.

Best Regards,
Bruno

Hi Bruno,
I will give that a go shortly, having another look today I got a message that the OS version on the target was too old which I had not seen before. I had picked up an old unit to use and have now upgraded it and get back to this message:

Hi @bruno.tx,
Fresh project gives the same error, this ran ok in the simulator and printed hello world. I think selected torizon arm64 in the debug menu and get here:

My colleague @jonmills had a problem with the extension on Friday and reverted to v2.8.1 which he found worked for him. I will try that now.

Hi Bruno,
Switching back to 2.8.1 fixed it for me, although when changing from the test project back to my project it lost track of the device password somehow so an rsync failed at the password prompted. Removing and re-connecting to the device fixed that.

Something I noticed that changed is the port it is attempting to connect to. On the non-working attempts it was 5002 and now it is 6502. I can see that gets recorded in settings.json but it is not clear to me where it comes from. I will give the latest another go now to see if it will work now we have had a successful build of the container.

Hi @bruno.tx,
Going to 3.0.3 is broken for me with that error but 2.8.1 is working. The only thing I noticed is that during startup the extension complains about templates:

Thanks for your help, but maybe some better testing is required, at least on my machine your standard Python command line project is broken in the latest release.

Ed

Hello @edwaugh,

Noted, thanks for the information.
I will bring this up to the extension team.

What I can suggest for now is to try to use the pre-release version of the extension, alongside with the dev branch of the templates repository, as described here: Settings - Using Templates Development Branch | Toradex Developer Center

Best Regards,
Bruno

Hello @edwaugh,

The extension team has looked into this issue and found the problem.
The fix will be released with version 3.0.4 of the extension, but should be available a bit earlier in the pre-release version.

Best Regards,
Bruno

1 Like

Hello @edwaugh,

Version 3.0.4 of the extension has been released with a fix for this problem.
Please let me know if it works for you.

Best Regards,
Bruno

Hi @bruno.tx, unfortunately not, I did:

  1. Test under 2.8.1 - works
  2. Change to 3.0.4 and reload window
  3. Test - does not work same error as above
  4. Change back to 2.8.1 and reload window
  5. Test - works

Hello @edwaugh,

Thanks for trying this.

I will raise this with the IDE extension team.

Best Regards,
Bruno

I tried v3.0.4 with no luck.

The issue for me is that it seems to have set the ports in my workspace file to empty strings;

		"docker.environment": {
			"DOCKER_HOST": "tcp://192.168.0.12:2375",
			"DEBUG_SSH_PORT": "",
			"DEBUG_PORT1": "",
			"DEBUG_PORT2": "",
			"DEBUG_PORT3": ""
		}

If I edit the workspace file to set the port values back to

			"DEBUG_SSH_PORT": "2222",
			"DEBUG_PORT1": "2222",
			"DEBUG_PORT2": "2223",
			"DEBUG_PORT3": "2224"

it seems to work OK.
If I re-set my default device, the ports are immediately overwritten to empty strings.

When I attempt to debug, I see this output.

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task in folder v3DeviceApplication: DOCKER_HOST= docker compose --ansi never build --pull --build-arg SSHUSERNAME=root --build-arg APP_ROOT=/home/torizon/app --build-arg IMAGE_ARCH=arm64 --build-arg DEBUG_SSH_PORT=6502 --build-arg GPU=-imx8 vs_device_application-debug 

WARN[0000] The "DOCKER_LOGIN" variable is not set. Defaulting to a blank string. 
no port specified: :<empty>

 *  The terminal process "/bin/bash '-c', 'DOCKER_HOST= docker compose --ansi never build --pull --build-arg SSHUSERNAME=root --build-arg APP_ROOT=/home/torizon/app --build-arg IMAGE_ARCH=arm64 --build-arg DEBUG_SSH_PORT=6502 --build-arg GPU=-imx8 vs_device_application-debug'" failed to launch (exit code: 15). 
 *  Terminal will be reused by tasks, press any key to close it. 

Hello @jonmills,

I saw this same issue when testing the experimental multi-container projects feature recently.
Are you by any chance using this feature?

Best Regards,
Bruno