vscode-bash-debug: bash not found - wsl

Windows Version: 10.0.15063 - 1703 (Creators Update)

Executables

Version of bash-debug: 0.3.2 WSL bash.exe Version: 10.0.15063.0 WSL bash version: 4.3.48(1)-release WSL bashdb version: bashdb, release 4.3-0.91 WSL Distro: Ubuntu 16.04.5 LTS (should be the default)

Output of following commands (on windows, execute them in Command Prompt or PowerShell):

where bash
C:\Users\asaf.levy>where bash
C:\Windows\System32\bash.exe

code --version
C:\Users\asaf.levy>code --version
1.27.2
f46c4c469d6e6d8c46f268d1553c5dc4b475840f
x64

bash -c 'uname -a; for P in bash bashdb cat mkfifo pkill; do echo ---; which -a $P; command $P --version; done'
C:\Users\asaf.levy>bash -c 'uname -a; for P in bash bashdb cat mkfifo pkill; do echo ---; which -a $P; command $P --version; done'
Linux AsafL-T450 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
---
/bin/bash
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
---
/usr/bin/bashdb
bashdb, release 4.3-0.91
---
/bin/cat
cat (GNU coreutils) 8.25
Written by Torbjörn Granlund and Richard M. Stallman.
---
/usr/bin/mkfifo
mkfifo (GNU coreutils) 8.25
Written by David MacKenzie.
---
/usr/bin/pkill
pkill from procps-ng 3.3.10

NOTE: I allowed myself to remove all the Licensing text lines (for readability)

Debug output

No debug output is given, only the message box error. My launch.json looks like:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "bashdb",
            "request": "launch",
            "name": "Bash-Debug (hardcoded script name)",
            "cwd": "${workspaceFolder}",
            "trace": true,
            "showDebugOutput": true,
            "program": "${workspaceFolder}/ssm-cleanup.sh",
            "args": []
        },
        {
            "type": "bashdb",
            "request": "launch",
            "name": "Bash-Debug (select script from list of sh files)",
            "cwd": "${workspaceFolder}",
            "trace": true,
            "showDebugOutput": true,
            "program": "${command:SelectScriptName}",
            "pathBash": "C:\\Windows\\System32\\bash.exe",
            "args": []
        }
    ]
}

Details

After the latest updates, Debugging bash in vscode on windows 10 ontop the wsl has stopped working, Probably due this commit: https://github.com/rogalmic/vscode-bash-debug/commit/3bbc0e817048ded1cbbb927b6755e5250090a8b2 which made it into 0.3.1+

Screenshots: default config override config launch.json + terminal showing bash

before that debugging worked flawlessly (apart the known limitation), now I see some changes have been made and a new argument\property called ‘pathBash’ is added, but I couldn’t find documentation about it…

Bash.exe is 100% in Windows’s PATH, as it resides in it’s default location, and works when openning from cmd.exe, or from vscode…

Also, Attempting to manually set the ‘launch property’ ‘pathBash’ to the actual location on my version on windows, which is the old path (“C:\Windows\System32\bash.exe” - with double \ in launch json) Fails. Tried the different launch configuration options as well, no luck…

so Bash Debug extension is broken on older windows 10, where it worked before

For now my only workaround is to use the older vsix before the changes (v0.2.2 as it seems like)

  1. How can I further help promote this issue?
  2. Thank you very much for this extension, IT IS AWESOME! I greatly appreciate the work done on this…

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

Default terminalKind is integrated (which can be set in preferences). This means that it tries to run bash (which would be preferred), but since you have this beta WSL it fails with this interop error.

For this beta WSL, the simplest thing is to use terminalKind: debugConsole, which in practice is not terminal, but just debug output. The downside: no stdin, but there is a workaround here .

If i find design way to pass input to debugConsole, I will update build here.

As a sidenote: biggest issue with powershell is qouting :

There are some issues that make this fix especially tricky:

  1. Related to wsl issue:
  • there needs to be a way to select proper bash version within linux, ie: /bin/bash vs /usr/bin/env/bash, which was the intent of recent pathBash change in marketplace version of extension, so WSL exe name/location needs to be separate setting or hardcoded
  • bashPath is not used only via terminal, but also to verify variables and there is also separate process to read message pipes for debugger (separate spawn process calls)
  • I would not like to make assumption about terminal unless i find a way to properly inform user about wrong terminal setting (possibly also auto change to bash terminal), not sure how to do that yet
  • lot of the extension code is WSL handling, so I would like not to extend this too much - especially for beta WSL
  1. Local variables are currently hardcoded to show only $? and $PWD and you mentioned they are shown. Did you mean watch variables are not shown?

Currently to nr 1. issue i see following fixes:

  • [IF WSL] check if terminal is bash, if not -> inform user and give some UI interaction to change terminal in workspace settings (in this case no need to run exe in terminal, because terminal is already in WSL)
  • expand terminalKind to integrated | external | debugConsole, where debugConsole would work as in previous versions (which would be terminal independent, but no stdin like in older versions)

I think I will start with extending terminalKind #95 in this case, because all of the OSes will benefit from that.