zibidigonzales
zibidigonzales

Reputation: 597

VSCode Remote WSL Downloading Server Every Time

enter image description here

Every time I open Remote WSL, it downloads server. Even after download is completed, when I open VSCode and Remote WSL again, it starts downloading again. How to solve this so that it doesn't download server every time?

Upvotes: 37

Views: 12535

Answers (3)

Aspirant Zhang
Aspirant Zhang

Reputation: 31

Following my initial response, a fellow community member, @Arcsector, has suggested an insightful alternative that I find to be an excellent addition to the discussion:

You can do this, or just run code --help in WSL 2 and it will manually udpate as well - I have this on a crontab for the beginning and end of the day.


My initial response:

I believe that updating it would be a good solution. I'll provide a method for updating it.

enter image description here

  1. Click on the prompt in the bottom right corner of VSCode.
  2. Find the hash, which is the part after .vscode-server/bin/.
  3. Access the WSL Linux where the VSCode Server is located by using the "Windows Terminal", searching for Linux in the Start Menu, or executing wsl.exe -d <name_of_the_distribution> in the Command Line. I've written a script (you can find it below). Run it and enter the hash you obtained above.
  4. If the update speed is bearable, please wait for it to complete. After it's finished, reopen VSCode and you'll find that everything has been resolved.
  5. If it's still too slow, you might need to add a proxy. Try proxying the domain *.vo.msecnd.net to see if it improves the download speed. You can refer to the steps in the script for debugging.

VSCode Server Manual Update Script (WSL) https://gist.github.com/aspirantzhang/fb096e58f9386fdb886c0539f831c581

#!/bin/bash

echo "Enter commit hash:"
read hash

mkdir -p /root/temp
cd /root/temp
wget https://update.code.visualstudio.com/commit:$hash/server-linux-x64/stable -O vscode-server-linux-x64.tar.gz
tar zxvf vscode-server-linux-x64.tar.gz
rm -rf  ~/.vscode-server/bin/*
mv vscode-server-linux-x64 ~/.vscode-server/bin/
mv ~/.vscode-server/bin/vscode-server-linux-x64 ~/.vscode-server/bin/$hash
rm -rf /root/temp

echo -e "\033[32mVSCode Server Update Processing Complete.\033[0m"

Upvotes: 1

Shayan
Shayan

Reputation: 858

In my case, VSCode usually hangs on "Downloading VSCode server" due to poor network connectivity. I don't know of any way to make it not update VSCode server every time you connect to it remotely, but that would be a nice feature for developers to consider. But if you're stuck on "Downloading VSCode server", you don't have to restart your system. You can kill the wget process that VSCode is running to update VSCode server: ps -aux | grep -i vs shows:

root       18838  0.0  0.0  16500  9548 ?        S    10:24   0:00 wget --tries=1 --connect-timeout=7 --dns-timeout=7 -nv -O vscode-server.tar.gz https://update.code.visualstudio.com/commit:b3e4e68a0bc097f0ae7907b217c1119af9e03435/server-linux-x64/stable

sudo kill -9 18838 And you can try connecting to it again. Note that closing the remote connection and reconnecting doesn't help alleviate the issue, it will even fail to connect to VSCode, you should kill the wget process as I've stated above.

Upvotes: 1

Mitch M
Mitch M

Reputation: 468

I experienced the same. It should finish on its own and open the project folder on wsl, but it got stuck on it for quite some time. I restarted my pc and reopened vs code. It started the download again but finished much faster than the first time.

Upvotes: 0

Related Questions