Skip to content

PowerShell won't work as a login shell for WSL2 due to spaces in the $PATH #14640

Closed

Description

Steps to reproduce

  1. Install powershell7 into WSL2/ubuntu following the official installation procedure (via apt).
  2. chsh -s /opt/microsoft/powershell/7/pwsh

Expected behavior

Opening a new "Ubuntu" terminal will launch WSL2 environment with Ubuntu running pwsh

Actual behavior

: 6: export: Files/PlasticSCM5/server:/mnt/c/Program: bad variable name

[process exited with code 2]

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.1
PSEdition                      Core
GitCommitId                    7.1.1
OS                             Linux 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Notes

Running pwsh from within a bash login shell works. pwsh reports the following env:

echo $Env:PATH
/opt/microsoft/powershell/7:/home/farcaller/.nvm/versions/node/v14.9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/PlasticSCM5/server:/mnt/c/Program Files/PlasticSCM5/client:/mnt/c/ProgramData/scoop/shims:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Git LFS:/mnt/c/Users/farcaller/scoop/apps/gpg4win/3.1.12/GnuPG/bin:/mnt/c/WINDOWS/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/farcaller/scoop/apps/gpg4win/3.1.14/GnuPG/bin:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Users/farcaller/scoop/apps/gpg4win/current/GnuPG/bin:/mnt/c/Users/farcaller/scoop/apps/gpg4win/current/Gpg4win/bin:/mnt/c/Users/farcaller/scoop/shims:/mnt/c/Users/farcaller/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/farcaller/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin

Activity

  1. added
    Issue-Question
    on Jan 20, 2021
  2. added
    WG-Engine
    on Jan 20, 2021
  3. iSazonov commented on Jan 20, 2021

    @iSazonov
    Collaborator

    Vladimir Pouzanov (@farcaller) Thanks for your contribution! It is dup #14055

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-QuestionOS-WSLResolution-DuplicateWG-Engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions