vscode remote is stuck on acquiring lock
Asked Answered
H

3

7

I am using vscode for remote development on a server. While my local ssh works perfectly and vscode too manages to connect I cannot understand why it struggles with acquiring a lock:

[15:30:21.166] Log Level: 2
[15:30:21.167] [email protected]
[15:30:21.167] linux x64
[15:30:21.170] SSH Resolver called for "ssh-remote+myservername", attempt 1
[15:30:21.170] "remote.SSH.useLocalServer": true
[15:30:21.170] "remote.SSH.path": undefined
[15:30:21.170] "remote.SSH.configFile": undefined
[15:30:21.170] "remote.SSH.useFlock": true
[15:30:21.170] "remote.SSH.lockfilesInTmp": false
[15:30:21.171] "remote.SSH.localServerDownload": auto
[15:30:21.171] "remote.SSH.remoteServerListenOnSocket": false
[15:30:21.171] "remote.SSH.showLoginTerminal": false
[15:30:21.171] "remote.SSH.defaultExtensions": []
[15:30:21.171] "remote.SSH.loglevel": 2
[15:30:21.171] "remote.SSH.enableDynamicForwarding": true
[15:30:21.171] "remote.SSH.enableRemoteCommand": false
[15:30:21.173] "remote.SSH.serverPickPortsFromRange": {}
[15:30:21.173] "remote.SSH.serverInstallPath": {}
[15:30:21.182] SSH Resolver called for host: myservername
[15:30:21.182] Setting up SSH remote "myservername"
[15:30:21.185] Acquiring local install lock: /tmp/vscode-remote-ssh-71abc574-install.lock
[15:30:21.188] Looking for existing server data file at /home/pablo.jeken/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-71abc574-c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1-0.76.1/data.json
[15:30:21.189] Using commit id "c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1" and quality "stable" for server
[15:30:21.194] Install and start server if needed
[15:30:21.201] PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
[15:30:21.201] Checking ssh with "ssh -V"
[15:30:21.207] > OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f  31 Mar 2020

[15:30:21.218] askpass server listening on /run/user/10009775/vscode-ssh-askpass-3d1c8a273f03be7c5d0c82b4d05d7bac4a210902.sock
[15:30:21.218] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/10009775/vscode-ssh-askpass-1cc1dcb318a81e2eccd3798a104e90247b955e4e.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","46751","-o","ConnectTimeout=15","myservername"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/pablo.jeken/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-71abc574-c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1-0.76.1/data.json"}
[15:30:21.219] Local server env: {"SSH_AUTH_SOCK":"/run/user/10009775/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":0","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/pablo.jeken/.vscode/extensions/ms-vscode-remote.remote-ssh-0.76.1/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/pablo.jeken/.vscode/extensions/ms-vscode-remote.remote-ssh-0.76.1/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/10009775/vscode-ssh-askpass-3d1c8a273f03be7c5d0c82b4d05d7bac4a210902.sock"}
[15:30:21.221] Spawned 603360
[15:30:21.289] > local-server-1> Spawned ssh, pid=603368
[15:30:21.291] stderr> OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f  31 Mar 2020
[15:30:21.310] stderr> debug1: Server host key: ecdsa-sha2-nistp256 SHA256:xnBKjqpfpJS7fUOyaBfLXfFKXhrQHy0gTzx+EgsjOWE
[15:30:21.395] stderr> Server not found in Kerberos database
[15:30:21.435] stderr> Authenticated to myservername-myuni.com ([10.202.224.1]:22).
[15:30:21.515] > ready: 8065c191363a
[15:30:21.517] > Linux 4.18.0-240.1.1.el8_3.x86_64 #1 SMP Thu Nov 19 17:20:08 UTC 2020
[15:30:21.517] Platform: linux
[15:30:21.518] > /bin/bash
[15:30:21.518] Shell: bash
[15:30:21.524] > 8065c191363a: running
[15:30:21.540] > Acquiring lock on /home/pjeken/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/vscode-remote-lock.pjeken.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1

This issue is provided at the github page of vscode, but was closed without a solution.

I tried both setting remote.SSH.useFlock to false and remote.SSH.lockfilesInTmp to true as suggested in the threat, but nothing solved the problem. Either vscode got caught in a loop trying to connect with ssh or the same problem persisted (same as in the threat).

Does anyone know where the issue might be? Thanks in advance.

Update: I tried out the flock test as suggested in the answer below. The lock cannot be solved and is permanently stuck. Therefore, I assume flock to be indeed the problem. Moving away from flock, as stated before, has not solved the problem either.

Humfrey answered 29/3, 2022 at 13:47 Comment(2)
if you delete the $HOME/.vscode folder on the server and reconnect via ssh, it should regenerate a new $HOME/.vscode folder at reconnection.Determinant
Yes, it does, but unfortunately, it doesn't solve the connection problem.Humfrey
H
0

I finally solved my issue by disabling flock and installing vscode in a different way on the server.

  1. Disable flock: Set remote.SSH.useFlock to false in the vscode settings.

  2. Install vscode by deploying it from a downloaded package (see how to do it here).

Humfrey answered 15/1, 2024 at 13:59 Comment(0)
E
1

Have you tried using a shell and running flock manually?

Here's a simple example script you can use to test if flock is working.

Euphoria answered 5/4, 2022 at 4:10 Comment(3)
Thanks for the hint. In fact, running the script results in the same kind of freeze (I get no response). 1. A lock file is generated. 2. A .nfsXXXX... file is generated which is "busy" and cannot be removed (just like with vscode).Humfrey
What type of storage are you using on that server? There are known issues with flock and NFS. serverfault.com/a/1001848Euphoria
I requested info from the admin. I am not sure, all I know is that my colleagues have no problem using vscode on it. Also, I don't have any problems connecting to other (I suppose) similar machines.Humfrey
H
0

I finally solved my issue by disabling flock and installing vscode in a different way on the server.

  1. Disable flock: Set remote.SSH.useFlock to false in the vscode settings.

  2. Install vscode by deploying it from a downloaded package (see how to do it here).

Humfrey answered 15/1, 2024 at 13:59 Comment(0)
T
0

The only way to solve that issue is to disable auto updates.

settings

After disabling auto check for updates, connect to the server by using SSH and run the following command

cd ~
rm -rf .vscode*

If the download progress indicator show intermediate value, to check if it stuck you can compute the .vscode-server folder size

enter image description here

Tetzel answered 2/5, 2024 at 11:10 Comment(2)
I can update everything automatically because I use the scp option, i.e. that the remote vscode pulls any updates through your remote session. Check out the option: ´´Remote.SSH: Local Server Download´´Humfrey
@PabloJekenRico The auto updates feature is awful. For example, they recently add auto github login prompt to vscode which uses Avalonia (C#), so the extension host was broken on ubuntu 22.04 for a weekTetzel

© 2022 - 2025 — McMap. All rights reserved.