Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformIO IDE extension does not work with Remote Development using SSH #942

Open
pbolduc opened this issue Jul 31, 2019 · 20 comments
Open

Comments

@pbolduc
Copy link

pbolduc commented Jul 31, 2019

I am trying to use Remote Development using SSH with PlatformIO IDE. Remote Development using SSH is a preview feature, but would be great if this would work in the future.

https://code.visualstudio.com/docs/remote/ssh

I followed Scott Hanselman's blog to set up my environment, https://www.hanselman.com/blog/VisualStudioCodeRemoteDevelopmentOverSSHToARaspberryPiIsButter.aspx

My use case is I want to develop for the Raspberry PI using C/C++ and to use the awesome Platform IO to managed dependencies and build process.

PlatformIO IDE: 1.8.1

image

@ivankravets
Copy link
Member

Could you run in this RPi terminal $ pio home --no-open? Do you see any errors?

@pbolduc
Copy link
Author

pbolduc commented Aug 11, 2019

There are no errors. I get

  ___I_
 /\-_--\   PlatformIO Home
/  \_-__\
|[]| [] |  http://127.0.0.1:8008
|__|____|_______________________

Open PIO Home in your browser by this URL => http://127.0.0.1:8008
PIO Home has been started. Press Ctrl+C to shutdown.

image

@pbolduc
Copy link
Author

pbolduc commented Aug 12, 2019

I had the window open since I took the screen shot above and the PIO Home screen and libraries show up...

@ivankravets
Copy link
Member

Ah, yes! It will not work. You run PIO Home Server on the remote machine via SSH where PIO Home Backend points to localhost. You can open PIO Home in your standalone browser via http://your-rpi-ip:8008.

@IBlackI
Copy link

IBlackI commented Dec 29, 2019

Is there any way to have the window in visual studio code point to a remote adress? This is also an issue when using Remote Developent through for example code-server

@VishalDhayalan
Copy link

I'm having the same problem when trying to get it to work on the Raspberry Pi.
image
The PIO home page never loads and I get this error:
image

I also noticed the C/C++ extension that PIO depends on throws an error saying ARM is not supported:
image

Any fix for this?

@piccaso
Copy link

piccaso commented Jan 10, 2020

As a workaround for the connection issue adding this to the ssh_config seems to work:

LocalForward 127.0.0.1:8010 127.0.0.1:8010

However, when i created a new Project named 'bpTest' it was created as ~/Documents/PlatformIO/Projects\bpTest where Projects\bpTest is a folder name.

Also C/C++ problem highlighting does not work.

So there is more to it than setting up port forwardung...
Edit:
After fixing the path manually C/C++ problem highlighting works and I cant find any other issue.

@VishalDhayalan
Copy link

As a workaround for the connection issue adding this to the ssh_config seems to work:

LocalForward 127.0.0.1:8010 127.0.0.1:8010

However, when i created a new Project named 'bpTest' it was created as ~/Documents/PlatformIO/Projects\bpTest where Projects\bpTest is a folder name.

Also C/C++ problem highlighting does not work.

So there is more to it than setting up port forwardung...
Edit:
After fixing the path manually C/C++ problem highlighting works and I cant find any other issue.

I didn't have any ssh problems, but could you please elaborate on how you fixed the path manually? And is this on an ARM architecture (such as the raspberry pi)? Thanks.

@Turiok
Copy link

Turiok commented Feb 24, 2020

Thx @VishalDhayalan.

Works for me :).
In your ssh/config file, The description of your remote, you add the line from @VishalDhayalan :
LocalForward 127.0.0.1:8010 127.0.0.1:8010
It'll forward the port between your host and remote. So VScode will displayed on localhost:8010 the localhost:8010 of your VM.

@Turiok
Copy link

Turiok commented Mar 3, 2020

Sadly, the window appear.
But when I want to import a arduino project.
I can't display my folder tree than one level.

$ ls -l workspace/
drwxrwxr-x  7 vagrant vagrant 4096 Feb  6 19:20 ESP32
drwxrwxr-x  9 vagrant vagrant 4096 Feb 22 12:28 MQTTnet

platformioError

Even If I want to see the content of folder in /tmp, doesn't work.
If I open the webpage from host webbrowser it doesn't work.
But If I open the webpage on guest webbrowser, it works

After searching, I found this : https://docs.platformio.org/en/latest/userguide/cmd_home.html#cmd-home
Default host option is 127.0.0.1. So if you want used with outbound connection, you have to put 0.0.0.0. I tried launching this command :

pio home --host 0.0.0.0 --no-open

Now I can open the webpage with host webbrowser.
But I have the same problem with the vscode image. I can't display my folder tree.
I can't open project. Maybe a Windows/Linux path problem.

Error: {'code': -32000, 'message': 'Server error', 'data': {'type': 'FileNotFoundError', 'args': (2, 'No such file or directory'), 'message': "[Errno 2] No such file or directory: '/home/vagrant/Documents/PlatformIO/Projects/200303-200258-esp32dev\\\\platformio.ini'"}}
API Exception: {'type': 'FileNotFoundError', 'args': (2, 'No such file or directory'), 'message': "[Errno 2] No such file or directory: '/home/vagrant/Documents/PlatformIO/Projects/200303-200258-esp32dev\\\\platformio.ini'"}

Here my path :

╰─ ll ~/Documents/PlatformIO/Projects/200303-200258-esp32dev/
total 20K
drwxrwxr-x 2 vagrant vagrant 4.0K Mar  3 20:02 include
drwxrwxr-x 2 vagrant vagrant 4.0K Mar  3 20:02 lib
-rw-rw-r-- 1 vagrant vagrant  440 Mar  3 20:04 platformio.ini
drwxrwxr-x 2 vagrant vagrant 4.0K Mar  3 20:02 src
drwxrwxr-x 2 vagrant vagrant 4.0K Mar  3 20:02 test

@Turiok
Copy link

Turiok commented Mar 5, 2020

Hello again,

I think I found the problem :)
So a summarize.
I run vscode on windows host with remote ssh extension on a linux guest.
platformio extension is installed on guest.
After adding the port forwarding to my ssh config.
(To make it work, we can launch pio with --host 0.0.0.0 to accept outbound config)
I have the page but I can't navigate in my file system.

For me it's a problem of Windows/Linux useragent problem.
What are my tests.
I launch a new instance of pio on my guest

pio home --host 0.0.0.0 --port 8008 --no-open

I launch firefox on my host with guest ip. Same problem than vscode.
But if I launch firefox on an other linux computer. Navigation works and folder creation too. Miracle :)
I tried to install an extension on firefox to change useragent.
The goal is to send an useragent with linux OS with my firefox on windows.
I use the useragent modifier extension below. Change the useragent in the websocket connection and it works.
https://add0n.com/useragent-switcher.html?version=0.3.4&type=install
Now I don't know how to update vscode to change the user agent and the impact for this app

@MBetters
Copy link

MBetters commented Jun 2, 2020

Another issue in remote-SSH is that PIO Home --> New Project is showing host filesystem, not guest filesystem.

@stale stale bot added the stale label Sep 11, 2020
@platformio platformio deleted a comment from stale bot Sep 16, 2020
@septatrix
Copy link

However, when i created a new Project named 'bpTest' it was created as ~/Documents/PlatformIO/Projects\bpTest where Projects\bpTest is a folder name.

I do not exactly know what causes this. After looking a bit in the source code I was however able to find some places where we use the native fs module instead of the one provided by the VSCode API. This may lead to such problems. Even if it does not lead to problems the usage of the native module is discouraged anyways as it apparently runs in the editor process unlike most other stuff accessible over the vscode api. Currently I do not have a remote machine setup with which I could test this but I may be able to in a few days...

@paloj
Copy link

paloj commented Mar 17, 2021

image

I have this same issue. Im using vscode locally on windows with ssh remote connection to mac mini m1 which has an arduino board attached to it.

@hazza64
Copy link

hazza64 commented Mar 21, 2021

I am also having this exact same issue, even though from memory it was working a while ago.
Setup:

  • VSCode installed on a Windows 10 desktop
  • Remote - SSH (Nightly) extension installed locally
  • PlatformIO IDE installed remotely on target (Raspberry Pi 4 running Rasbian)
  • C/C++ Installed remotely (Raspberry Pi 4)

Opening the PIO Home screen shows nothing.

I was doing some research (but lost the links -_-) that suggests it may be an issue with it using the Windows Filesystem on the remote target (in this case Rasbian GNU/Linux).
Seems like they're on it; issue linked here platformio/platformio-core#3681

@arpaterson
Copy link

I have also run into this.
Windows 11 VSCode+PlatformIO -> Remote SSH extension -> Jetson Orin developer kit -> Feather M4 Express
Platform IO extension installed thru client VScode on both client (win11) and orin (ubuntu 20.04)

I'd like to be able to use either of two work flows:

  • Code and build on windows 11, but remote upload to the Feather. (Only the upload tool runs remotely)
  • Code on windows 11 thru Remote SSH - so the project resides on the remote (PlatformIO itself, project files, and build tool all remote).

@Hsun1031
Copy link

Hsun1031 commented Feb 22, 2023

  1. Use VS Code's SSH remote feature to access your computer remotely.
  2. Go to the PlatformIO Extensions settings and set the "PlatformIO-IDE: Pio Home Server Http Port" to a value such as 8080 in your user settings.
  3. Set the same port in the remote settings for Remote[ssh:www .example. com].
  4. To forward the port, press F1 and select "Ports: Focus on Ports View", then choose "Forward a Port" and add port 8080.
  5. Finally, you will be able to use PIO Home.

@Brechtjeu
Copy link

@Hsun1031 are you also able to create a new project this way? I cannot. Idon't see the remote filesystem and when I create the project, I get a folder at an unusable path with only half and installation (esp32 esp-idf framework)

@Hsun1031
Copy link

@Brechtjeu I have tested that Ubuntu can connect to Ubuntu, but Windows cannot connect to Ubuntu.

@luxk3
Copy link

luxk3 commented Jul 9, 2023

Hello everybody, I was trying to solve a different issue, and I took a similar road to the one described here. I know my use-case is a bit different, but I wrote a short guide. I leave it here as reference, it might be helpful to somebody else.

https://github.com/luxk3/ubuntu_server_remote_dev_platformio

luxk3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests