Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building devcontainers in Linux/ARM64 in WSL2 #3672

Closed
jamesthurley opened this issue Sep 14, 2020 · 6 comments
Closed

Error building devcontainers in Linux/ARM64 in WSL2 #3672

jamesthurley opened this issue Sep 14, 2020 · 6 comments
Assignees
Labels
containers Issue in vscode-remote containers *question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@jamesthurley
Copy link

I'm unsure if this is the right place to report this, so apologies if I've got it wrong.

Versions

  • Local OS Version: Ubuntu 20.04 in WSL2 running on ARM64 (Surface Pro X)
  • Name of Dev Container Definition with Issue: The following devcontainer samples:
    • vscode-remote-try-dotnetcore
    • vscode-remote-try-node
    • vscode-remote-try-python

The above are just the sample repos which I've tried so far. I've also tried it on my own repo which uses an anaconda devcontainer and get the same behavior.

Issue Description

This issue is simplest to reproduce on the command line as shown below. However I get the same issue when trying to start the devcontainer in VSCode through the "Remote - WSL" with "Remote - Containers" extensions.

I'm running these commands on a Surface Pro X, with Ubuntu 20.04 running in WSL2, Docker and Git both installed in Ubuntu.

Steps to Reproduce

  1. Open a WSL prompt.
  2. git clone https://github.com/microsoft/vscode-remote-try-dotnetcore.git
  3. cd vscode-remote-try-dotnetcore
  4. cd .devcontainer
  5. docker build .

Expected behavior

Container should build successfully.

Actual Behaviour

standard_init_linux.go:211: exec user process caused "exec format error"

@jamesthurley
Copy link
Author

Full console output:

Sending build context to Docker daemon  17.92kB
Step 1/17 : ARG VARIANT="3.1-bionic"
Step 2/17 : FROM mcr.microsoft.com/dotnet/core/sdk:${VARIANT}
3.1-bionic: Pulling from dotnet/core/sdk
f08d8e2a3ba1: Pull complete
3baa9cb2483b: Pull complete
94e5ff4c0b15: Pull complete
1860925334f9: Pull complete
d5d36d7fad72: Pull complete
12347568ec46: Pull complete
20587d13ab3c: Pull complete
8d8c44c18a9b: Pull complete
000d94a04707: Pull complete
6dcbe18b7c01: Pull complete
Digest: sha256:29e3ca086b35a4548470877df8e2fbe592bfeeda1324700fd42f4a6c6ca048ba
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/sdk:3.1-bionic
 ---> 2969584954a0
Step 3/17 : ARG INSTALL_ZSH="true"
 ---> Running in 615d1e09bae2
Removing intermediate container 615d1e09bae2
 ---> 420217bdff05
Step 4/17 : ARG UPGRADE_PACKAGES="false"
 ---> Running in 842e9fb68441
Removing intermediate container 842e9fb68441
 ---> 6a567f70a10a
Step 5/17 : ARG USERNAME=vscode
 ---> Running in 284512feaa34
Removing intermediate container 284512feaa34
 ---> 1f2cbef39c94
Step 6/17 : ARG USER_UID=1000
 ---> Running in 73f0cf051bdf
Removing intermediate container 73f0cf051bdf
 ---> a391a6b4dff7
Step 7/17 : ARG USER_GID=$USER_UID
 ---> Running in d6b6a09dcc86
Removing intermediate container d6b6a09dcc86
 ---> 5fdc6c0a72f8
Step 8/17 : COPY library-scripts/common-debian.sh /tmp/library-scripts/
 ---> eaaf28c13a6f
Step 9/17 : RUN /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}"     && apt-get clean -y && rm -rf /var/lib/apt/lists/* &&  rm -rf /tmp/library-scripts
 ---> Running in f8379cff46cc
standard_init_linux.go:211: exec user process caused "exec format error"
The command '/bin/sh -c /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}"     && apt-get clean -y && rm -rf /var/lib/apt/lists/* &&  rm -rf /tmp/library-scripts' returned a non-zero code: 1

@Chuxel Chuxel transferred this issue from microsoft/vscode-dev-containers Sep 15, 2020
@Chuxel
Copy link
Member

Chuxel commented Sep 15, 2020

I am sadly lacking a device to try this on. @fiveisprime Do you have a Surface Pro X still?

These definitions are not setup for ARM devices currently, but where it is failing really doesn't have anything x86_64 specific. It could be something else.

(I also created microsoft/vscode-dev-containers#558 as a feature request for general ARM support)

@Chuxel Chuxel added containers Issue in vscode-remote containers info-needed Issue requires more information from poster labels Sep 15, 2020
@chrmarti
Copy link
Contributor

All binaries in that image are compiled for x86_64. The error indicates that it cannot run /bin/sh for that reason.

@chrmarti chrmarti self-assigned this Sep 15, 2020
@lucashernangregori
Copy link

Try changing the Dockerfile to use arm64 images instead of x64 ones.
In line 3 change:

FROM mcr.microsoft.com/dotnet/core/sdk:${VARIANT}

to

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster-arm64v8

You can see the tags of the images provided by Microsoft on:
https://hub.docker.com/_/microsoft-dotnet-core-sdk/
https://hub.docker.com/_/microsoft-dotnet-core-aspnet/

I hope that helps

@chrmarti
Copy link
Contributor

Wasn't aware we already have them. Thanks @lucashernangregori.

Closing.

@chrmarti chrmarti added *question Issue represents a question, should be posted to StackOverflow (VS Code) and removed info-needed Issue requires more information from poster labels Sep 16, 2020
@jamesthurley
Copy link
Author

Thanks everyone, that makes sense that I'd need to change the base image on a case by case basis.

The fact that everything from .NET to Node to Python devcontainers failed in the exact same way made me think there might be a common solution, but I see now that they were just all failing trying to execute sh.

Looking at the docs, I should be able to rig something up referencing an environment variable in the build.args section of the devcontainer.json to automatically select either the arm64 or x64 base image depending on which computer I open the project on.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers *question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants