Windows 10: WSL2 fails to inherit Windows Environment PATH variable Code

Discus and support WSL2 fails to inherit Windows Environment PATH variable Code in Windows 10 Software and Apps to solve the problem; I had a perfect Debian environment working in WSL2 on my Surface Laptop 2 until yesterday, when an attempt to play around with an unstable build... Discussion in 'Windows 10 Software and Apps' started by scipius02, Sep 1, 2020.

  1. scipius02 Win User

    WSL2 fails to inherit Windows Environment PATH variable Code


    I had a perfect Debian environment working in WSL2 on my Surface Laptop 2 until yesterday, when an attempt to play around with an unstable build resulted in me needing to reinstall the distro. However, upon reinstall, I was unable to access the previously usable Code variable in WSL. I have checked the environment variables - I added "C:\Users\USER\AppData\Local\Programs\Microsoft VS Code\bin" to the local user. Thinking it was an access issue, I went ahead and added it to the system variables as well. I have also attempted a complete reinstall of Windows 10 from Cloud, and reproduced the previous steps.


    I'm thinking there may be some error in variable sharing between Windows and WSL. "https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/" seemed to point in the right direction but I'm fairly certain I never had to mess around with WSLENV previously - my working build inherited directly properly.


    There are also decent guides peppered around for editing bashrc directly in Linux or Mac but I'm worried that this will override some important functionality in WSL.


    Is there a command on the Windows side that can help grant its PATH to the WSL?


    OS Name Microsoft Windows 10 Home
    Version 10.0.19041 Build 19041
    Other OS Description Not Available
    OS Manufacturer Microsoft Corporation
    System Name DESKTOP-U5ENFJ0
    System Manufacturer Microsoft Corporation
    System Model Surface Laptop 2
    System Type x64-based PC
    System SKU Surface_Laptop_2_1769_Consumer
    Processor IntelR CoreTM i5-8250U CPU @ 1.60GHz, 1800 Mhz, 4 Cores, 8 Logical Processors
    BIOS Version/Date Microsoft Corporation 138.3261.768, Not Available
    SMBIOS Version 3.2
    Embedded Controller Version 255.255
    BIOS Mode UEFI
    BaseBoard Manufacturer Microsoft Corporation
    BaseBoard Product Surface Laptop 2
    BaseBoard Version Not Available
    Platform Role Mobile
    Secure Boot State On
    PCR7 Configuration Elevation Required to View
    Windows Directory C:\WINDOWS
    System Directory C:\WINDOWS\system32
    Boot Device \Device\HarddiskVolume1
    Locale United Kingdom

    :)
     
    scipius02, Sep 1, 2020
    #1

  2. WSL2 and Environment Variables

    I am trying to install Selenium and build a python application that includes automating web page completion (login info). I would like to built the program using VSCode and WSL2. I've installed selenium in WSL2. Selenium requires a webdriver api to
    be installed and included on the system PATH in the environment variables. If I install the msedgedriver.exe for Windows, in Windows, and add it to PATH, will it work with Selenium installed on WSL2 in VSCode using Python?
     
    JohnSampson5, Sep 1, 2020
    #2
  3. MCK
    mck Win User
    System environment variable won't stick

    Running Win10 Home on an Acer Spin 3, 64bit, i7cpu. I try to add a path to the system environment variables by:

    1. Control Panel > System > Advanced system settings > Advanced tab > Environment variables

    2. The "Environment Variables" window opens.
    3. In the "System Variables" pane I select "Path" and click the EDIT button.
    4. A list of the current system paths is displayed.
    5. I click the NEW button, browse to the path I want to add which is "C:\Python36-32" and click OK. The path "C:\Python36-32" is added to the list of current system paths.
    6. I click OK and am returned to the "Environment Variables" window.
    7. I click the "X" at the top right to close the "Environment Variables" window.

    Now if I click the "Environment Variables" button again (end of step-1) and repeat steps 2-4, the new path I added in step-5 is gone. IOW, adding a new path won't stick.

    What am I doing wrong?
     
  4. WSL2 fails to inherit Windows Environment PATH variable Code

    Accidentally deleted the path of environment variables

    I accidentally deleted the path of system environment variables, instead of editing it and adding a new one, in my Windows 10 Dell Laptop. I lost all the default variables that were there. How do I restore the previous variables? Please help
     
    AishwaryaC, Sep 1, 2020
    #4
Thema:

WSL2 fails to inherit Windows Environment PATH variable Code

Loading...
  1. WSL2 fails to inherit Windows Environment PATH variable Code - Similar Threads - WSL2 fails inherit

  2. Powershell breaks with semicolons in the PATH environment variable

    in Windows 10 Gaming
    Powershell breaks with semicolons in the PATH environment variable: I've been going down a rabbit hole with how Powershell processes the PATH environment variable. I am developing a program that helps manage the PATH, and I recently discovered that it has issues when a path containing semicolons is added to the PATH.According to [this comment...
  3. Powershell breaks with semicolons in the PATH environment variable

    in Windows 10 Software and Apps
    Powershell breaks with semicolons in the PATH environment variable: I've been going down a rabbit hole with how Powershell processes the PATH environment variable. I am developing a program that helps manage the PATH, and I recently discovered that it has issues when a path containing semicolons is added to the PATH.According to [this comment...
  4. set path in windows 10 for environment variables

    in Windows 10 Customization
    set path in windows 10 for environment variables: Set path in windows 10 https://answers.microsoft.com/en-us/windows/forum/all/set-path-in-windows-10-for-environment-variables/b608e15a-4994-4d1a-ae4e-1d220293dc22
  5. WSL2 and Environment Variables

    in Windows 10 Customization
    WSL2 and Environment Variables: I am trying to install Selenium and build a python application that includes automating web page completion login info. I would like to built the program using VSCode and WSL2. I've installed selenium in WSL2. Selenium requires a webdriver api to be installed and included...
  6. Multiple PATH environment variables

    in Windows 10 Ask Insider
    Multiple PATH environment variables: [ATTACH] There's a package that I want to install and it says in order to install it, it needs to be added to the PATH. Upon checking my environment variables, I noticed there are three of them as shown:...
  7. regarding path variable of user variable of environment variable

    in Windows 10 Customization
    regarding path variable of user variable of environment variable: please help me fast, I accidentally deleted path variable of user variable ..... I want to restore it. the real situation is I cannot run android studio project and it shows error - " unable to start daemon process............This problem might be caused by incorrect...
  8. Setting path variable in Environment variables Windows 10

    in Windows 10 Customization
    Setting path variable in Environment variables Windows 10: How can I stack up multiple path variables? Currently, it overwrites the old one when I try to edit. (I believe mindless updates are bad and updates should only happen when it is reasonably certain they will improve usability, and not just so that some people have a job.)...
  9. Automated modification of PATH environment variables

    in Windows 10 Performance & Maintenance
    Automated modification of PATH environment variables: The following archive contains scripts to safely edit the "Path" values in HKCU and HKLM. Useful to run after a new installation. path.7z New path inclusions are specified in "path.txt". Run "path.bat" to commit any changes. 103736
  10. Reset Java Environment Variable Path

    in Windows 10 Support
    Reset Java Environment Variable Path: I had to restore my PC to factory settings because of a virus (maybe overkill, not sure) and reinstalled the Java JDK and editing the Environment Variable for Path. First try gave me this: [img] Second try gave me this (I can't remember how): [img] I'm trying...