project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.49k stars 2.01k forks source link

[VSCode ] Failed to open devcontainer #36214

Open FergusHuang opened 3 weeks ago

FergusHuang commented 3 weeks ago

Reproduction steps

VSCode failed to open the latest master version project in the devcontainer. remoteContainers-2024-10-23T03-17-51.605Z.log

Platform

vscode

Platform Version(s)

master

Type

Manually tested with SDK

(Optional) If manually tested please explain why this is only manually tested

No response

Anything else?

Error log: groupadd: GID '1000' already exists I checked the base image(chip-build-vscode) for tag 74, and it does contain the group with GID 1000. However, the image for tag 22 does not include this group. So that is the reason that triggered the issue.

andy31415 commented 2 weeks ago

@FergusHuang could you create a PR to fix this?

This seems to be from https://github.com/project-chip/connectedhomeip/blob/master/.devcontainer/Dockerfile#L43 so if these user/groups already exist we could increase their IDs at https://github.com/project-chip/connectedhomeip/blob/master/.devcontainer/Dockerfile#L22

FergusHuang commented 2 weeks ago

I tried to change UID to 1001 by passing uid option to build.sh. But that will bring some permission issues. First of all, for the folders like out/ or .devcontainer/ which need to be written by VSCode, these folders were created by UID 1000, so UID 1001 will fail to write to them. We can at least add UID 1001 to GID 1000 to solve this issue. Hower, in another case I found some files only have READ permission for the owner group is as below: -rw-r--r-- 1 ubuntu ubuntu 856 Aug 2 12:29 /workspaces/connectedhomeip/build_overrides/pigweed_environment.gni This kind of situation is more annoying because you have to check all the files in the project. In summary, I believe the simplest solution is to remove GID/UID 1000 from the base image. Or could you provide a better solution? @andy31415