Score:3

Bash error and WSL not working

sl flag

I got these error while trying to get WSL to work.

<3>WSL (9) ERROR: CreateProcessEntryCommon:574: execvpe /bin/bash failed 2
<3>WSL (9) ERROR: CreateProcessEntryCommon:583: Create process not expected to return

I had tried to edit my Windows terminal because it broke, and I probably deleted some files since reinstalling wasn't fixing the issue.

Is there any fix for this?

Additional details:

  • wsl -l -v:

      NAME      STATE           VERSION
    * Ubuntu    Stopped         2
    
  • wsl --version:

    WSL version: 1.1.3.0
    Kernel version: 5.15.90.1
    WSLg version: 1.0.49
    MSRDC version: 1.2.3770
    Direct3D version: 1.608.2-61064218
    DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Windows version: 10.0.19045.2604
    
  • wsl ~ -u root -e /usr/bin/sh results in a # symbol and a blinking _.

NotTheDr01ds avatar
vn flag
Thanks for editing it in - I've cleaned up the formatting. Also, was Ubuntu working before this and stopped? Or is this a new install that isn't working? Thanks!
NotTheDr01ds avatar
vn flag
Try `wsl ~ -u root -e /usr/bin/sh`. I'm expecting you will see an error, but if not, then there's hope ...
NotTheDr01ds avatar
vn flag
Do you have important files in Ubuntu that you will need to try to recover if a reinstall is needed?
Aryan Philip avatar
sl flag
No important files. Also the command above outputted this: a "#" symbol and a blinking '_'.
NotTheDr01ds avatar
vn flag
Okay, that's good - It means the Dash shell still exists, at least. What about `wsl ~ -u root -e /usr/bin/bash`?
NotTheDr01ds avatar
vn flag
And also `wsl ~ -e /usr/bin/bash`?
Aryan Philip avatar
sl flag
Both the above commands still throw the same error as posted in my question
Score:4
vn flag

<3>WSL (9) ERROR: CreateProcessEntryCommon:574: execvpe /bin/bash failed 2 <3>WSL (9) ERROR: CreateProcessEntryCommon:583: Create process not expected to return

That's an indication that the Bash shell is no longer accessible. The WSL2 init process (among other things):

  • Determines the default user id
  • Looks up the user's shell in /etc/passwd (typically /bin/bash)
  • Attempts to start the shell

Not being able to find /bin/bash is a pretty serious issue. From the comments (edited into the main question), we did determine that you can still launch /usr/bin/sh, which means that at least that shell is available.

It's possible that you simply deleted the symlink from /bin/ to /usr/bin, and we could easily recreate it if that were the case. But, it's also possible that you deleted more than that, and we just don't know at this point.

Given that you mentioned that there are no important files, the easiest recovery will be to simply "reset" Ubuntu back to the initial rootfs state. This is a destructive operation, so it's only recommended because you say there's nothing to recover:

From PowerShell:

# WARNING: Destructive operation
wsl --unregister Ubuntu

# Then re-install Ubuntu
ubuntu.exe

After a few seconds, it should ask for your username and password, just as it did when you initially installed.


Note for other reasons who may need to attempt recovery:

Before running the command above, back up the filesystem via PowerShell with:

wsl --export Ubuntu <path_to>/my_ubuntu_backup.tar

Examine the tarball to ensure that your files are included. Then after running the --unregister above, you can restore any necessary files to your home directory from that tarball.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.