WSL: bash fails on WSL2: filesystem mounting error
Environment
Windows build number: 10.0.20211.1000
Your Distribution version: Buster 10.5
Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Tue Jun 23 12:58:10 UTC 2020
Steps to reproduce
After installing Ubuntu or Debian on WSL2, attempt to use bash by running bash from powershell.
Expected behavior
This should start up bash and return a bash prompt.
Actual behavior
The bash command fails with the following error:
An error occurred mounting one of your file systems. Please run 'dmesg' for more details.
Following these instructions, here is the relevant output from dmesg:
[ 73.412597] scsi 0:0:0:2: Direct-Access Msft Virtual Disk 1.0 PQ: 0 ANSI: 5
[ 73.413019] sd 0:0:0:2: Attached scsi generic sg2 type 0
[ 73.413792] sd 0:0:0:2: [sdc] 536870912 512-byte logical blocks: (275 GB/256 GiB)
[ 73.413793] sd 0:0:0:2: [sdc] 4096-byte physical blocks
[ 73.413873] sd 0:0:0:2: [sdc] Write Protect is off
[ 73.413874] sd 0:0:0:2: [sdc] Mode Sense: 0f 00 00 00
[ 73.414166] sd 0:0:0:2: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 73.416782] sd 0:0:0:2: [sdc] Attached SCSI disk
[ 73.433954] EXT4-fs (sdc): mounted filesystem with ordered data mode. Opts: discard,errors=remount-ro,data=ordered
[ 73.445959] init: (1) ERROR: ConfigApplyWindowsLibPath:2259: open /etc/ld.so.conf.d/ld.wsl.conf
[ 73.445961] failed 2
[ 73.448223] init: (2) ERROR: UtilCreateProcessAndWait:627: /bin/mount failed with 2
[ 73.448290] init: (1) ERROR: UtilCreateProcessAndWait:647: /bin/mount failed with status 0x
[ 73.448291] ff00
[ 73.448295] init: (1) ERROR: ConfigMountFsTab:2314: Processing fstab with mount -a failed.
[ 73.454506] hv_pci 5ff70487-d970-4734-9a18-b73b0a85682b: PCI VMBus probing: Using version 0x10002
[ 73.465479] WARNING: /usr/share/zoneinfo/America/Chicago not found. Is the tzdata package installed?
[ 73.497468] hv_pci 5ff70487-d970-4734-9a18-b73b0a85682b: PCI host bridge to bus 9a18:00
[ 73.497470] pci_bus 9a18:00: root bus resource [mem 0xe00008000-0xe0000afff window]
[ 73.497969] pci 9a18:00:00.0: [1af4:1049] type 00 class 0x010000
[ 73.499651] pci 9a18:00:00.0: reg 0x10: [mem 0xe00008000-0xe00008fff 64bit]
[ 73.500513] pci 9a18:00:00.0: reg 0x18: [mem 0xe00009000-0xe00009fff 64bit]
[ 73.501407] pci 9a18:00:00.0: reg 0x20: [mem 0xe0000a000-0xe0000afff 64bit]
[ 73.505420] pci 9a18:00:00.0: BAR 0: assigned [mem 0xe00008000-0xe00008fff 64bit]
[ 73.505917] pci 9a18:00:00.0: BAR 2: assigned [mem 0xe00009000-0xe00009fff 64bit]
[ 73.506369] pci 9a18:00:00.0: BAR 4: assigned [mem 0xe0000a000-0xe0000afff 64bit]
[ 73.524925] init: (8) ERROR: CreateProcessEntryCommon:427: getpwuid(0) failed 2
[ 73.524929] init: (8) ERROR: CreateProcessEntryCommon:430: getpwuid(0) failed 2
[ 73.529364] init: (8) ERROR: CreateProcessEntryCommon:593: execvpe /bin/bash failed 2
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 25 (1 by maintainers)
In my case, this was caused by having the “experimental” WSL2 + Docker Desktop integration enabled.
The “default distro” was one of the “distros” Docker installs.
wsl -lto discover this andwsl -d <myDistro>to explicitly select the distro “fixed” my problem. I will be changing the default and seeing how that goes too.For everyone’s convenience, the command to set the default is
wsl -s <myDistro>.Success for me:
Credit to @kevin-david for pointing out that the default distro needed setting
Credit to @stevegore for advising on the wsl option switch
-sto use to set the default distro:Summary
Yes this helped me. My “default distro” was
docker-desktop-dataof all things! What the hell isdocker-desktop-dataand why would WSL2 think that was a distro?! So I changed it toUbuntuand this solved the issue.Detail
See my Windows PowerShell (PS) terminal excerpts below.
So I changed this to
UbuntuPS > wsl -s UbuntuThen I verified that the default was now still
Ubuntu, and it was:Then I quit any VSCode windows running, deleted
.vscode-serverin Ubuntu terminal (so it would rebuild it cleanly on rerunning vscode later after the above fix) And then I shutdown WSL2:wsl --shutdownThen following this, as expected, I got a notification from Docker Desktop about unexpectedly closed and would I like to restart, with a button to restart. This was to be expected following the shutdown command above. So I did this - clicked restart for docker desktop and waited for the little docker whale and cargo to stop animating and then ran Ubuntu again.
And now successful: Then I typed
codein the Ubuntu terminal. Visual Studio Code fired up and in the bottom left corner, reassuringly: “WSL: Ubuntu” showed.Background
Before this solution I had seen this error in the terminal log in vscode:
VS Code Server for WSL closed unexpectedlyand couldn’t determine if the vscode server running.Other things I had done to resolve this issue:
wsl -lhad reported the default as not is butdocker-desktop-data! )Including vscode log output for informational purposes and seo to help others get to this issue solutions to help them:
None of the above work… is there any more recent workaround for 2023? I’ve build an image off ubi8 or rockylinux8 but I am getting the same error after importing it into WSL2.
Yield:
i’ve doing something wrong command that delete docker-desktop-data
but i found solution fot this prolem. do this :
And start docker-desktop manually and the docker-desktop will using Ubuntu for wsl
hope this help
That was the problem on my side as well! To fix:
wsl -lwsl -s Ubuntuwsl -lHere’s how I fixed mine:
wsl -lto find which distro is currently the default distrodocker-desktopwsl --set-default Ubuntuas the default WSL distributionOh!After change the defaluft wsl to ububtu,it works well now .Thank you so much!
For everyone struggling, I’ve been in this place, and the steps I followed:
wsl -s <myDistro>by running wsl -l (e.g. Ubuntu you should fond the default set to Ubuntu)auth required pam_shells.sowithauth sufficient pam_shells.sothen
exitand rerun wslI hope you find this helpful
Try using
wslcommand instead.