question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug Report]: Flashing through WSL1 environment not working since v0.6.0 (VSC-549)

See original GitHub issue

Pre Bug Report Checklist Before reporting any bug please make sure of these points.

  • Make sure you have searched for existing bugs and features request before you post an issue.
  • This is a bug report for the ESP-IDF Visual Studio Code extension and not an ESP-IDF bug report.
  • I’ve read the docs and found no information that could have helped solving the issue.

Describe the bug Since updating to v0.6.0 the extension (that is installed in WSL debian and runs in VSC installed on Win 10) is fetching serial ports from Windows 10 instead of WSL1. . On version v.0.5.1 it shows /dev/ttySx ports correctly from WSL environment. Since v0.6.0 I get COMx from Windows environment.

When I try to flash the project, it runs the flash process via powershell.exe which does not exist in WSL Linux environment. (I have also tried manually overriding idf.port in settings.json to "idf.port": "/dev/ttyS4" instead of COM4 that was provided via UI serial port selector with the same result)

Executing task: powershell.exe -Command "python \\\\wsl$\\Debian\\home\\username\\esp\\esp-idf\\components\\esptool_py\\esptool\\esptool.py -p /dev/ttyS4 -b 460800 --after hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x8000 partition_table\partition-table.bin 0x1000 bootloader\bootloader.bin 0x10000 app.bin"

As I don’t have python in Windows environment installed, this will end up in message

Python was not found; run without arguments to install from the Microsoft Store,
 or disable this shortcut from Settings > Manage App Execution Aliases.

I’m able to build project via WSL environment, so this applies only for selecting serial port and flashing.

To Reproduce

  1. Have WSL1 installed
  2. Run VSC project in Remote-WSL environment
  3. Build project
  4. Select serial port of ESP32 connected via USB Expected behavior: it will give you Linux /dev/ttySx serial ports to choose from Actual behavior: it will give Windows COMs instead
  5. Flash project via USB Expected behavior: it will run python directly from WSL environment Actual behavior: it will run powershell.exe in WSL environment

Expected behavior ESP-IDF extension should use Linux environment only tools if it’s running inside Remote-WSL environment in VSC.

Screenshots Not needed. I can provide some if demanded.

Environment (please complete the following information):

  • OS Name & Version: Windows 10 1909
  • VSCode Version: 1.52.1 (installed on WSL Debian)
  • ESP-IDF Version: 4.1
  • Python Version: 3.5
  • WSL - WSL1 Debian
  • Remote-WSL - remote-wsl-0.52.0

Logs If applicable, please share the log file which can be obtained from

{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)","level":"error","timestamp":"2021-01-16T10:31:22.025Z"}
{"message":"ESP-IDF Terminal process ended with exit code 1.","stack":"Error: ESP-IDF Terminal process ended with exit code 1.\n\tat ChildProcess.<anonymous> (/home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:258814)\n\tat ChildProcess.emit (events.js:223:5)\n\tat Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)","level":"error","timestamp":"2021-01-16T10:31:47.799Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Socket.<anonymous> (internal/child_process.js:430:11)\n\tat Socket.emit (events.js:223:5)\n\tat Pipe.<anonymous> (net.js:664:12)","level":"error","timestamp":"2021-01-16T10:32:24.142Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Socket.<anonymous> (internal/child_process.js:430:11)\n\tat Socket.emit (events.js:223:5)\n\tat Pipe.<anonymous> (net.js:664:12)","level":"error","timestamp":"2021-01-16T10:37:59.130Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)","level":"error","timestamp":"2021-01-16T10:40:41.486Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)","level":"error","timestamp":"2021-01-16T10:40:42.552Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Socket.<anonymous> (internal/child_process.js:430:11)\n\tat Socket.emit (events.js:223:5)\n\tat Pipe.<anonymous> (net.js:664:12)","level":"error","timestamp":"2021-01-16T10:49:34.094Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)","level":"error","timestamp":"2021-01-16T10:49:35.695Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)","level":"error","timestamp":"2021-01-16T10:51:25.678Z"}
{"user":true,"message":"Failed to flash because of some unusual error","stack":"Error: Task ESP-IDF Flash exited with code 1\n\tat Function.<anonymous> (/home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:47342)\n\tat Generator.next (<anonymous>)\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:45946\n\tat new Promise (<anonymous>)\n\tat o (/home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:45691)\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:47206\n\tat l.fire (/home/username/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/out/vs/server/remoteExtensionHostProcess.js:46:801)\n\tat _.$onDidEndTaskProcess (/home/username/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/out/vs/server/remoteExtensionHostProcess.js:954:168)\n\tat processTicksAndRejections (internal/process/task_queues.js:94:5)","level":"error","timestamp":"2021-01-16T10:51:28.926Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)","level":"error","timestamp":"2021-01-16T10:59:00.422Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Socket.<anonymous> (internal/child_process.js:430:11)\n\tat Socket.emit (events.js:223:5)\n\tat Pipe.<anonymous> (net.js:664:12)","level":"error","timestamp":"2021-01-16T11:00:18.723Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Socket.<anonymous> (internal/child_process.js:430:11)\n\tat Socket.emit (events.js:223:5)\n\tat Pipe.<anonymous> (net.js:664:12)","level":"error","timestamp":"2021-01-16T11:11:03.388Z"}
{"message":"Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:15)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7658\n\tat ChildProcess.exithandler (child_process.js:286:7)\n\tat ChildProcess.emit (events.js:223:5)\n\tat maybeClose (internal/child_process.js:1021:16)\n\tat Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)","level":"error","timestamp":"2021-01-16T11:11:11.262Z"}
{"user":true,"message":"Failed to flash because of some unusual error","stack":"Error: Task ESP-IDF Flash exited with code 1\n\tat Function.<anonymous> (/home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:47342)\n\tat Generator.next (<anonymous>)\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:45946\n\tat new Promise (<anonymous>)\n\tat o (/home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:45691)\n\tat /home/username/.vscode-server/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:47206\n\tat l.fire (/home/username/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/out/vs/server/remoteExtensionHostProcess.js:46:801)\n\tat _.$onDidEndTaskProcess (/home/username/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/out/vs/server/remoteExtensionHostProcess.js:954:168)\n\tat processTicksAndRejections (internal/process/task_queues.js:94:5)","level":"error","timestamp":"2021-01-16T11:11:13.776Z"}

Extension Configuration settings

{
    "idf.espIdfPath": "/home/username/esp/esp-idf",
    "idf.toolsPath": "/home/username/.espressif",
    "idf.pythonBinPath": "/home/username/.espressif/python_env/idf4.1_py3.5_env/bin/python",
    "idf.customExtraPaths": "/home/username/.espressif/python_env/idf4.1_py3.5_env/bin:/usr/bin:/home/username/.espressif/tools/xtensa-esp32-elf/esp-2020r2-8.2.0/xtensa-esp32-elf/bin:/home/username/.espressif/tools/xtensa-esp32s2-elf/esp-2020r2-8.2.0/xtensa-esp32s2-elf/bin:/home/username/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:/home/username/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin:/home/username/.espressif/tools/openocd-esp32/v0.10.0-esp32-20191114/openocd-esp32/bin",
    "idf.customExtraVars": "{\"OPENOCD_SCRIPTS\":\"/home/username/.espressif/tools/openocd-esp32/v0.10.0-esp32-20191114/openocd-esp32/share/openocd/scripts\"}",
    "idf.port": "COM4",
    "idf.flashType": "UART"
}

Additional context Downgrading to v0.5.1 fixed the problem and I can flash again.

My guess is this is related to a PR https://github.com/espressif/vscode-esp-idf-extension/pull/224

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
brianignacio5commented, Jan 18, 2021

Thanks for reporting this. We tried to fix the issue in WSL 2 of serial ports are not available by using windows host python instead of Linux tools as explained in WSL doc. I can see how this affect WSL 1 behavior. Will fix soon to avoid using this method on WSL 1.

0reactions
brianignacio5commented, Feb 26, 2021

I think I found the problem - in your PR #298 with the fix you didn’t include the condition in flash/flashTask.ts (block between lines 82 and 91) I’ve opened PR with a fix #331 331

Oh wow ! Thanks for looking into it @risinek and your PR 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Windows Subsystem for Linux | Microsoft Learn
In this article. File an issue, bug report, feature request; Installation issues; Common issues; Using older versions of Windows and WSL ...
Read more >
Windows window constantly losing focus and flickering #443
This issue makes the Greenshot screen capture utility non-functional. I only see the problem with systems that have a NVIDIA GPU. On my...
Read more >
Developing in WSL - Visual Studio Code
Using Visual Studio Code Remote Development with the Windows Subsystem for Linux (WSL)
Read more >
Setting up the Build Environment on Windows 10/11 using ...
Setting up the Build Environment on Windows 10/11 using WSL1 or WSL2¶. These setup instructions describe how to set up “Windows Subsystem for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found