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.67k stars 292 forks source link

[Remote-SSH Bug]: #9792

Open alon1samuel opened 7 months ago

alon1samuel commented 7 months ago

Is there an existing issue for this bug?

Required Troubleshooting Steps

Connect Locally

It connects successfully

->

No response

Expected Behavior

Successful connection once to remote

Steps To Reproduce

  1. Using ssh-sagemaker from Mac BookPro M1 Chip into an AWS SageMaker instance ml.g4dn.xlarge
  2. Finishing the Getting started section, then connecting using Local IDE VSCode
  3. ssh into the instance works well
  4. Running In VS Code, select Remote-SSH: Connect to Host... from the Command Palette (F1, ⇧⌘P) and use the same user@hostname as in step 1.
  5. Erroring:
    [11:38:35.267] stderr> tar: code: Cannot change ownership to uid 1000, gid 1000: Operation not permitted
    [11:38:35.267] stderr> tar: Exiting with failure status due to previous errors
    [11:38:35.268] > ERROR: tar exited with non-0 exit code: 0

If I'm reverting to version - v0.109.0 It works well! so not sure why in current version it fails.

Remote-SSH Log

Remote-SSH Log

``` [11:38:35.267] stderr> tar: code: Cannot change ownership to uid 1000, gid 1000: Operation not permitted [11:38:35.267] stderr> tar: Exiting with failure status due to previous errors [11:38:35.268] > ERROR: tar exited with non-0 exit code: 0 ```

Anything else?

I've also opened an issue in ssh sagemeker

roblourens commented 5 months ago

Any difference if you set the setting "remote.SSH.useExecServer": false? Can you share the full log?

alon1samuel commented 4 months ago

Hi!

Thanks for the help! I've added "remote.SSH.useExecServer": false and it solved the issue. (not sure what it is doing, but all seems to run fine)

Here is the previous full error message. I've classified some paths (due to restrictions)


[14:54:24.197] Log Level: 2
[14:54:24.201] SSH Resolver called for "ssh-remote+sagemaker-studio", attempt 1
[14:54:24.202] "remote.SSH.useLocalServer": true
[14:54:24.202] "remote.SSH.useExecServer": true
[14:54:24.202] "remote.SSH.path": undefined
[14:54:24.202] "remote.SSH.configFile": undefined
[14:54:24.202] "remote.SSH.useFlock": true
[14:54:24.202] "remote.SSH.lockfilesInTmp": false
[14:54:24.202] "remote.SSH.localServerDownload": auto
[14:54:24.202] "remote.SSH.remoteServerListenOnSocket": false
[14:54:24.202] "remote.SSH.showLoginTerminal": false
[14:54:24.202] "remote.SSH.defaultExtensions": []
[14:54:24.202] "remote.SSH.loglevel": 2
[14:54:24.202] "remote.SSH.enableDynamicForwarding": true
[14:54:24.202] "remote.SSH.enableRemoteCommand": false
[14:54:24.202] "remote.SSH.serverPickPortsFromRange": {}
[14:54:24.202] "remote.SSH.serverInstallPath": {}
[14:54:24.207] VS Code version: 1.90.2
[14:54:24.207] Remote-SSH version: remote-ssh@0.112.0
[14:54:24.207] darwin arm64
[14:54:24.208] SSH Resolver called for host: sagemaker-studio
[14:54:24.208] Setting up SSH remote "sagemaker-studio"
[14:54:24.210] Acquiring local install lock: /var/folders/2q/s4g24yvj5bx_ns861n34fy9w0000gp/T/vscode-remote-ssh-179869a4-install.lock
[14:54:24.211] Looking for existing server data file at *****************
[14:54:24.212] Using commit id "5437499feb04f7a586f677b155b039bc2b3669eb" and quality "stable" for server
[14:54:24.214] Install and start server if needed
[14:54:24.216] PATH: *****************
[14:54:24.216] Checking ssh with "ssh -V"
[14:54:24.227] > OpenSSH_9.6p1, LibreSSL 3.3.6

[14:54:24.228] askpass server listening on /var/folders/2q/s4g24yvj5bx_ns861n34fy9w0000gp/T/vscode-ssh-askpass-ed7bdc6e6f7fdc202355a1602f2476fdbb360ef6.sock
[14:54:24.229] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/2q/s4g24yvj5bx_ns861n34fy9w0000gp/T/vscode-ssh-askpass-1e76cc869fc9e27b75f8073cdf84348b9ba5642d.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","65535","-o","ConnectTimeout=15","sagemaker-studio"],"serverDataFolderName":".vscode-server","dataFilePath":"*****************"}
[14:54:24.229] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.9E5sSmIzCQ/Listeners","SHELL":"/bin/zsh","DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"*****************/.vscode/extensions/ms-vscode-remote.remote-ssh-0.112.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"","VSCODE_SSH_ASKPASS_MAIN":"*****************.vscode/extensions/ms-vscode-remote.remote-ssh-0.112.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/2q/s4g24yvj5bx_ns861n34fy9w0000gp/T/vscode-ssh-askpass-ed7bdc6e6f7fdc202355a1602f2476fdbb360ef6.sock"}
[14:54:24.231] Spawned 97483
[14:54:24.321] > local-server-1> Running ssh connection command: ssh -v -T -D 65535 -o ConnectTimeout=15 sagemaker-studio
[14:54:24.322] > local-server-1> Spawned ssh, pid=97492
[14:54:24.326] stderr> OpenSSH_9.6p1, LibreSSL 3.3.6
[14:54:24.494] stderr> debug1: Server host key: ssh-ed25519 SHA256:d5iPH2/q2eZxvBkdDtOkkMr+eE3V2Ba6Ww3fupnpzrk
[14:54:24.735] stderr> Authenticated to localhost ([127.0.0.1]:10022) using "publickey".
[14:54:24.817] > Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 4.14.344-262.563.amzn2.x86_64 x86_64)
> 
>  * Documentation:  https://help.ubuntu.com
>  * Management:     https://landscape.canonical.com
>  * Support:        https://ubuntu.com/pro
> 
> This system has been minimized by removing packages and content that are
> not required on a system that users do not log into.
> 
> To restore this content, you can run the 'unminimize' command.
[14:54:24.857] > ready: ac7e47b8f4c2
[14:54:24.921] > Linux 4.14.344-262.563.amzn2.x86_64 #1 SMP Fri May 17 18:07:48 UTC 2024
[14:54:24.921] Platform: linux
[14:54:24.987] > /bin/bash
[14:54:24.987] Shell: bash
[14:54:24.987] Creating bash subshell inside "bash"
[14:54:25.035] > bash version:  5.1.16(1)-release
[14:54:25.111] > ac7e47b8f4c2: running
[14:54:25.111] > Installing to /root/.vscode-server...
[14:54:25.111] > ac7e47b8f4c2%%1%%
[14:54:25.114] > Downloading with wget
[14:54:25.458] > Download complete
[14:54:25.461] > ac7e47b8f4c2%%2%%
> tar --version:
[14:54:25.465] > tar (GNU tar) 1.34
> Copyright (C) 2021 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by John Gilmore and Jay Fenlason.
[14:54:25.826] stderr> tar: code: Cannot change ownership to uid 1000, gid 1000: Operation not permitted
[14:54:25.829] stderr> tar: Exiting with failure status due to previous errors
[14:54:25.833] > ERROR: tar exited with non-0 exit code: 0
[14:54:25.834] > Trigger local server download
> ac7e47b8f4c2:trigger_server_download
> artifact==cli-alpine-x64==
> destFolder==/root/.vscode-server==
> destFolder2==/vscode-cli-5437499feb04f7a586f677b155b039bc2b3669eb.tar.gz==
> ac7e47b8f4c2:trigger_server_download_end
> Waiting for client to transfer server archive...
> Waiting for /root/.vscode-server/vscode-cli-5437499feb04f7a586f677b155b039bc2b3669eb.tar.gz.done and vscode-server.tar.gz to exist
>  
[14:54:25.835] Got request to download on client for {"artifact":"cli-alpine-x64","destPath":"/root/.vscode-server/vscode-cli-5437499feb04f7a586f677b155b039bc2b3669eb.tar.gz"}
[14:54:25.835] Downloading VS Code server locally...
[14:54:28.835] >  
[14:54:28.894] Downloaded VS Code server to /var/folders/2q/s4g24yvj5bx_ns861n34fy9w0000gp/T/049a6b73-5166-46c4-b432-1902cabca73a
[14:54:28.895] Renamed VS Code server to /var/folders/2q/s4g24yvj5bx_ns861n34fy9w0000gp/T/vscode_server_1719237268894/vscode-cli-5437499feb04f7a586f677b155b039bc2b3669eb.tar.gz
[14:54:28.896] PATH: *****************
[14:54:28.896] Checking ssh with "ssh -V"
[14:54:28.901] > OpenSSH_9.6p1, LibreSSL 3.3.6

[14:54:28.901] Testing scp with "scp"
[14:54:28.941] scp exited with code: 1
[14:54:28.941] Got stderr from scp: usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]
           [-i identity_file] [-J destination] [-l limit] [-o ssh_option]
           [-P port] [-S program] [-X sftp_option] source ... target
[14:54:28.941] Copying file to remote with scp -o ConnectTimeout=15 'vscode-cli-5437499feb04f7a586f677b155b039bc2b3669eb.tar.gz' 'vscode-cli-5437499feb04f7a586f677b155b039bc2b3669eb.tar.gz.done' 'sagemaker-studio':'/root/.vscode-server'
[14:54:28.941] Using cwd: file:///var/folders/2q/s4g24yvj5bx_ns861n34fy9w0000gp/T/vscode_server_1719237268894
[14:54:30.158] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   0%    0     0.0KB/s   --:-- ETA
[14:54:31.157] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 254.6KB/s   00:33 ETA
[14:54:31.836] >  
[14:54:32.166] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 229.1KB/s   00:37 ETA
[14:54:33.168] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 206.2KB/s   00:41 ETA
[14:54:34.170] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 185.6KB/s   00:45 ETA
[14:54:34.836] >  
[14:54:35.172] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 167.0KB/s   00:50 ETA
[14:54:36.176] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 150.3KB/s - stalled -
[14:54:37.184] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 135.3KB/s - stalled -
[14:54:37.841] >  
[14:54:38.187] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 121.8KB/s - stalled -
[14:54:39.191] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB 109.6KB/s - stalled -
[14:54:40.198] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   2%  255KB  98.6KB/s - stalled -
[14:54:40.841] >  
[14:54:41.200] > vscode-cli-5437499feb04f7a586f677b155b039bc2b  75% 6630KB 723.7KB/s   00:02 ETA
[14:54:42.208] > vscode-cli-5437499feb04f7a586f677b155b039bc2b  84% 7395KB 727.5KB/s   00:01 ETA
[14:54:43.212] > vscode-cli-5437499feb04f7a586f677b155b039bc2b  90% 7905KB 705.5KB/s   00:01 ETA
[14:54:43.842] >  
[14:54:44.212] > vscode-cli-5437499feb04f7a586f677b155b039bc2b  96% 8415KB 685.8KB/s   00:00 ETA
[14:54:44.398] > vscode-cli-5437499feb04f7a586f677b155b039bc2b 100% 8752KB 614.4KB/s   00:14    
[14:54:44.725] > vscode-cli-5437499feb04f7a586f677b155b039bc2b   0%    0     0.0KB/s   --:-- ETA
[14:54:44.782] > vscode-cli-5437499feb04f7a586f677b155b039bc2b 100%    9     0.2KB/s   00:00    
[14:54:45.212] "Copy server to host" terminal command done
[14:54:46.843] > Found flag and server on host
[14:54:46.851] > ac7e47b8f4c2%%2%%
> tar --version:
[14:54:46.854] > tar (GNU tar) 1.34
> Copyright (C) 2021 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by John Gilmore and Jay Fenlason.
[14:54:47.193] stderr> tar: code: Cannot change ownership to uid 1000, gid 1000: Operation not permitted
[14:54:47.194] stderr> tar: Exiting with failure status due to previous errors
[14:54:47.197] > ERROR: tar exited with non-0 exit code: 0
> Already attempted local download, failing
> ac7e47b8f4c2: start
[14:54:47.199] > exitCode==37==
> listeningOn====
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/tmp==
> platform==linux==
> unpackResult==error==
> didLocalDownload==1==
> downloadTime==349==
> installTime==348==
> serverStartTime====
> execServerToken==1111a1aa-a1a1-1111-a1a1-11aa11a11aa1==
> ac7e47b8f4c2: end
[14:54:47.200] Received install output: exitCode==37==
listeningOn====
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/tmp==
platform==linux==
unpackResult==error==
didLocalDownload==1==
downloadTime==349==
installTime==348==
serverStartTime====
execServerToken==1111a1aa-a1a1-1111-a1a1-11aa11a11aa1==

[14:54:47.201] Terminating local server
[14:54:47.209] Resolver error: Error: Failed to install the VS Code Server
    at g.ServerInstallError (*****************

[14:54:47.220] Local server exit: 15
ivan-khvostishkov commented 3 months ago

It turns out that the problem happens only if the remote host has the home directory mounted as remote filesystem. This is also the case when you use Amazon SageMaker Studio. In this case tar fails even if the user is root:

root@sagemaker-data-science-ml-m5-large-c6af45d22b9c5a94bb29700daf4d:~/.vscode-server# tar xzvf vscode-cli-f1e16e1e6214d7c44d078b1f0607b2388f29d729.tar.gz 
code
tar: code: Cannot change ownership to uid 1000, gid 1000: Operation not permitted
tar: Exiting with failure status due to previous errors
root@sagemaker-data-science-ml-m5-large-c6af45d22b9c5a94bb29700daf4d:~/.vscode-server# df -h .
Filesystem         Size  Used Avail Use% Mounted on
127.0.0.1:/200060  8.0E   42G  8.0E   1% /root

I think, Visual Studio Code should support installations into NFS home directories, because it's not an uncommon situation in corporate environments. It should run tar in a way that it doesn't require special permission.

imoneoi commented 2 months ago

That same issue happened on the latest version, v0.114.2, when the host has the home directory mounted as remote filesystem. Also solved through setting "remote.SSH.useExecServer": false