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

Extension are not installed when configured in devcontainer.json #5620

Open
zioalex opened this issue Sep 22, 2021 · 5 comments
Open

Extension are not installed when configured in devcontainer.json #5620

zioalex opened this issue Sep 22, 2021 · 5 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality proxy Issues regarding network proxies
Milestone

Comments

@zioalex
Copy link

zioalex commented Sep 22, 2021

  • VSCode Version: 1.53.1
  • Local OS Version: Windows 10
  • Remote OS Version: Ubuntu:focal - official Microsoft container
  • Remote Extension/Connection Type: Docker
  • Logs:
    During the built phase:
53980 ms] Start: Run in container: test -d /home/vscode/.vscode-server/extensionsCache && ls /home/vscode/.vscode-server/extensionsCache || true
[53986 ms] 
[53986 ms] 
[53987 ms] Start: Run in container: test -d /vscode/vscode-server/extensionsCache && ls /vscode/vscode-server/extensionsCache || true
[53990 ms] 
[53991 ms] 
[53992 ms] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr "
[54085 ms] Start: Starting VS Code Server
[54086 ms] Start: Run in container: /home/vscode/.vscode-server/bin/5d424b828ada08e1eb9f95d6cb41120234ef57c7/server.sh --force-disable-user-env --use-host-proxy --port 0 --extensions-download-dir /home/vscode/.vscode-server/extensionsCache --install-extension ms-vscode.azure-account --install-extension ms-kubernetes-tools.vscode-aks-tools --install-extension ms-azure-devops.azure-pipelines --install-extension tomaustin.azure-devops-yaml-pipeline-validator --install-extension ms-azuretools.vscode-azureterraform --install-extension rogalmic.bash-debug --install-extension mindaro.mindaro --install-extension adamvoss.vscode-languagetool-en --install-extension waderyan.gitblame --install-extension donjayamanne.git-extension-pack --install-extension donjayamanne.githistory --install-extension codezombiech.gitignore --install-extension eamodio.gitlens --install-extension hashicorp.terraform --install-extension ms-kubernetes-tools.vscode-kubernetes-tools --install-extension ipedrazas.kubernetes-snippets --install-extension adamvoss.vscode-languagetool --install-extension yzhang.markdown-all-in-one --install-extension bierner.markdown-mermaid --install-extension timonwong.shellcheck --start-server
[55031 ms] 

So apparently no error occurs, but no extension is installed. I checked Inside the container

$ ls -al /home/vscode/.vscode-server/extensions/
total 8
drwxr-xr-x 2 vscode vscode 4096 Sep 22 07:31 .
drwxr-xr-x 5 vscode vscode 4096 Sep 22 07:31 ..

But from the logs I see that a different dir is checked /home/vscode/.vscode-server/extensionsCache or /vscode/vscode-server/extensionsCache. Neither of them exists
Steps to Reproduce:

  1. Rebuild the container
  2. The extension are not installed
  3. But manually I can install them inside the container
ls -al /home/vscode/.vscode-server/extensions/
total 12
drwxr-xr-x 3 vscode vscode 4096 Sep 22 07:38 .
drwxr-xr-x 5 vscode vscode 4096 Sep 22 07:31 ..
drwxr-xr-x 6 vscode vscode 4096 Sep 22 07:38 ms-vscode.azure-account-0.9.8

Does this issue occur when you try this locally?: No
Does this issue occur when you try this locally and all extensions are disabled?: Yes

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Sep 22, 2021
@zioalex
Copy link
Author

zioalex commented Sep 22, 2021

I found the problem.
Looking into the Log (Extension Host)
I see a lot of "unable to get local issuer certificate" errors.
Weird enough no errors are logged in the Build container process.

The script server.sh use node to download the extensions and by default node doesn't use the ssl configured certificates.

#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#

case "$1" in
        --inspect*) INSPECT="$1"; shift;;
esac

ROOT="$(dirname "$0")"
"$ROOT/node" ${INSPECT:-} "$ROOT/out/vs/server/main.js" "$@"

I found two ways to solve it:
The first is to export the variable NODE_EXTRA_CA_CERTS=$PATH_TO_YOUR_CUSTOM_CA_FILE.pem pointing to your custom CA_FILE
The second update the server.sh to run node with the option --use-openssl-ca .

"$ROOT/node" --use-openssl-ca ${INSPECT:-} "$ROOT/out/vs/server/main.js" "$@"

This assumes that you already configured your ssl certificate with something like:

RUN wget -qP /usr/local/share/ca-certificates http://your_local_cert/local_ca.pem\
    && update-ca-certificates

After either one of the above the extensions are installed correctly:

334360 ms] Start: Starting VS Code Server
[334362 ms] Start: Run in container: /home/vscode/.vscode-server/bin/5d424b828ada08e1eb9f95d6cb41120234ef57c7/server.sh --force-disable-user-env --use-host-proxy --port 0 --extensions-download-dir /home/vscode/.vscode-server/extensionsCache --install-extension ms-vscode.azure-account --install-extension ms-kubernetes-tools.vscode-aks-tools --install-extension ms-azure-devops.azure-pipelines --install-extension tomaustin.azure-devops-yaml-pipeline-validator --install-extension ms-azuretools.vscode-azureterraform --install-extension rogalmic.bash-debug --install-extension mindaro.mindaro --install-extension adamvoss.vscode-languagetool-en --install-extension waderyan.gitblame --install-extension donjayamanne.githistory --install-extension codezombiech.gitignore --install-extension eamodio.gitlens --install-extension hashicorp.terraform --install-extension ms-kubernetes-tools.vscode-kubernetes-tools --install-extension ipedrazas.kubernetes-snippets --install-extension adamvoss.vscode-languagetool --install-extension yzhang.markdown-all-in-one --install-extension bierner.markdown-mermaid --install-extension timonwong.shellcheck --start-server
[336097 ms] 

*
* Visual Studio Code Server
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license https://aka.ms/vscode-remote/license
*

Extension host agent listening on 38415

[336098 ms] Start: Run in container: echo 38415 >/home/vscode/.vscode-server/data/Machine/.devport
[336102 ms] 
[336102 ms] 
[336106 ms] Forwarding local port 38415 to container port 38415
[336844 ms] Start: Run: docker exec -i -u vscode -e VSCODE_REMOTE_CONTAINERS_SESSION=617e1772-ed15-48c4-82d6-088f94d875191632300493950 a5b449b2383414ef3e3053365912db7b02f79f255db85f6846c0dd07828e31f9 /home/vscode/.vscode-server/bin/5d424b828ada08e1eb9f95d6cb41120234ef57c7/node -e 
[336851 ms] [08:53:54] Extension host agent started.
[336851 ms] Installing extensions...
[340055 ms] Installing extension 'ms-azuretools.vscode-azureterraform' v0.3.2...
[340242 ms] Installing extension 'mindaro.mindaro' v1.0.120210803...
Installing extension 'ipedrazas.kubernetes-snippets' v0.1.9...
[340242 ms] Installing extension 'bierner.markdown-mermaid' v1.12.1...
[340243 ms] Installing extension 'hashicorp.terraform' v2.14.0...

@chrmarti
Copy link
Contributor

Related: #986

@chrmarti chrmarti added the feature-request Request for new features or functionality label Sep 27, 2021
@chrmarti chrmarti added this to the Backlog milestone Sep 27, 2021
@Kiolali
Copy link

Kiolali commented Oct 1, 2021

I have the same problem with VS Code 1.60.2 (Remote - Containers v0.194.3), Windows 10.
But I do not get any certifcate errors. Instead I see in the extension host logs the following:

[exthost] [error] ProxyResolver#resolveProxy Canceled: Canceled
    at Object.n [as canceled] (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:5:1157)
    at i._remoteCall (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:98:13617)
    at Proxy.N.<computed>.G.charCodeAt.N.<computed> (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:98:10012)
    at y.resolveProxy (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:98:38938)
    at Object.resolveProxy (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:103:57892)
    at useProxySettings (c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\vscode-proxy-agent\out\index.js:159:16)
    at c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\vscode-proxy-agent\out\index.js:107:13
    at c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\vscode-proxy-agent\out\index.js:335:13
    at processTicksAndRejections (internal/process/task_queues.js:93:5) 

It happens for me and some of my students using Windows 10 when connected to eduroam Wifi. In my Wifi at home after rebuilding the container it works as expected: all the extensions defined in devcontainer.sjon are installed.
So it must have something to do with eduroam (enterprise wifi?).

Any ideas what we could do?

edit: the problem only appears for some Windows 10 Laptops, not every Windows 10 Laptop is affected. We didn't notice those problems with Ubuntu Laptops.

@Kiolali
Copy link

Kiolali commented Oct 4, 2021

I'll open a new issue, because maybee my issue has nothing to do with self signed certificates

@JackCaster
Copy link

JackCaster commented Feb 2, 2022

I encountered the same issue. Extensions are not installed during the build process but I can install them without problems via the GUI afterwards. Running the server.sh script as in the log raises the error unable to get local issuer certificate (not reported in the remote logs as OP mentioned).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality proxy Issues regarding network proxies
Projects
None yet
Development

No branches or pull requests

4 participants