nix-community / nixos-vscode-server

Visual Studio Code Server support in NixOS
MIT License
412 stars 75 forks source link

ERROR: Unpacking failed: Files expected: 2399, is 2400 #54

Closed niklaskorz closed 1 year ago

niklaskorz commented 1 year ago

Every time VS Code Server updates, it fails with the following error:

Updating VS Code Server to version ee2b180d582a7f601fa6ecfdad8d9fd269ab1884
Removing previous installation...
Installing VS Code Server for x64 (ee2b180d582a7f601fa6ecfdad8d9fd269ab1884)
Downloading: 100%
Unpacking: 100%
ERROR: Unpacking failed: Files expected: 2399, is 2400

The only explanation I can think of is that the auto-fix-vscode-server service runs too fast, i.e. between the unpacking and the checking of the unpacked files. Stopping the service before updating and starting it again after successfully updating works around this.

This error has occured every time VS Code Server tried to update in the past two months (so far, that's been ~5 times).

msteen commented 1 year ago

Thanks for letting me know! Sounds like a pain, I will see if I can fix it. I haven't been able to reproduce the error. In what environment are you running this? I could probably try keeping the expected files the same, or find a better moment to change the files, or in the worst case just add a timeout (not a fan).

ykis-0-0 commented 1 year ago

Same problem here, may I attach some logs here in case it helps:

Apr 06 16:35:43 wslnix systemd[235]: Startup finished in 80ms.
Apr 06 16:35:45 wslnix auto-fix-vscode-server[242]: VS Code server is being installed in /home/nixos/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21-1680770145...
Apr 06 16:35:45 wslnix auto-fix-vscode-server[242]: Patching Node.js of VS Code server installation in /home/nixos/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21-1680770145...
Apr 06 16:35:45 wslnix auto-fix-vscode-server[242]: /nix/store/jq5083snranwvvqwdfmf721gg4h7yfpk-auto-fix-vscode-server/bin/auto-fix-vscode-server: line 41: /home/nixos/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21/.patched: No such file or directory
Apr 06 16:35:45 wslnix systemd[235]: auto-fix-vscode-server.service: Main process exited, code=exited, status=1/FAILURE
Apr 06 16:35:45 wslnix systemd[235]: auto-fix-vscode-server.service: Failed with result 'exit-code'.
Apr 06 16:35:45 wslnix systemd[235]: auto-fix-vscode-server.service: Scheduled restart job, restart counter is at 1.
Apr 06 16:35:45 wslnix systemd[235]: Stopped Automatically fix the VS Code server used by the remote SSH extension.

(Repeat above for 5 times)

Apr 06 16:35:45 wslnix systemd[235]: auto-fix-vscode-server.service: Start request repeated too quickly.
Apr 06 16:35:45 wslnix systemd[235]: auto-fix-vscode-server.service: Failed with result 'exit-code'.
Apr 06 16:35:45 wslnix systemd[235]: Failed to start Automatically fix the VS Code server used by the remote SSH extension.

My observation is VSCode will attach an epoch before the update completes (refer to the path above, ending with a80e2d21-1680770145), may this can be utilized?

Jumail commented 1 year ago

Before enabling the auto-fix-vscode-server.service try running vscode. This will fail as expected but after that you can run the auto-fix-vs-code-server-service.

Hope this fixes the issue for anyone going through it.

msteen commented 1 year ago

I moved the extra files that were added to the root of the install path, similar to what it itself does for the log and token file already. It might still fail due to me changing node, but if it doesn't, this hopefully fixes the issue.

msteen commented 1 year ago

@niklaskorz @ykis-0-0 @Jumail Can any of you verify whether it now works for you without it first failing like @Jumail mentioned?

niklaskorz commented 1 year ago

So this issue seems fixed now (thanks a lot!), but somehow VS Code can't connect to the remote server now... This might be more related to NixOS WSL though instead of this repo, I will dig some more to see what causes this.

Edit: Everything works! Thanks sooooo much. The last issue was a fault in my own NixOS config, so never mind that.

msteen commented 1 year ago

Thank you for getting back at me, I am glad it now works for you too!