Error opening remote remote window in VS Code with Torizon extensio

Hi all,

I am trying to run a simple program on a Colibri module running Torizon.

If I click on the lower left corner in VS Code (“Open a Remote window”) I get the following log in which Docker complains about not finding the required image:

[55686 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[55814 ms] 1.41
[55827 ms] Start: Run: /usr/share/code/code --ms-enable-electron-run-as-node /home/localadmin/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /home/localadmin/Interferometer/Software/API-terminal --log-level debug --log-format json --config /home/localadmin/Interferometer/Software/API-terminal/.devcontainer/devcontainer.json --include-merged-configuration --mount-workspace-git-root true --terminal-columns 158 --terminal-rows 30
[56016 ms] (node:22809) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[56016 ms] (Use `code --trace-deprecation ...` to show where the warning was created)
[56018 ms] @devcontainers/cli 0.25.2. Node.js v16.14.2. linux 5.14.0-1054-oem x64.
[56018 ms] Start: Run: git rev-parse --show-cdup
[56022 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/localadmin/Interferometer/Software/API-terminal
[56091 ms] Start: Run: docker inspect --type image api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image
[57113 ms] Error fetching image details: No manifest found for docker.io/library/api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image.
[57115 ms] Start: Run: docker pull api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image
Using default tag: latest
Error response from daemon: pull access denied for api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
[59264 ms] []
[59264 ms] Error: No such image: api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image

[59264 ms] Command failed: docker inspect --type image api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image
[59276 ms] Exit code 1

I read several posts here and elsewhere on the web and the only thing I found was doing a login on docker. I did do that (both in the Docker Desktop application that is running and on a terminal) although I don’t think this is necessary since everything is supposed to be local.
I suppose the image simply does not exist. So the question is, how do I (re-)generate it ?

Info about docker (reply to “docker version”) :

Client: Docker Engine - Community
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:04 2022
 OS/Arch:           linux/amd64
 Context:           desktop-linux
 Experimental:      true

Server: Docker Desktop 4.16.1 (95567)
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:26:14 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Any help is appreciated !

Best regards,
Jeroen

Hi @ompie ,

I assume you’re trying to reopen a C/C++ project inside a dev container, is this correct?

I read several posts here and elsewhere on the web and the only thing I found was doing a login on docker. I did do that (both in the Docker Desktop application that is running and on a terminal) although I don’t think this is necessary since everything is supposed to be local.
I suppose the image simply does not exist. So the question is, how do I (re-)generate it ?

You’re right, the missing Docker image should’ve been locally generated when you first created the project on VSCode. You can regenerate it by doing the following:

  • Open VSCode, then open your project folder;
  • Press F1, then type: Torizon: Rebuild SDK and reload in container. Press enter;
  • A message will appear on the bottom right, asking if you want to continue. Select yes.

The SDK Docker image related to your project will be rebuilt and the project will automatically reopen in the container if the build was successful.

See if this helps you.

Best regards,
Lucas Akira

Hi @lucas_a.tx,

Yes, that’s indeed what I am doing.

Well, that’s exactly what I tried. After clicking on ‘Yes’, the ‘Dev Containers’ terminal shows the log I included in my initial post. On the Torizon output tab, I get:

[00-16 13:47:53.702] Step 1/4 : FROM torizon/debian-cross-toolchain-armhf:2-bullseye
[00-16 13:47:55.129] ---> 50f7d2e63287
[00-16 13:47:55.140] Step 2/4 : RUN apt-get -q -y update     && apt-get -q -y upgrade     && apt-get -q -y install gdb-multiarch procps rsync openssh-client            && rm -rf /var/lib/apt/lists/*
[00-16 13:47:55.141] ---> Using cache
[00-16 13:47:55.142] ---> 28dce8038d4d
[00-16 13:47:55.143] Step 3/4 : RUN if [ ! -z "" ]; then     apt-get -q -y update     && apt-get -q -y install      && rm -rf /var/lib/apt/lists/* ;     fi
[00-16 13:47:55.144] ---> Using cache
[00-16 13:47:55.144] ---> d18ab8fa78a7
[00-16 13:47:55.145] Step 4/4 : RUN if [ ! -z "" ]; then     apt-get -q -y update     && apt-get -q -y install      && rm -rf /var/lib/apt/lists/* ;     fi
[00-16 13:47:55.146] ---> Using cache
[00-16 13:47:55.146] ---> b639ae75aa77
[00-16 13:47:55.147] Successfully built b639ae75aa77
[00-16 13:47:55.147] Successfully tagged api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image:latest
[00-16 13:47:55.343] Step 1/4 : FROM torizon/debian-cross-toolchain-armhf:2-bullseye
[00-16 13:47:56.482] ---> 50f7d2e63287
[00-16 13:47:56.492] Step 2/4 : RUN apt-get -q -y update     && apt-get -q -y upgrade     && apt-get -q -y install gdb-multiarch procps rsync openssh-client            && rm -rf /var/lib/apt/lists/*
[00-16 13:47:56.493] ---> Using cache
[00-16 13:47:56.493] ---> 28dce8038d4d
[00-16 13:47:56.494] Step 3/4 : RUN if [ ! -z "" ]; then     apt-get -q -y update     && apt-get -q -y install      && rm -rf /var/lib/apt/lists/* ;     fi
[00-16 13:47:56.494] ---> Using cache
[00-16 13:47:56.494] ---> d18ab8fa78a7
[00-16 13:47:56.495] Step 4/4 : RUN if [ ! -z "" ]; then     apt-get -q -y update     && apt-get -q -y install      && rm -rf /var/lib/apt/lists/* ;     fi
[00-16 13:47:56.495] ---> Using cache
[00-16 13:47:56.495] ---> b639ae75aa77
[00-16 13:47:56.496] Successfully built b639ae75aa77
[00-16 13:47:56.496] Successfully tagged api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image:latest
[00-16 13:47:56.544] Rebuilding and reloading container...

So it looks like Torizon rebuilt the api-terminal_arm32v7-debian-no-ssh_bullseye_debug... image. (I checked the exact names in both windows and they are indeed the same).

Before doing the build, I removed all docker images. Before the remove, I had (using the command ‘docker images’):

REPOSITORY       TAG       IMAGE ID       CREATED        SIZE
arm32v7/debian   latest    a94cd7c7d58f   5 days ago     100MB
alpine           3.16.3    bfe296a52501   2 months ago   5.54MB
torizon/binfmt   latest    893244d86992   2 years ago    37.5MB

After the build, I listed the images again, but there is no image at all. So the api-terminal_arm32v7-debian-no-ssh_bullseye_debug... image either does not exist or is not visible by docker and the Dev Container extension.
Hopefully, this will give you another idea of what is wrong.
Please know that your help is very much appreciated !

Best regards,
Jeroen

Hi @ompie ,

The SDK image doesn’t appear on docker images, even though the logs show it was built and tagged? That’s unusual.

Does this happen on every new C/C++ project you try to create? If not, as a workaround you could transfer the files from the non-working project to the new one.

As a way to verify Docker on the host machine, can you build the SDK image manually by going to the SDK dockerfile (located in <project dir>/appconfig_0/work/) then running:

docker build -f Dockerfile_SDK.debug --no-cache -t <img_name> .

See if the image is successfully created and if it appears when executing docker images.

Best regards,
Lucas Akira

Hi @lucas_a.tx,

I closed the project window and created a new project (same config).
When opening the remove dev container, I get stuck. In the output I get:

[00-16 16:53:43.671] Initializing Torizon Extension
[00-16 16:53:43.701] Checking system setup...
[00-16 16:53:43.702] Docker seem to not be enabled for current user, this will prevent many of the features of Torizon extension from working.
You may add your user to the docker group or run the Torizon IDE backend with an account that is part of that group.
[00-16 16:53:43.703] Checking Moses ...
[00-16 16:53:43.819] Starting backend local instance running on port 5001
[00-16 16:53:45.997] Torizon Backend version 1.0.0 API version: 1.1.6
[00-16 16:53:45.997] Torizon IDE backend started
[00-16 16:53:45.997] Checking Docker ...

This is strange since I did add the logged in user to the docker group (with sudo addgroup <your user name> docker)

I also tried to manually re-create the image as suggested and this indeed creates the image (on both PCs where I had the same problem):

$ docker images
REPOSITORY                                                                                         TAG       IMAGE ID       CREATED          SIZE
api-terminal_arm32v7-debian-no-ssh_bullseye_debug_570c1fcc-4af2-407c-8c3d-0c0cc39686db_sdk_image   latest    9df51e8b9c80   10 seconds ago   1GB

Eager to see whether this solved the problem, I reopened the C/C++ project inside the dev container and the previous errors are gone. So this is the good news.

But I got other errors. So it is getting complicated with all the diferent things that went wrong. Without knowing whether there is any link between them (I also have another open thread that may be related: Torizon extension Visual Studio Code reboots module - #12 by henrique.tx).

So I think the best is to start with a clean installation of everything (Docker, Torizon and VS Code).
For Docker, I got a comprehensive list of commands to remove any trace from a previous installation but I’m not sure how to really get rid of all traces of e.g. the Torizon extension (and de Dev container extension…).
Do you have any hints on how to fully uninstall Torizon and Dev container ?

I’ll do this on the two Ubuntu 22.04 PC I have here. (One of them is for a customer who is supposed to develop its own application based on the API I am writing. I can only hope they will never get these kind of problems…)

Best regards,
Jeroen

Hi @ompie!

The addgroup command is used to add a group to your system (please check addgroup’s manual: Ubuntu Manpage: adduser, addgroup - add a user or group to the system).

After the installation of Docker, the docker group should be created already. You should not need to create it.

Please share the output of the command id. Mine is something like this:

 $ id
uid=1000(user) gid=1000(user) groups=1000(user), . . . ,998(docker)

You should use the command usermod to add your user to Docker’s group:

usermod -a -G docker <username>

Please run the command above, check the output of id again, and check again the error of Torizon extension.

Best regards,

Hi @henrique.tx ,

uid=1001(localadmin) gid=1001(localadmin) groupes=1001(localadmin),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(kvm),120(lpadmin),131(sambashare),998(docker)

So this looks OK. After doing usermod -a -G docker <username> I got the same result on 'id':

uid=1001(localadmin) gid=1001(localadmin) groupes=1001(localadmin),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(kvm),120(lpadmin),131(sambashare),998(docker)

I tried to create a new application (via Torizon C/C++: Create C/C++ Application) but then it did not even finish the setup when I got this error (a screen shot) :

Tomorrow, I’ll uninstall everything and try to start with a fresh environment. It is getting too confused.
So, as I asked yesterday,

Do you have any hints on how to fully uninstall Torizon and Dev container ?

I’ll keep you informed about the progress.

Best regards,
Jeroen

Hi @ompie ,

Do you have any hints on how to fully uninstall Torizon and Dev container ?

If you still have some Docker images on your host machine, you can remove them by running the following commands:

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi -f $(docker images -a -q)
docker system prune

As for the extension, you can uninstall it though VSCode itself, then remove these directories:

$HOME/.moses
$HOME/.vscode
$HOME/.apollox (if you have it)

Best regards,
Lucas Akira

Hi @lucas_a.tx and @henrique.tx ,

I proceeded with the complete uninstall of the VSC extensions (docker, Dev container and toradex) and docker (plus reboot) on BOTH PCs.
Then I re-installed Docker Engine and the extensions following the steps on the Toradex installation page.

The Docker problems are gone and I’m only stuck again with the device that cannot be found when opening the remote container.

I’ll continue that subject in the original post and I’ll close this one, marking the re-installation as the “solution”

Thanks for your help,
Jeroen

Hi @ompie !

Thanks for the feedback and for marking the solution.

Let’s continue there then :slight_smile:

Best regards,