Launching wsl: /usr:/usr/bin is not found in the $PATH environment variable after Windows update.

santiago lopez 0 Reputation points
2024-09-19T17:38:09.3033333+00:00

Windows 11 update this week, and after that whenever I try to start wsl I get the following error:

-bash: groups: command not found
Command 'grep' is available in the following places

  • /bin/grep
  • /usr/bin/grep
    The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
    grep: command not found
    Command 'id' is available in the following places
  • /bin/id
  • /usr/bin/id
    The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
    id: command not found
    -bash: [: -eq: unary operator expected
    Command 'update-motd' is available in the following places
  • /sbin/update-motd
  • /usr/sbin/update-motd
    The command could not be located because '/usr/sbin:/sbin' is not included in the PATH environment variable.
    This is most likely caused by the lack of administrative privileges associated with your user account.update-motd: command not found
    This message is shown once a day. To disable it please create the
    /root/.hushlogin file.
    Command 'touch' is available in the following places
  • /bin/touch
  • /usr/bin/touch
    The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
    touch: command not found

To troubleshoot, I tried the following:

wsl --update

I added /bin:/usr/bin to the .bashrc and I get the same error.

As a workaround to start wsl, I added a .sh script in the /etc/profile.d/ directory adding /bin:/usr/bin to the $PATH and now wsl starts with just the following error message:

-bash: groups: command not found

I tried installing another distribution of Ubuntu: Ubuntu-24.04.

But after the installation, I am asked to enter a username after getting the following error:

/bin/bash: line 1: rm: command not found
Please create a default UNIX user account. The username does not need to match your Windows username.

And when I add the username, I get:

/bin/bash: line 1: adduser: command not found

Bottom line is, it seems that wsl is not recognizing /bin:/usr/bin in the $PATH environment variable despite of being there.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,602 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Daisy Zhou 23,426 Reputation points Microsoft Vendor
    2024-09-23T08:41:37.4033333+00:00

    Hello santiago lopez,

    Thank you for posting in Q&A forum.

    Please try to manually set the PATH and check if it helps.

    Open your WSL terminal and manually set the $PATH variable:

    export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

    To make this change permanent, add the above line to your .bashrc or .profile file:

    echo 'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' >> ~/.bashrc

    source ~/.bashrc

    I hope the information above is helpful.

    If you have any questions or concerns, please feel free to let us know.

    Best Regards,

    Daisy Zhou

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.