maxwell.martin
maxwell.martin

Reputation: 51

VS Code and WSL Integrated Terminal - I cannot set WSL as my default terminal

After selecting WSL as my default terminal in Visual Studio code, I am unable to open up a terminal window. The terminal window opens, random text appears on the screen, and then the terminal closes with an error message that says: "The terminal process terminated with exit code: 4294967295".

Does anyone know why this is? I have looked at some of the vscode github issue posts, but I can't seem to make anything work.

See screenshot of my settings.json file and a gif of what is happening below:

settings.json

gif of me trying to open a wsl integrated terminal

Upvotes: 5

Views: 11382

Answers (8)

Ender Bonnet
Ender Bonnet

Reputation: 163

On vscode 1.85.1, is working just by adding in my settings:

"terminal.integrated.defaultProfile.windows": "Ubuntu (WSL)",

Upvotes: 0

When try to open WSL from VSCode was getting error

The terminal process "C:\WINDOWS\System32\wsl.exe" terminated with exit code: 4294967295.

Similar error when tried to execute C:\WINDOWS\System32\wsl.exe from Windows Console (cmd.exe)

Did a WSL shutdown from Windows Console (wsl --shutdown) and got the popup below. Re-started Docker and could open WSL from VS Code.

Docker restart

Upvotes: 1

Adrian Escutia
Adrian Escutia

Reputation: 1069

Similar issue as in https://stackoverflow.com/a/70035055/5078874

Instead of terminal.integrated.shell.windows.

Use setting like this: "terminal.external.windowsExec": "wsl.exe"

Upvotes: 0

rdelgado-incinc
rdelgado-incinc

Reputation: 177

Answer updated for vs code 1.56.2. I started seeing a warning in my Settings.json. Here's how I managed to do this:

Settings.json:

 "terminal.integrated.defaultProfile.windows": "WSL",
 "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"            
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        },
        "WSL": {
            "path": [
                "C:\\WINDOWS\\System32\\wsl.exe"
            ],
            "args": [],
            "icon": "terminal-ubuntu-wsl"
        }
  },  

Upvotes: 4

sadid arhamar
sadid arhamar

Reputation: 11

I have the same problem, here is how i fix it

  1. go to control panel -> Programs -> turn windows features on or off -> check list Windows Subsytem for linux how to check list
  2. next go to Microsoft Store search for ubuntu then install , i did get an error like you so i install Ubuntu 20.04 LTS. now i have 2 types of ubuntu installed
  3. lastly open cmd -> right click -> properties -> then uncheck use legacy console how to uncheck use legacy console

Upvotes: 0

Zakaria
Zakaria

Reputation: 1085

if you have a line in the settings.json file like this

"terminal.integrated.shellArgs.windows": ["--login", "-i"],

just remove it, or comment out this line to be like this

//"terminal.integrated.shellArgs.windows": ["--login", "-i"],

Finally, change the terminal.integrated.shell.windows settings to be like this

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

Upvotes: 4

Astor Ayestas
Astor Ayestas

Reputation: 27

Open your settings.json file and change the line to:

"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"

Upvotes: 0

vishal singh
vishal singh

Reputation: 1

This problem might occur when you don't have Ubuntu or any other linux installed in system.

You can install Ubuntu through Microsoft store in Windows:

https://www.youtube.com/watch?v=wM-wBciLeDw

Upvotes: 0

Related Questions