microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.61k stars 276 forks source link

Server fails to install with gzip 1.10: `Syntax error: "(" unexpected` #1812

Closed kirtangajjar closed 4 years ago

kirtangajjar commented 4 years ago

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

I don't know how it happened, but suddenly Vscode stopped working in WSL from yesterday. So I removed .vscode-server from WSL, and now I'm getting this error:

[2019-11-08 06:40:57.118] Starting VS Code Server inside WSL (ubuntu-18.04)
[2019-11-08 06:40:57.119] Extension version: 0.40.2, Windows build: 18362. Multi distro support: enabled. WSL path support: enabled
[2019-11-08 06:40:57.593] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d ubuntu-18.04 -e sh -c "[ -d ~/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2019-11-08 06:40:58.022] Probing result: x86_64
[2019-11-08 06:40:58.022] No server install found in WSL, needs x64
[2019-11-08 06:40:58.056] Launching C:\WINDOWS\System32\wsl.exe -d ubuntu-18.04 sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 86405ea23e3937316009fc27c9361deee66ffbf5 stable .vscode-server 0  ' in c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-wsl-0.40.2
[2019-11-08 06:40:58.694] Setting up server environment: Looking for /home/kirtan/.vscode-server/server-env-setup. Not found.
[2019-11-08 06:40:58.993] WSL version: 4.4.0-18362-Microsoft Ubuntu-18.04
[2019-11-08 06:40:58.993] Updating server...
[2019-11-08 06:40:58.993] Installing VS Code Server 86405ea23e3937316009fc27c9361deee66ffbf5
[2019-11-08 06:40:59.294] Using server tar available at /mnt/c/Users/KIRTAN~1.SP1/AppData/Local/Temp/vscode-remote-wsl/86405ea23e3937316009fc27c9361deee66ffbf5/vscode-server-linux-x64.tar.gz
[2019-11-08 06:40:59.294] 100%
[2019-11-08 06:40:59.295] Unpacking:   0%
[2019-11-08 06:40:59.898] 
[2019-11-08 06:40:59.898] gzip: stdin: unexpected end of file
[2019-11-08 06:40:59.898] tar: Unexpected EOF in archive
[2019-11-08 06:40:59.898] tar: Error is not recoverable: exiting now
[2019-11-08 06:41:00.1100%
[2019-11-08 06:41:00.199] 
[2019-11-08 06:41:00.199] gzip: stdin: unexpected end of file
[2019-11-08 06:41:00.199] tar: Unexpected EOF in archive
[2019-11-08 06:41:00.199] tar: Unexpected EOF in archive
[2019-11-08 06:41:00.199] tar: Error is not recoverable: exiting now
[2019-11-08 06:41:00.623] Unpacked 15 files and folders to /home/kirtan/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5.
[2019-11-08 06:41:00.623] Starting server: /home/kirtan/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/server.sh  --port=0 --fileWatcherPolling=0 
[2019-11-08 06:41:00.624] /mnt/c/Users/username/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.2/scripts/wslServer.sh: 60: /mnt/c/Users/username/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.2/scripts/wslServer.sh: /home/kirtan/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/server.sh: not found
[2019-11-08 06:41:00.624] VS Code Server for WSL closed unexpectedly.
[2019-11-08 06:41:00.624] For help with startup problems, go to
[2019-11-08 06:41:00.624] https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
rxmii4269 commented 4 years ago

I'm having the same issue on WSL2 updated to Ubuntu 19.10, it seems that the vscode server that is being downloaded does not contain the server.sh file or it could be corrupt as it worked prior to me updating vscode to 1.40.0.

ivangelion68 commented 4 years ago

I Solved with the next steps

 # md5sum vscode-server-linux-x64.tar.gz
 # d42d8e0ae03b4bc547ff92e796858efb  vscode-server-linux-x64.tar.gz
aeschli commented 4 years ago

@kirtangajjar Sorry for that. We download the server on the Windows side (to /mnt/c/Users/KIRTAN~1.SP1/AppData/Local/Temp/vscode-remote-wsl/86405ea23e3937316009fc27c9361deee66ffbf5/vscode-server-linux-x64.tar.gz), and since Remote -WSL 0.40.1, we also make a checksum test that the file is complete. I guess that happend in a run before, as it doesn't show in the log.

To understand what's going on, would you mind doing the following (in a WSL shell):

Clearly a bug is that when untar fails, we continue.

mellowdrifter commented 4 years ago

I'm having the same issue. Working ok yesterday, vscode updated to 1.40 today. Restarted and can no longer connect to WSL.

Says ~/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/server.sh not found. Confirmed the directory is in fact empty.

Running Windows 10, WSL with Ubuntu 19.10.

I've tried the above method to delete out the vscode-server/bin directory, but when I retry to connect I get the following:

[2019-11-09 01:04:18.721] Starting server: /home/mellowd/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/server.sh --port=0 --fileWatcherPolling=0 [2019-11-09 01:04:18.721] /bin/gzip: 10: Syntax error: "(" unexpected [2019-11-09 01:04:18.721] tar: Child returned status 2 [2019-11-09 01:04:18.721] tar: Error is not recoverable: exiting now [2019-11-09 01:04:18.721] /bin/gzip: 10: Syntax error: "(" unexpected [2019-11-09 01:04:18.721] tar: Child returned status 2 [2019-11-09 01:04:18.721] tar: Error is not recoverable: exiting now [2019-11-09 01:04:18.721] ERROR: Unpacking failed: Files expected: 0, is 1 [2019-11-09 01:04:18.721] /mnt/c/Users/mellowd/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.2/scripts/wslServer.sh: 60: /home/mellowd/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/server.sh: not found [2019-11-09 01:04:18.721] VS Code Server for WSL closed unexpectedly.

mellowdrifter commented 4 years ago

Something seems to be wrong with the file hosted right now. I get the same error if I try and install code from within WSL itself

$ code Installing VS Code Server 86405ea23e3937316009fc27c9361deee66ffbf5 x64 Downloading: 100% Unpacking: 0%/bin/gzip: 10: Syntax error: "(" unexpected tar: Child returned status 2 tar: Error is not recoverable: exiting now /bin/gzip: 10: Syntax error: "(" unexpected tar: Child returned status 2 tar: Error is not recoverable: exiting now

ERROR: Unpacking failed: Files expected: 0, is 1 /mnt/c/Users/mellowd/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.2/scripts/wslCode.sh: 49: /home/mellowd/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/bin/code: not found

mellowdrifter commented 4 years ago

ok I managed to get it working, but took a bit.

First I tried downloading https://update.code.visualstudio.com/commit:86405ea23e3937316009fc27c9361deee66ffbf5/server-linux-x64/stable manually. Renamed stable to vscode-server-linux-x64.tar.gz - Ran a checksum and got d42d8e0ae03b4bc547ff92e796858efb - but when trying to extract manually, I get the same syntax error: "(" as above.

So I copied that file to my Windows desktop. From there I used 7zip to extract the folder within. 7zip extracted it with no errors. I then moved the extracted folder to ~/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5

I then re-opened vscode, connected to WSL, and now it's working.

So, at least in my Ubuntu 19.10, gzip gives the same error whether vscode or I extract it manually.

kirtangajjar commented 4 years ago

@aeschli I followed the steps you mentioned. That fixed the problem and now vscode is working properly with wsl 🎉 . I'm not sure if you still need the logs or not, but in case it's helpful, here you go:

[2019-11-09 05:54:32.207] Starting VS Code Server inside WSL (ubuntu-18.04)
[2019-11-09 05:54:32.210] Extension version: 0.40.2, Windows build: 18362. Multi distro support: enabled. WSL path support: enabled
[2019-11-09 05:54:32.976] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d ubuntu-18.04 -e sh -c "[ -d ~/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2019-11-09 05:54:33.852] Probing result: x86_64
[2019-11-09 05:54:33.852] No server install found in WSL, needs x64
[2019-11-09 05:54:33.852] Downloading server on client side to C:\Users\KIRTAN~1.SP1\AppData\Local\Temp\vscode-remote-wsl\86405ea23e3937316009fc27c9361deee66ffbf5\vscode-server-linux-x64.tar.gz.
[2019-11-09 05:54:33.852] https://update.code.visualstudio.com/commit:86405ea23e3937316009fc27c9361deee66ffbf5/server-linux-x64/stable
[2019-11-09 05:54:35.126] Download checksum: f3e89596064b768966048c80d50b2f76e55de83680d5bd011320b8a78b6638eb
[2019-11-09 05:54:46.616] Download checksum verified
[2019-11-09 05:54:46.619] Launching C:\WINDOWS\System32\wsl.exe -d ubuntu-18.04 sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 86405ea23e3937316009fc27c9361deee66ffbf5 stable .vscode-server 0  ' in c:\Users\kirtan.g.sp19\.vscode\extensions\ms-vscode-remote.remote-wsl-0.40.2
[2019-11-09 05:54:47.171] Setting up server environment: Looking for /home/kirtan/.vscode-server/server-env-setup. Not found.
[2019-11-09 05:54:47.171] WSL version: 4.4.0-18362-Microsoft Ubuntu-18.04
[2019-11-09 05:54:47.171] Updating server...
[2019-11-09 05:54:47.472] Updating VS Code Server to version 86405ea23e3937316009fc27c9361deee66ffbf5
[2019-11-09 05:54:47.472] Removing previous installation...
[2019-11-09 05:54:47.472] Using server tar available at /mnt/c/Users/KIRTAN~1.SP1/AppData/Local/Temp/vscode-remote-wsl/86405ea23e3937316009fc27c9361deee66ffbf5/vscode-server-linux-x64.tar.gz
[2019-11-09 05:54:47.472] 100%
[2019-11-09 05:54:47.472] Unpacking:   0%
[2019-11-09 05:54:49.5 10%
[2019-11-09 05:54:49.8 20%
[2019-11-09 05:54:50.1 29%
[2019-11-09 05:54:50.4 39%
[2019-11-09 05:54:50.7 48%
[2019-11-09 05:54:51.0 52%
[2019-11-09 05:54:51.6 54%
[2019-11-09 05:54:51.9 58%
[2019-11-09 05:54:52.2 60%
[2019-11-09 05:54:52.5 61%
[2019-11-09 05:54:52.8 63%
[2019-11-09 05:54:53.1 65%
[2019-11-09 05:54:53.4 66%
[2019-11-09 05:54:53.7 67%
[2019-11-09 05:54:54.3 70%
[2019-11-09 05:54:54.6 72%
[2019-11-09 05:54:54.9 75%
[2019-11-09 05:54:55.2 77%
[2019-11-09 05:54:55.5 79%
[2019-11-09 05:54:55.8 82%
[2019-11-09 05:54:56.7 83%
[2019-11-09 05:54:57.9 86%
[2019-11-09 05:54:58.2 88%
[2019-11-09 05:54:58.5 90%
[2019-11-09 05:54:58.8 95%
[2019-11-09 05:54:59.1 96%
[2019-11-09 05:54:59.4100%
[2019-11-09 05:55:01.290] Unpacked 2036 files and folders to /home/kirtan/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5.
[2019-11-09 05:55:01.290] Starting server: /home/kirtan/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/server.sh  --port=0 --fileWatcherPolling=0 
[2019-11-09 05:55:06.998] 
[2019-11-09 05:55:06.998] 
[2019-11-09 05:55:06.998] *
[2019-11-09 05:55:06.998] * Visual Studio Code Server
[2019-11-09 05:55:06.998] *
[2019-11-09 05:55:06.998] * Reminder: You may only use this software with Visual Studio family products,
[2019-11-09 05:55:06.998] * as described in the license https://aka.ms/vscode-remote/license
[2019-11-09 05:55:06.998] *
[2019-11-09 05:55:06.998] 
[2019-11-09 05:55:06.998] 
[2019-11-09 05:55:07.298] IP Address: 172.17.88.161
[2019-11-09 05:55:07.298] IP Address: 192.168.220.121
[2019-11-09 05:55:07.298] IP Address: 10.0.75.1
[2019-11-09 05:55:07.298] Extension host agent listening on 54127
[2019-11-09 05:55:07.298] 
[2019-11-09 05:55:07.298] 
[2019-11-09 05:55:07.298] [11:25:07] Extension host agent started.
[2019-11-09 05:55:07.300] WSL resolver response: 127.0.0.1:54127
[2019-11-09 05:55:07.300] To debug connection issues, open a local browser on http://127.0.0.1:54127/version
hbirler commented 4 years ago

I believe the issue is with gzip 1.10 on WSL1: https://github.com/microsoft/WSL/issues/4461 Downgrading gzip as described on the linked issue solved my problem.

xiaoas commented 4 years ago

@aeschli hi! I followed your suggestions, however it's not working

[2019-11-14 10:20:22.384] Starting VS Code Server inside WSL (Ubuntu) [2019-11-14 10:20:22.384] Extension version: 0.40.2, Windows build: 18363. Multi distro support: enabled. WSL path support: enabled [2019-11-14 10:20:22.516] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c "[ -d ~/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)" [2019-11-14 10:20:22.584] Probing result: x86_64 [2019-11-14 10:20:22.584] No server install found in WSL, needs x64 [2019-11-14 10:20:22.584] Downloading server on client side to C:\Users\xiaoas\AppData\Local\Temp\vscode-remote-wsl\86405ea23e3937316009fc27c9361deee66ffbf5\vscode-server-linux-x64.tar.gz. [2019-11-14 10:20:22.584] https://update.code.visualstudio.com/commit:86405ea23e3937316009fc27c9361deee66ffbf5/server-linux-x64/stable [2019-11-14 10:20:24.053] Download checksum: f3e89596064b768966048c80d50b2f76e55de83680d5bd011320b8a78b6638eb [2019-11-14 10:20:28.315] Download checksum verified [2019-11-14 10:20:28.316] Launching C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 86405ea23e3937316009fc27c9361deee66ffbf5 stable .vscode-server 0 ' in c:\Users\xiaoas.vscode\extensions\ms-vscode-remote.remote-wsl-0.40.2 [2019-11-14 10:20:28.478] Setting up server environment: Looking for /home/xiaoas/.vscode-server/server-env-setup. Not found. [2019-11-14 10:20:28.478] WSL version: 4.4.0-18362-Microsoft Ubuntu [2019-11-14 10:20:28.478] Updating server... [2019-11-14 10:20:28.478] Installing VS Code Server 86405ea23e3937316009fc27c9361deee66ffbf5 [2019-11-14 10:20:28.478] Using server tar available at /mnt/c/Users/xiaoas/AppData/Local/Temp/vscode-remote-wsl/86405ea23e3937316009fc27c9361deee66ffbf5/vscode-server-linux-x64.tar.gz [2019-11-14 10:20:28.478] 100% [2019-11-14 10:20:28.478] Unpacking: 0% [2019-11-14 10:20:28.478] Starting server: /home/xiaoas/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/server.sh --port=0 --fileWatcherPolling=0 [2019-11-14 10:20:28.479] /bin/gzip: 10: Syntax error: "(" unexpected [2019-11-14 10:20:28.479] tar: Child returned status 2 [2019-11-14 10:20:28.479] tar: Error is not recoverable: exiting now [2019-11-14 10:20:28.479] /bin/gzip: 10: Syntax error: "(" unexpected [2019-11-14 10:20:28.479] tar: Child returned status 2 [2019-11-14 10:20:28.479] tar: Error is not recoverable: exiting now [2019-11-14 10:20:28.479] ERROR: Unpacking failed: Files expected: 0, is 1 [2019-11-14 10:20:28.479] /mnt/c/Users/xiaoas/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.2/scripts/wslServer.sh: 60: /home/xiaoas/.vscode-server/bin/86405ea23e3937316009fc27c9361deee66ffbf5/server.sh: not found [2019-11-14 10:20:28.479] VS Code Server for WSL closed unexpectedly. [2019-11-14 10:20:28.479] For help with startup problems, go to [2019-11-14 10:20:28.479] https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips

😥

aeschli commented 4 years ago

@xiaoas Your error looks like https://github.com/microsoft/vscode-remote-release/issues/1744#issuecomment-548290615 The underlying issue is https://github.com/microsoft/WSL/issues/4461.

Please try https://github.com/microsoft/WSL/issues/4461#issuecomment-547491959

aeschli commented 4 years ago

Closing as dup of #1856. I created #1856 to have a simpler, shorter issue to link to, so not everyone needs to read through all the comments of this issue). Remote-WSL 0.40.3 now detects that untaring failed and will print a link to issue #1856 to help users).