Repository: vscode
Issue: Fail to install Visual Studio Code Server on Ubuntu Server VM
Labels: install-update,linux,server


Type: <b>Bug</b>

Hello,

I am trying to setup a remote connection to the Ubuntu Server VM on a VirtualBox but everytime I connect to it, it shows the "install" task but stays stuck and implicitly fails. Idk I'm a noob at linux and life (TM). Maybe it's because the VSC is serving on loopback instead of the host-only ethernet adapter? 

The "install task" when ran on "code --disable-extensions": 
```bash
C:\WINDOWS\System32\cmd.exe '/c (type "C:\Users\Username\AppData\Local\Temp\vscode-linux-multi-line-command-192.168.56.102-948447955.sh" | "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 51873 "192.168.56.102" bash) & exit /b 0').

The following extensions have contributed to this terminal's environment:

Git: Enables the following features: git auth provider
```

Steps to reproduce:
1) Download Ubuntu Server 22.04.3 LTS from ubuntu.com/download/server
2) Download and setup Oracle VirtualBox 7.0.14 for Windows hosts on a Windows 11 machine. 
2a) If Python is not installed, install Python 3.10 (anything about Python 2 should suffice).
2b) Run Terminal as administrator, execute "pip install pywin32" (a requirement for VirtualBox 7.0.14)
3) Create a VM with VirtualBox to your liking EXCEPT change Adapter 1 to "Host-only Adapter" with "VirtualBox Host-Only Ethernet Adapter". Disable all other adapters, if any.
4) Go to Tools, Host-only Networks, click on the DHCP Server, and just change the Lower/Upper Address Bound to the same value (ie: 192.168.56.102).
5) Connect to the VM, do setup. Login (do not skip login!)
6) Get the IP address of the ethernet by typing "ip a", look for "enp0s3" and get the ip address beside "inet". 
Example:
```bash
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:58:03:af brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.102/24 metric 100 brd 192.168.56.255 scope global dynamic enp0s3                    <-- EMPHASIS HERE!!!!
       valid_lft 350sec preferred_lft 350sec
```
7) Open Visual Studio Code on Host (Windows), on bottom-right click on blue shell button, Connect to Host. Type `ssh -p 22 <username>@[ip from step 6]`.
For me: `ssh -p 22 siblount@192.168.56.102`
8) Login and observe.

The "install" task will pop up twice after logging into the first "install" task. Both will find existing installation at /home/siblount/.vscode-server/bin/... but will not do anything afterwards.

First "install" task log:

```bash
siblount@192.168.56.102's password:
27ed24ff981d: running
Acquiring lock on /home/siblount/.vscode-server/bin/8b3775030ed1a69b13e4f4c628c612102e30a681/vscode-remote-lock.siblount.8b3775030ed1a69b13e4f4c628c612102e30a681
Found existing installation at /home/siblount/.vscode-server/bin/8b3775030ed1a69b13e4f4c628c612102e30a681...
Checking /home/siblount/.vscode-server/.8b3775030ed1a69b13e4f4c628c612102e30a681.log and /home/siblount/.vscode-server/.8b3775030ed1a69b13e4f4c628c612102e30a681.pid for a running server
Looking for server with pid: 2773
Found running server...
 
*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
 
Checking server status on port 45901 with wget
27ed24ff981d: start
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==45901==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==9ffd7918-3e9a-4aa4-b104-73593e655945==
27ed24ff981d: end
```

Second install task log:

```bash
siblount@192.168.56.102's password:
db0987102fca: running
Found existing installation at /home/siblount/.vscode-server...
Running ssh connection command... /home/siblount/.vscode-server/code-8b3775030ed1a69b13e4f4c628c612102e30a681 command-shell --cli-data-dir /home/siblount/.vscode-server/cli --on-port --require-token b22aa7cb95da --parent-process-id 3771 &> "/home/siblount/.vscode-server/.cli.8b3775030ed1a69b13e4f4c628c612102e30a681.log" < /dev/null
printenv:
    SHELL=/bin/bash
    PWD=/home/siblount
    LOGNAME=siblount
    XDG_SESSION_TYPE=tty
    MOTD_SHOWN=pam
    HOME=/home/siblount
    LANG=en_US.UTF-8
    VSCODE_AGENT_FOLDER=/home/siblount/.vscode-server
    SSH_CONNECTION=192.168.56.1 53283 192.168.56.102 22
    XDG_SESSION_CLASS=user
    USER=siblount
    SHLVL=0
    XDG_SESSION_ID=23
    XDG_RUNTIME_DIR=/run/user/1000
    SSH_CLIENT=192.168.56.1 53283 22
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
    _=/usr/bin/printenv
Removing old logfile at /home/siblount/.vscode-server/.cli.8b3775030ed1a69b13e4f4c628c612102e30a681.log
Spawned remote CLI: 3790
Waiting for server log...
db0987102fca: start
SSH_AUTH_SOCK====
DISPLAY====
listeningOn==127.0.0.1:39315==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==41==
execServerToken==b22aa7cb95da==
db0987102fca: end
```

Running `netstat -tlpn` on the VM:
```bash
netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:45901         0.0.0.0:*               LISTEN      2783/node                          <-- "install task 1"
tcp        0      0 127.0.0.1:45941         0.0.0.0:*               LISTEN      1860/node
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:39473         0.0.0.0:*               LISTEN      1151/node
tcp        0      0 127.0.0.1:39315         0.0.0.0:*               LISTEN      3790/code-8b3775030                <-- "install task 2"
tcp6       0      0 :::22                   :::*                    LISTEN      -
```

I'm been trying to solve this puzzle for days now since I will be utilizing vulnerable software with this VM for class project soon. Maybe i just suck at networking idk im tired please help.

This report is from the Host OS (Windows 11).

VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:10.514Z)
OS version: Windows_NT x64 10.0.22621
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|AMD Ryzen 9 5900X 12-Core Processor             (24 x 3700)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|127.91GB (87.18GB free)|
|Process Argv|--crash-reporter-id 59979b9a-4685-4cb7-b62d-eaaf880c2f57|
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (49)</summary>

Extension|Author (truncated)|Version
---|---|---
Bookmarks|ale|13.4.2
doxdocgen|csc|1.4.0
copilot|Git|1.156.0
copilot-chat|Git|0.11.1
vscode-github-actions|git|0.26.2
go|gol|0.40.3
docomment|k--|1.0.0
vscode-docker|ms-|1.28.0
csdevkit|ms-|1.2.7
csharp|ms-|2.15.30
dotnet-interactive-vscode|ms-|1.0.5075010
vscode-dotnet-runtime|ms-|2.0.1
isort|ms-|2023.10.1
python|ms-|2023.22.1
vscode-pylance|ms-|2023.12.1
jupyter|ms-|2023.11.1100101639
jupyter-keymap|ms-|1.1.2
jupyter-renderers|ms-|1.0.17
vscode-jupyter-cell-tags|ms-|0.1.8
vscode-jupyter-slideshow|ms-|0.1.5
remote-containers|ms-|0.327.0
remote-ssh|ms-|0.107.1
remote-ssh-edit|ms-|0.86.0
remote-wsl|ms-|0.81.9
vscode-remote-extensionpack|ms-|0.25.0
cmake-tools|ms-|1.16.32
cpptools|ms-|1.18.5
cpptools-extension-pack|ms-|1.3.0
hexeditor|ms-|1.9.12
makefile-tools|ms-|0.8.22
remote-explorer|ms-|0.4.1
remote-server|ms-|1.5.0
phind|phi|0.20.0
fabric8-analytics|red|0.9.1
java|red|1.26.0
vscode-xml|red|0.26.1
cmake|twx|0.0.17
unity-debug|Uni|3.0.2
intellicode-api-usage-examples|Vis|0.2.8
vscodeintellicode|Vis|1.2.30
vscodeintellicode-completions|Vis|1.0.22
vscode-java-debug|vsc|0.55.0
vscode-java-dependency|vsc|0.23.3
vscode-java-pack|vsc|0.25.15
vscode-java-test|vsc|0.40.1
vscode-maven|vsc|0.43.0
php-debug|xde|1.34.0
php-pack|xde|1.0.3
php-intellisense|zob|1.3.3

(1 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30951796
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
dsvsc019acf:30951919
3ef8e399:30949928

```

</details>

<!-- generated by issue reporter -->