microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.61k stars 29.41k forks source link

Can no longer install VS Code Server on machines that have no internet access #231029

Open ejkitchen opened 1 month ago

ejkitchen commented 1 month ago

Does this issue occur when all extensions are disabled?: Yes/No

Steps to Reproduce:

  1. Download VS Code for Windows and required VSIX extensions.
  2. Transfer files to an offline machine and install them.
  3. The installation completes successfully.
  4. VS Code attempts to download the VS Code server, which fails due to the lack of internet access.

In previous versions, it was possible to download the VS Code server using a specific URL (e.g., https://update.code.visualstudio.com/commit:...) and deploy it manually on remote machines. However, this no longer works in the current version due to changes in how the VS Code server is deployed.

The new directory structure is significantly different:

drwxrwxr-x  5 ubuntu ubuntu 4.0K Oct 10 15:21 .
drwxr-x--- 12 ubuntu ubuntu 4.0K Oct 10 15:27 ..
-rw-rw-r--  1 ubuntu ubuntu  731 Oct 10 15:21 .cli.384ff7382de624fb94dbaf6da11977bba1ecd427.log
drwxrwxr-x  3 ubuntu ubuntu 4.0K Oct 10 15:21 cli
-rwxrwxr-x  1 ubuntu ubuntu  22M Oct  9 16:15 code-384ff7382de624fb94dbaf6da11977bba1ecd427
drwx------  6 ubuntu ubuntu 4.0K Oct 10 15:21 data
drwx------  2 ubuntu ubuntu 4.0K Oct 10 15:21 extensions

This is inconsistent with previous versions, and I’ve also noticed a different structure in WSL (there is a legacy mode flag now)

There should be clear instructions for users in offline environments on how to manually deploy the VS Code server, especially since the server tarball downloaded manually is identical to the one VS Code tries to retrieve during installation.

Can we get official documentation or a solution for deploying VS Code server on machines without internet access? The previously suggested method from StackOverflow no longer works, and I need guidance for how to do this.

What would be even better is stop downloading VS Code server repeatedly. You should save it locally once and only once for a commit ID and you should simply store the .tar.gz AS IS in C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin. That way when we need to deploy remotely, we can just place the server file in that directory.

luyufan498 commented 1 month ago

Finally found someone who memtioned it. I tried 10 more times and failled ! the cli folder will be cleaned during connection, even if the file was already there.

We do need a guidance !!!

PatrickMiron commented 1 month ago

We really need this to work. We have alot of code depending on this.

Please expediate this issue!

Cheers!

ejkitchen commented 1 month ago

So I wrote a new installer for VS Code Server and I have everything working except for the file " code-384ff7382de624fb94dbaf6da11977bba1ecd427" VS Code installs here:

total 22M
drwxrwxr-x 5 4.0K Oct 14 08:08 .
drwxr-xr-x 4 4.0K Oct 14 08:10 ..
drwxrwxr-x 3 4.0K Oct 14 08:08 cli
-rw-rw-r-- 1  731 Oct 14 08:08 .cli.384ff7382de624fb94dbaf6da11977bba1ecd427.log
-rwxrwxr-x 1  22M Oct  9 12:15 code-384ff7382de624fb94dbaf6da11977bba1ecd427
drwx------ 6 4.0K Oct 14 08:08 data
drwx------ 2 4.0K Oct 14 08:08 extensions

Now, this is an executable of about 22 MB, and it's the code server binary.

file code-384ff7382de624fb94dbaf6da11977bba1ecd427
code-384ff7382de624fb94dbaf6da11977bba1ecd427: 
ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, BuildID[sha1]=6f79a1f7b0035c0458988eb636645afe92c45ecf, stripped

This is the only file causing me a bit of grief because out of 1326 files in the tar.gz that I downloaded from the update site, I was able to match 1321 files. These 5 files have no equivalent in the tar file:

main -> VS Code server folder has 1326 files and 459 directories.
main -> VS Code tar file has 1321 files and 442 directories.
main -> Number of matching files: 1321
main -> Number of unmatched files: 5
main -> 1: 'cli/servers/lru.json' - Size in tar: N/A, Size in .vscode-server: 51, File not found in tar.
main -> 2: 'code-384ff7382de624fb94dbaf6da11977bba1ecd427' - Size in tar: N/A, Size in .vscode-server: 22070072, File not found in tar.
main -> 3: 'data/User/globalStorage/storage.json' - Size in tar: N/A, Size in .vscode-server: 172, File not found in tar.
main -> 4: 'data/machineid' - Size in tar: N/A, Size in .vscode-server: 36, File not found in tar.
main -> 5: 'extensions/extensions.json' - Size in tar: N/A, Size in .vscode-server: 2, File not found in tar.

It's very easy for me to recreate all the files above except for code-384ff7382de624fb94dbaf6da11977bba1ecd427

I also did this in both the tar extract and .vscode-server find . -type f -exec file {} + | grep "ELF"

And as expected all binary executables that are common are identical and accounted for except for: code-384ff7382de624fb94dbaf6da11977bba1ecd427

I also extracted the build id for code-384ff7382de624fb94dbaf6da11977bba1ecd427

Search for the build ID in the tar file:
> find /vscode-server-linux-x64 -type f -exec sh -c 'readelf -n "$1" 2>/dev/null | grep -q "Build ID: 6f79a1f7b0035c0458988eb636645afe92c45ecf" && echo "$1"' _ {} ;
No results

Search for the build ID in the .vscode-server folder:
> find /.vscode-server -type f -exec sh -c 'readelf -n "$1" 2>/dev/null | grep -q "Build ID: 6f79a1f7b0035c0458988eb636645afe92c45ecf" && echo "$1"' _ {} \;
/.vscode-server/code-384ff7382de624fb94dbaf6da11977bba1ecd427

And as expected, there are no matches. I also searched for partial matches of the build id to no avail.

I also looked in this file:

> cat .cli.384ff7382de624fb94dbaf6da11977bba1ecd427.log
Listening on 127.0.0.1:40895
[2024-10-14 12:08:09] info Disposed of connection to running server.
looking for token a036603f-5586-4e90-8537-27ad098391d6, got Some("a036603f-5586-4e90-8537-27ad098391d6")
[2024-10-14 12:08:09] info Checking /home/ubuntu/.vscode-server/cli/servers/Stable-384ff7382de624fb94dbaf6da11977bba1ecd427/log.txt and /home/ubuntu/.vscode-server/cli/servers/Stable-384ff7382de624fb94dbaf6da11977bba1ecd427/pid.txt for a running server...
[2024-10-14 12:08:09] info Downloading Visual Studio Code server -> /tmp/.tmpiZaMPh/vscode-server-linux-x64.tar.gz
[2024-10-14 12:08:11] info Starting server...
[2024-10-14 12:08:11] info Server started
[2024-10-14 12:08:15] info Disposed of connection to running server.

But I don't see anything unusual in there, and it appears to be downloading the same tar file I am downloading.

I am not familiar with Node at all. Does anyone else have ideas?

zachNA2 commented 1 month ago

Can anyone help with this? I need this to work as well!

lnodaba commented 1 month ago

@alexdima any ideas by when could we expect some answer/fix on this? I'm in the same situation.

lly0571 commented 4 days ago

You need to download vscode_cli_alpine_x64_cli.tar.gz and extract the code file in the zipped file as code-{commit_id} https://vscode.download.prss.microsoft.com/dbazure/download/stable/{commit_id}/vscode_cli_alpine_x64_cli.tar.gz

Then, place the previous vscode-server-linux-x64 in cli/servers/Stable-{commit_id}/server. You can download it from: https://vscode.download.prss.microsoft.com/dbazure/download/stable/{commit_id}/vscode-server-linux-x64.tar.gz

A minimized dir structure may like this:

.vscode-server tree -L 4
.
├── bin
│   ├── fix.sh
│   └── vscode-server-linux-x64.tar.gz
├── cli
│   └── servers
│       └── Stable-f1a4fb101478ce6ec82fe9627c43efbf9e98c813
│           ├── log.txt
│           ├── pid.txt
│           └── server
├── code-f1a4fb101478ce6ec82fe9627c43efbf9e98c813
├── data
│   ├── CachedProfilesData
│   │   └── __default__profile__
│   │       ├── extensions.builtin.cache
│   │       └── extensions.user.cache
│   ├── logs
│   │   └── 20241118T143757
│   │       ├── exthost1
│   │       ├── ptyhost.log
│   │       └── remoteagent.log
│   ├── Machine
│   ├── machineid
│   └── User
│       ├── globalStorage
│       └── History
└── extensions
    └── extensions.json