Remote SSH via Visual Studio Code

  • Hi All,


    I am running OMV on top of regular Raspberry Pi OS.


    I would like to use Visual Studio Code on my Windows machine to Remote SSH into the Pi's directories to edit files.


    But I cannot get a ssh connection with Visual Studio. sadly...

    Failed to parse remote port form server output


    ssh is actived in OMV with port 22.

    I can ssh into the Pi using Windows Terminal without an issue.


    Does anyone have a clue?

    Maybe someone is also using Visual Studio Code?


    Thnx & BR

  • https://www.raspberrypi.com/ne…-with-visual-studio-code/


    The vscode repos were removed from the the vscode.list some time ago but it can be installed just the same.

  • I don't understand what you are saying...

    The vscode.list that point to the repository (where you can download the packages) is empty.


    The Raspberry community was outraged when that was added by the developers of the RaspiOS without anyone's knowledge

    (A Micro$oft repository under the hood of a Debian/Linux OS, hell no).


    You can try to install vscode on the Pi with sudo apt install code -y but since there are no repositories pointing to the packages, it will (most likely) fail.

    (Don't know, haven't tried it, nor will)

    If you try it and it installs, great.


    [EDIT] Found a faster solution:

    If not, run these 3 commands and your back in business. SOURCE

    Code
    wget -qO - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
    echo "deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main" | sudo tee -a /etc/apt/sources.list.d/vscode.list
    sudo apt-get update


  • Do you mean the VS Code extension Remote SSH?


    VS Code running on your windows desktop and editing files on a remote Pi with ssh connection?


    Can check tomorrow when I am closer to my pi

    If you got help in the forum and want to give something back to the project click here and write up your solution for others.

  • Do you mean the VS Code extension Remote SSH?


    VS Code running on your windows desktop and editing files on a remote Pi with ssh connection?


    Can check tomorrow when I am closer to my pi

    With this, the Pi doesn't need to have VScode installed?!?

    Quote

    No source code needs to be on your local machine to gain these benefits since the extension runs commands and other extensions directly on the remote machine.

    This looks to me that it has to be installed on the remote (Pi) machine, but would like another opinion, :/

  • VS Code will connect to the Pi via ssh and install the "server part" of VS Code automatically. There is no need to have a GUI on the Pi.


    Tried it with my Pi 1 i have here:


    This is what is show in the VS Code Output Window in Windows. DONE01-19 , gkchimz Please check your output an paste it here.
    The reason in my case is on the top:

    Code
    ssh: connect to host 192.167.7.24 port 22: Connection timed out

    If you got help in the forum and want to give something back to the project click here and write up your solution for others.

  • If you got help in the forum and want to give something back to the project click here and write up your solution for others.

  • Checked today on a Pi 4 (whithout OMV):


    • Connecting with VS Code Remote Extention works as expected
    • VS Code server part gets installed on the pi


    OMV does not change anything regarding the sshd. So i quess, your ssh connection is not configured properly in your windows %USERPROFILE%\.ssh\config file or you made a mistake by entering the ssh connection / credentials.

    If you got help in the forum and want to give something back to the project click here and write up your solution for others.

  • Do you mean the VS Code extension Remote SSH?


    VS Code running on your windows desktop and editing files on a remote Pi with ssh connection?


    Can check tomorrow when I am closer to my pi

    This is precisely what I want to do.


    VS Code will connect to the Pi via ssh and install the "server part" of VS Code automatically. There is no need to have a GUI on the Pi.


    Tried it with my Pi 1 i have here:


    This is what is show in the VS Code Output Window in Windows. DONE01-19 , gkchimz Please check your output an paste it here.
    The reason in my case is on the top:

    Code
    ssh: connect to host 192.167.7.24 port 22: Connection timed out

    Same prolem here 🙄...

    Code
    Failed to parse remote port from server output
  • scroll to the top and see what is in the loga before this. The reason in the case i demonstrated was the wrong ip address and a connection timeout.


    post the whole contents of the window please, not only a single line.

    If you got help in the forum and want to give something back to the project click here and write up your solution for others.

  • You mean Raspberry Pi Desktop? Or Raspberry OS Lite?

    Desktop...


    (because I wanted to maintain the ability to access the root system via RDP. Ironically this isn't working either at the moment. But it did in the past, so I assume it's a bullseye related issue. - That's next on my bugfixing list :D)

  • alright guys, I was able to solve the problem - here is what helped:


    I had specified on ssh config file for both Windows Terminal and VS Code.

    Also in the Remot SSH extension menu, there was still a range of old hosts stored.


    I have now both created a specific ssh file for VS Code and deleted the deprecated hosts.


    Now I am able to login successfully via VS Code over ssh.


    Thanks you so much for helping to solve this one.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!