How I fixed Visual Studio Code Remote SSH "Waiting for server log..." SSH

Problem:

When you try to connect Visual Studio Code to a computer (such as a Raspberry Pi) using SSH, you see log messages like

[16:23:13.444] > Waiting for server log...
[16:23:13.480] > Waiting for server log...
[16:23:13.520] > Waiting for server log...
[16:23:13.560] > Waiting for server log...
[16:23:13.598] > Waiting for server log...
[16:23:13.638] > Waiting for server log...

and VS code restarts the connection process repeatedly without connecting

Solution

In my case, theĀ ~/.vscode-server on the device where you’re connecting to was corrupted.

Therefore, the solution was to manually login usingĀ ssh to the device as the same user you’re using for VS code remote SSH and then running

rm -rf ~/.vscode-server

After that, just reconnect using VS code - it will automatically re-install the server.