vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

Always install extensions to support mounting the home folder

Open Scherlac opened this issue 4 years ago • 14 comments

Issue type: feature request

Description

We use dev container and we mount local folder from docker host into the user's home folder inside the container (eg. '/root/`).

The file /root/.vscode-server/data/Machine/.installExtensionsMarker is created every time we start our dev container and that prohibits us to install additional extensions. In case the file exist no extension is installed to prevent altering the container.

I did not see any issue regarding extension installation so I do not understand why the .installExtensionsMarker file is not deleted during dev container startup.

Actual behavior

We need to remove the marker file with a script using the initializeCommand or the postCreateCommand to allow new extension to be installed.

Expected

The extensions shall be installed on the mounted home folder in the following case:

  • we extend the list of extensions in the .devcontainer.json (eg.: by updating the git repository),
  • we add some extension manually.

VSCode:

Version: 1.57.0 (user setup) Commit: b4c1bd0a9b03c749ea011b06c6d2676c8091a70c Date: 2021-06-09T17:18:42.354Z Electron: 12.0.9 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.18363

Original topic from a different issue

@neuromechanist It looks like /root/.vscode-server-insiders/data/Machine/.installExtensionsMarker already existed (and we therefore skipped the extension install). Did you mount anything there or a parent folder?

Originally posted by @chrmarti in https://github.com/microsoft/vscode-remote-release/issues/3975#issuecomment-723872103

Scherlac avatar Jun 20 '21 09:06 Scherlac

The last time I was checking this issue, I noticed that this marker only gets added after the extension install is complete. So, chances are that the folder already existed in the image you mounted. That's why every time I spun up the image, I would have seen this error. A way to check if this is the case for you too is to mount the image outside vscode and see if the folder exists in your image. If so, creating an image after deleting the whole .vscode-server-insiders should solve your problem.

neuromechanist avatar Jun 20 '21 11:06 neuromechanist

We always need to delete the marker on the local filesystem (that is mounted as /root/) before we start the dev container to allow new extension to be installed and after the container is started the marker is created. So no additional extension gets installed on the following start or even in case we try to add some extension manually.

Scherlac avatar Jun 21 '21 04:06 Scherlac

According to @chrmarti link

The marker file is created at the start of the extension installation. If the installation fails and you reload the window, it will not retry. That is to not block startup forever. You can then rebuild the container to retry extension installation.

Scherlac avatar Jun 21 '21 04:06 Scherlac

/root/.vscode-server-insiders contains data related to the container. Could you make that folder part of the container's own filesystem? (A Linux bind mount might be needed for that if /root is mounted on a Windows filesystem.)

chrmarti avatar Jun 21 '21 07:06 chrmarti

We would like to avoid extension installation on container rebuild but we would like to delete it (the /root/.vscode-server* folder) in case needed or keep them separate from different dev container setup.

The /root folder contains the developer's own the VS Code setting and azure, docker kubernetes authorizations for a given project. For a different project we use different dev container and so also different home folder (/root).

Yes, the host system is Windows and so is the home folder we mount under dev container as /root.

Please give me feedback to support in case more information is needed.

Scherlac avatar Jun 22 '21 08:06 Scherlac

Maybe it is important to note: that I support people in corporate environment to getting started with dev containers, many of them are not experienced with Linux environment. So they need to store there source and local setting on local system in order to trust and keep them feel confident, they don't loose there works. For me a volume would suffice.

Scherlac avatar Jun 22 '21 08:06 Scherlac

If you want to avoid extension installation on rebuild, you'll need to keep the .installExtensionsMarker file. It sounds like you want the first, but not the second?

chrmarti avatar Jun 23 '21 05:06 chrmarti

We mount the local "home" folder and if the extensions are already there no installation takes place, not even after container rebuild.

The marker file prevents the installation of new extension added to .devcontainer file after the first container startup.

What is the use case where we need this marker file?

How does the marker file work, what does it do exactly?

Scherlac avatar Jul 01 '21 09:07 Scherlac

It is meant as a marker for the container. When you mount the home folder, the marker outlives the container. We just place it there to remember that extensions have already been installed.

chrmarti avatar Jul 01 '21 12:07 chrmarti

What is the intended use of the marker file with home folder mounted to devcontainer? Can we disable it some how?

Scherlac avatar Jul 01 '21 15:07 Scherlac

There is no setting to disable it. When you have the home folder mounted, you also carry forward the extensions installed at /root/.vscode-server-insiders/extensions. You could try deleting the marker file in the devcontainer.json's "postCreateCommand".

chrmarti avatar Jul 02 '21 08:07 chrmarti

That is exactly what I tied to explain :)

We remove the marker file with a script using the initializeCommand to allow new extension to be installed. That is a workaround and I would like to get a solution for that.

Scherlac avatar Jul 06 '21 07:07 Scherlac

Would you like it to just always install the listed extensions (if they aren't installed yet)? It would not uninstall any extensions (it wouldn't know which ones).

chrmarti avatar Jul 06 '21 08:07 chrmarti

Sorry, I don't get your comment, does the following answer your question:

  • We list the needed extensions in the .devcontainer.json (included in git repository) and we may update that time to time.
  • We also add some extension manually.

Scherlac avatar Jul 07 '21 05:07 Scherlac

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

vscode-triage-bot avatar Jul 07 '21 06:07 vscode-triage-bot