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

Terminal doesn't launch under 64 bit #27915

Closed
dbaeumer opened this Issue Jun 2, 2017 · 12 comments

Comments

Projects
None yet
5 participants
@dbaeumer
Member

dbaeumer commented Jun 2, 2017

  • VSCode Version: 1.13
  • OS Version: Windows 64 / Code 64

I have setup my terminal path like this: "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\cmd.exe"

Trying to open the terminal results in the blank terminal with a cursor.

@dbaeumer

This comment has been minimized.

Show comment
Hide comment
@dbaeumer

dbaeumer Jun 2, 2017

Member

"C:\\WINDOWS\\Sysnative\\bash.exe" doesn't work either.

Member

dbaeumer commented Jun 2, 2017

"C:\\WINDOWS\\Sysnative\\bash.exe" doesn't work either.

@dbaeumer

This comment has been minimized.

Show comment
Hide comment
@dbaeumer

dbaeumer Jun 2, 2017

Member

Commenting out the setting which defaults to PowerShell works.

Member

dbaeumer commented Jun 2, 2017

Commenting out the setting which defaults to PowerShell works.

@Tyriar Tyriar added this to the June 2017 milestone Jun 2, 2017

@Tyriar Tyriar added the windows label Jun 2, 2017

@Tyriar Tyriar modified the milestones: June 2017, July 2017 Jun 22, 2017

@chriswiley

This comment has been minimized.

Show comment
Hide comment
@chriswiley

chriswiley Jul 13, 2017

Using VSCode Insiders 1.15 64-bit in Windows 10 and can't get bash to work either. Powershell works fine. But when I upgraded to 64-bit bash stopped working.

chriswiley commented Jul 13, 2017

Using VSCode Insiders 1.15 64-bit in Windows 10 and can't get bash to work either. Powershell works fine. But when I upgraded to 64-bit bash stopped working.

@dragonwolf83

This comment has been minimized.

Show comment
Hide comment
@dragonwolf83

dragonwolf83 Jul 14, 2017

The 64-bit builds of VS Code need to update the default configuration paths that reference sysnative and change to system32. The sysnative path is a virtualized path that only exists within 32-bit apps as an escape to find the real 64-bit directory which has always been system32.

So in your example, you need to use "C:\\WINDOWS\\System32\\cmd.exe" to get 64-bit cmd.

If you need to get the 32-bit versions, you would need to use SysWow64.

dragonwolf83 commented Jul 14, 2017

The 64-bit builds of VS Code need to update the default configuration paths that reference sysnative and change to system32. The sysnative path is a virtualized path that only exists within 32-bit apps as an escape to find the real 64-bit directory which has always been system32.

So in your example, you need to use "C:\\WINDOWS\\System32\\cmd.exe" to get 64-bit cmd.

If you need to get the 32-bit versions, you would need to use SysWow64.

@Tyriar

This comment has been minimized.

Show comment
Hide comment
@Tyriar

Tyriar Jul 14, 2017

Member

Testing this out, here's what I found:

terminal.integrated.shell.windows Works?
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe ✔️
C:\WINDOWS\Sysnative\WindowsPowerShell\v1.0\powershell.exe 🚫
C:\WINDOWS\SysWow64\WindowsPowerShell\v1.0\powershell.exe ✔️ (PSReadline not loaded)
C:\WINDOWS\System32\cmd.exe ✔️
C:\WINDOWS\Sysnative\cmd.exe 🚫
C:\WINDOWS\SysWow64\cmd.exe ✔️
C:\Program Files\Git\bin\bash.exe ✔️

This was caused by me not understanding properly how Sysnative works. Here's my new understanding:

  • On 64-bit machine:
    • SysWow64 only exists on 64-bit machines
    • In 64-bit application:
      • SysWow64 contains 32-bit binaries
      • System32 contains 64-bit binaries (nothing confusing here)
      • Sysnative doesn't exist
    • In 32-bit application:
      • Applications that request System32 redirects to SysWow64
      • Sysnative only exists on 64-bit machines running 32-bit applications
      • Sysnative allows a 32-bit program to access the actual System32 containing the 64-bit binaries (instead of redirecting)

Given this, here's the logic we'll go with when selecting powershell.exe, cmd.exe and bash.exe paths:

Windows arch Application arch Path
64 64 System32
64 32 Sysnative*
32 64 N/A
32 32 System32

* perhaps we shouldn't bother with this and just use System32 (-> SysWow64) since the user explicitly requested the 32-bit version? It's probably best to assume they actually do want the 64-bit version as using the 32-bit one can lead to obscure messages that make VS Code look unreliable (like PSReadLine not working)

Member

Tyriar commented Jul 14, 2017

Testing this out, here's what I found:

terminal.integrated.shell.windows Works?
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe ✔️
C:\WINDOWS\Sysnative\WindowsPowerShell\v1.0\powershell.exe 🚫
C:\WINDOWS\SysWow64\WindowsPowerShell\v1.0\powershell.exe ✔️ (PSReadline not loaded)
C:\WINDOWS\System32\cmd.exe ✔️
C:\WINDOWS\Sysnative\cmd.exe 🚫
C:\WINDOWS\SysWow64\cmd.exe ✔️
C:\Program Files\Git\bin\bash.exe ✔️

This was caused by me not understanding properly how Sysnative works. Here's my new understanding:

  • On 64-bit machine:
    • SysWow64 only exists on 64-bit machines
    • In 64-bit application:
      • SysWow64 contains 32-bit binaries
      • System32 contains 64-bit binaries (nothing confusing here)
      • Sysnative doesn't exist
    • In 32-bit application:
      • Applications that request System32 redirects to SysWow64
      • Sysnative only exists on 64-bit machines running 32-bit applications
      • Sysnative allows a 32-bit program to access the actual System32 containing the 64-bit binaries (instead of redirecting)

Given this, here's the logic we'll go with when selecting powershell.exe, cmd.exe and bash.exe paths:

Windows arch Application arch Path
64 64 System32
64 32 Sysnative*
32 64 N/A
32 32 System32

* perhaps we shouldn't bother with this and just use System32 (-> SysWow64) since the user explicitly requested the 32-bit version? It's probably best to assume they actually do want the 64-bit version as using the 32-bit one can lead to obscure messages that make VS Code look unreliable (like PSReadLine not working)

@Tyriar

This comment has been minimized.

Show comment
Hide comment
@Tyriar

Tyriar Jul 14, 2017

Member

We also need some way of checking if Windows is 64-bit inside a 32-bit process. Right now this is being done by checking for the PROCESSOR_ARCHITEW6432 environment variable but I'm not sure this is correct as I don't see this environment variable on my machine, I do however see a PROCESSOR_ARCHITECTURE var ("AMD64"). This is the reason why the terminal works just fine using the default shell selections for me. I need to look into how to properly detect 32-bit app on a 64-bit machine.

Member

Tyriar commented Jul 14, 2017

We also need some way of checking if Windows is 64-bit inside a 32-bit process. Right now this is being done by checking for the PROCESSOR_ARCHITEW6432 environment variable but I'm not sure this is correct as I don't see this environment variable on my machine, I do however see a PROCESSOR_ARCHITECTURE var ("AMD64"). This is the reason why the terminal works just fine using the default shell selections for me. I need to look into how to properly detect 32-bit app on a 64-bit machine.

@Tyriar

This comment has been minimized.

Show comment
Hide comment
@Tyriar
Member

Tyriar commented Jul 14, 2017

@Tyriar Tyriar closed this in e026e5e Jul 14, 2017

@Tyriar

This comment has been minimized.

Show comment
Hide comment
@Tyriar

Tyriar Jul 14, 2017

Member

I pushed a fix for this. If someone who was experiencing the issue check with the defaults tomorrow that would be great. If it is happening, please let me know what the value for terminal.integrated.shell.windows is coming out as in the defaults. Also remember it's expected that if Sysnative is in your user settings it will not work.

Member

Tyriar commented Jul 14, 2017

I pushed a fix for this. If someone who was experiencing the issue check with the defaults tomorrow that would be great. If it is happening, please let me know what the value for terminal.integrated.shell.windows is coming out as in the defaults. Also remember it's expected that if Sysnative is in your user settings it will not work.

@chriswiley

This comment has been minimized.

Show comment
Hide comment
@chriswiley

chriswiley Jul 15, 2017

I am running 1.15 right now and used:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe"

To get bash working. Is this the recommended path to use? I mean, it is working now.

chriswiley commented Jul 15, 2017

I am running 1.15 right now and used:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe"

To get bash working. Is this the recommended path to use? I mean, it is working now.

@Tyriar

This comment has been minimized.

Show comment
Hide comment
@Tyriar

Tyriar Jul 15, 2017

Member

@chriswiley yes that's the recommended path

Member

Tyriar commented Jul 15, 2017

@chriswiley yes that's the recommended path

@Tyriar Tyriar marked this as a duplicate of #31335 Jul 24, 2017

@Tyriar Tyriar marked this as a duplicate of #31340 Jul 24, 2017

@seanmcbreen

This comment has been minimized.

Show comment
Hide comment
@seanmcbreen

seanmcbreen Jul 25, 2017

Contributor

@Tyriar I ran into this on my fresh 64bit Insiders. I had CMD set up sysnative and I would get no terminal undefined. I had to manually change this to the System32 path and things worked fine. The hover suggested I should do the opposite and intuitively System32 seams like the wrong thing on my 64bit VS Code instance.

Either way I had to take a manual step to get things working it would be great to avoid that.

image

Contributor

seanmcbreen commented Jul 25, 2017

@Tyriar I ran into this on my fresh 64bit Insiders. I had CMD set up sysnative and I would get no terminal undefined. I had to manually change this to the System32 path and things worked fine. The hover suggested I should do the opposite and intuitively System32 seams like the wrong thing on my 64bit VS Code instance.

Either way I had to take a manual step to get things working it would be great to avoid that.

image

@seanmcbreen seanmcbreen reopened this Jul 25, 2017

Tyriar added a commit that referenced this issue Jul 27, 2017

@Tyriar Tyriar closed this Jul 28, 2017

Tyriar added a commit that referenced this issue Jul 31, 2017

@Tyriar

This comment has been minimized.

Show comment
Hide comment
@Tyriar

Tyriar Jul 31, 2017

Member

I've pushed a change that should makes sysnative paths just work by mapping them to system32 on non WoW64 (Windows 32 process on Windows 64) environments. It should just work without any action in tomorrow's build.

Member

Tyriar commented Jul 31, 2017

I've pushed a change that should makes sysnative paths just work by mapping them to system32 on non WoW64 (Windows 32 process on Windows 64) environments. It should just work without any action in tomorrow's build.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.