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

VSCode and Remote-Containers fail #42

Closed
SergeiSOficial opened this issue Apr 20, 2022 · 11 comments
Closed

VSCode and Remote-Containers fail #42

SergeiSOficial opened this issue Apr 20, 2022 · 11 comments
Labels
bug Something isn't working

Comments

@SergeiSOficial
Copy link

Version

0.6.0

What steps are needed to reproduce the behavior?

Microsoft Windows [Version 10.0.19044.1586]
WSL2
Docker version 20.10.14, build a224086

  1. Install VSCode 1.66.2
  2. Install Remote-Containers plugin 0.231.6

DockerFile
FROM mcr.microsoft.com/vscode/devcontainers/base:0-bionic

devcontainer.json
{ /"name": "Ubuntu", "build": { "dockerfile": "Dockerfile", "args": { "VARIANT": "bionic" } }, "settings": {}, }

What you expected?

I want connect to remote container with stevedore, but there is error

What happened?

Log
`[53 ms] Remote-Containers 0.231.6 in VS Code 1.66.2 (dfd34e8260c270da74b5c2d86d61aee4b6d56977).
[53 ms] Start: Resolving Remote
[63 ms] Setting up container for folder or workspace: c:\worspace\project\Firmware\project.code-workspace
[66 ms] Start: Check Docker is running
[66 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[6963 ms] Server API version: 1.41
[6963 ms] Start: Run: docker volume ls -q
[10335 ms] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\worspace\project\Firmware --filter label=vsch.quality=stable
[12965 ms] Start: Run: C:\Program Files\Microsoft VS Code\Code.exe c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder c:\worspace\project\Firmware --workspace-mount-consistency cached --id-label vsch.local.folder=c:\worspace\project\Firmware --id-label vsch.quality=stable --log-level debug --config c:\worspace\project\Firmware.devcontainer\devcontainer.json --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true --terminal-columns 215 --terminal-rows 12
[13172 ms] remote-containers 0.231.6.
[13172 ms] Start: Resolving Remote
[13176 ms] Start: Run: git rev-parse --show-cdup
[17458 ms] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\worspace\project\Firmware --filter label=vsch.quality=stable
[20280 ms] Start: Run: docker build -f c:\worspace\project\Firmware.devcontainer\Dockerfile -t vsc-firmware-ddb69664cfc4183dc0361ff9237ce6d0 --build-arg VARIANT=bionic c:\worspace\project\Firmware.devcontainer
Sending build context to Docker daemon 27.65kB
Step 1/2 : ARG VARIANT="bionic"
Step 2/2 : FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
---> c7f208b9964f
Successfully built c7f208b9964f
Successfully tagged vsc-firmware-ddb69664cfc4183dc0361ff9237ce6d0:latest

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[29357 ms] Start: Run: docker events --format {{json .}} --filter event=start
[29445 ms] Start: Starting container
[29445 ms] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=c:\worspace\project,target=/workspaces/project,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l vsch.local.folder=c:\worspace\project\Firmware -l vsch.quality=stable --entrypoint /bin/sh vsc-firmware-ddb69664cfc4183dc0361ff9237ce6d0 -c echo Container started
docker: Error response from daemon: failed to start service utility VM (createreadwrite): kernel 'C:\Program Files\Linux Containers\kernel' not found.
See 'docker run --help'.
[32162 ms] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\worspace\project\Firmware --filter label=vsch.quality=stable
[34758 ms] Error: Command failed: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=c:\worspace\project,target=/workspaces/project,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l vsch.local.folder=c:\worspace\project\Firmware -l vsch.quality=stable --entrypoint /bin/sh vsc-firmware-ddb69664cfc4183dc0361ff9237ce6d0 -c echo Container started
[34758 ms] trap "exit 0" 15
[34758 ms] exec "$@"
[34758 ms] while sleep 1 & wait $!; do :; done -
[34758 ms] at bR (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:219:986)
[34758 ms] at Hw (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:219:924)
[34758 ms] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[34759 ms] at async IR (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:224:2024)
[34759 ms] at async Xw (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:224:3221)
[34759 ms] at async kR (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:224:13925)
[34759 ms] at async TR (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:224:13650)
[34793 ms] Exit code 1
[34794 ms] Command failed: C:\Program Files\Microsoft VS Code\Code.exe c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder c:\worspace\project\Firmware --workspace-mount-consistency cached --id-label vsch.local.folder=c:\worspace\project\Firmware --id-label vsch.quality=stable --log-level debug --config c:\worspace\project\Firmware.devcontainer\devcontainer.json --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true --terminal-columns 215 --terminal-rows 12
[34794 ms] Exit code 1
`

Additional context

No response

@SergeiSOficial SergeiSOficial added the bug Something isn't working label Apr 20, 2022
@slonopotamus
Copy link
Owner

docker: Error response from daemon: failed to start service utility VM (createreadwrite): kernel 'C:\Program Files\Linux Containers\kernel' not found.

I see two issues here:

  1. Most likely Stevedore tray app is not running. It should auto-start after system reboot. If it doesn't, try using Stevedore app in Start menu
  2. Because of previous issue, Docker fallbacks to LCOW, which in turn fails to find C:\Program Files\Linux Containers\kernel. I'm not yet sure why it tries to use that path at all (for me, LCOW works even though I don't have that file). There are similar issues (Docker failed to start service utility VM with LCOW on windows server 2019 docker/labs#490, for example), but without any clear way to fix. Needs more investigation.

@SergeiSOficial
Copy link
Author

  1. Docker and Stevedore are started and, for example, download containers
  2. I try to check solution, thanks

@slonopotamus
Copy link
Owner

One more thing. Could you please check what docker context VSCode uses? It is supposed to be desktop-linux.

image

@SergeiSOficial
Copy link
Author

  1. Solution not helped to me

3)Context is desktop-linux
Still error
`..........
Successfully built 987862fd2765
Successfully tagged vsc-firmware-ddb69664cfc4183dc0361ff9237ce6d0:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double chec
k and reset permissions for sensitive files and directories.

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[2405259 ms] Start: Run: docker events --format {{json .}} --filter event=start
[2405366 ms] Start: Starting container
[2405367 ms] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=c:\worspace\project,target=/workspaces/project,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l vsch.local.folder=c:\worspace\project\Firmware -l vsch.quality=stable --entrypoint /bin/sh vsc-firmware-ddb69664cfc4183dc0361ff9237ce6d0 -c echo Container started
docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: 'c:/worspace/project' mount path must be absolute.
See 'docker run --help'.
[2408898 ms] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\worspace\project\Firmware --filter label=vsch.quality=stable
[2411909 ms] Error: Command failed: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=c:\worspace\project,target=/workspaces/project,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l vsch.local.folder=c:\worspace\project\Firmware -l vsch.quality=stable --entrypoint /bin/sh vsc-firmware-ddb69664cfc4183dc0361ff9237ce6d0 -c echo Container started
[2411909 ms] trap "exit 0" 15
[2411910 ms] exec "$@"
[2411910 ms] while sleep 1 & wait $!; do :; done -
[2411910 ms] at bR (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:219:986)
[2411910 ms] at Hw (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:219:924)
[2411910 ms] at runMicrotasks ()
[2411910 ms] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2411910 ms] at async IR (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:224:2024)
[2411910 ms] at async Xw (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:224:3221)
[2411910 ms] at async kR (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:224:13925)
[2411910 ms] at async TR (c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js:224:13650)
[2411953 ms] Exit code 1
[2411969 ms] Command failed: C:\Program Files\Microsoft VS Code\Code.exe c:\Users\user.vscode\extensions\ms-vscode-remote.remote-containers-0.231.6\dist\spec-node\devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder c:\worspace\project\Firmware --workspace-mount-consistency cached --id-label vsch.local.folder=c:\worspace\project\Firmware --id-label vsch.quality=stable --log-level debug --config c:\worspace\project\Firmware.devcontainer\devcontainer.json --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true --terminal-columns 215 --terminal-rows 12
[2411969 ms] Exit code 1`

@andrei-markeev
Copy link

I think I am experiencing same error as @SergeiSOficial:
[2022-04-22T21:06:49.515Z] docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: 'c:/my/Projects/ngx_http_jwted_module' mount path must be absolute

@andrei-markeev
Copy link

andrei-markeev commented Apr 22, 2022

Ok I found microsoft/vscode-remote-release#509 and was able to resolve the issue by specifying the workspaceMount parameter explicitly, changing Windows-style path c:/my/Projects/ngx_http_jwted_module to /mnt/c/Projects/ngx_http_jwted_module.

So essentially, I added this line in devcontainer.json:

"workspaceMount": "type=bind,source=/mnt/c/my/Projects/ngx_http_jwted_module,target=/workspaces/ngx_http_jwted_module,consistency=cached"

Everything seems to work now 🎉

Maybe good to mention somewhere in the docs, because this didn't happen in Docker Desktop, so I guess many people will hit it and think that stevedore is to blame...

@slonopotamus
Copy link
Owner

was able to resolve the issue by specifying the workspaceMount parameter explicitly, changing Windows-style path c:/my/Projects/ngx_http_jwted_module to /mnt/c/Projects/ngx_http_jwted_module.

This should be fixed in just-released Stevedore 0.6.1, so Windows-style path should also work. Feel free to comment if issue still persists. Note that it will take some time to publish release (especially on WinGet where it goes through manual moderation process).

@andrei-markeev
Copy link

Thanks Marat, appreciate the fix 👍 I'll try it out.

@andrei-markeev
Copy link

andrei-markeev commented May 7, 2022

Sorry, took me some time to verify the fix, but unfortunately, it still doesn't work in 0.6.1. I double-checked that Stevedore was updated. docker-wsl-proxy.exe creation time is 25.04.2022 and I also rebooted the computer just in case 😄

As soon as I comment out the "workspaceMount" line, it fails again with same error as before:

[2022-05-07T17:02:30.902Z] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=c:\my\Projects\ngx_http_jwted_module,target=/workspaces/ngx_http_jwted_module,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l vsch.local.folder=c:\my\Projects\ngx_http_jwted_module -l vsch.quality=stable --entrypoint /bin/sh vsc-ngx_http_jwted_module-1bd9d58c334ea40c37438f82e31fd112 -c echo Container started
[2022-05-07T17:02:31.299Z] 
[2022-05-07T17:02:31.332Z] docker: Error response from daemon: invalid mount config for type "bind": invali
d mount path: 'c:/my/Projects/ngx_http_jwted_module' mount path must be absolute

@slonopotamus slonopotamus reopened this May 8, 2022
@kotx
Copy link

kotx commented Jun 29, 2022

docker: Error response from daemon: failed to start service utility VM (createreadwrite): kernel 'C:\Program Files\Linux Containers\kernel' not found.

I'm getting this error when trying to use flyctl deploy --local-only, but docker run ... works from the Terminal just fine.
Trying to open something with Remote-Containers also caused this (a different error?): remoteContainers-2022-06-29T23-25-03.654Z.log

This is on stevedore 0.7.0, with both windows and linux containers features installed (with hyper-v too).

@slonopotamus
Copy link
Owner

Stevedore is no longer providing support for Linux containers. See why. I recommend switching to Rancher Desktop, Container Desktop or Colima.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants