How Do I Fix the “Failed to Mount D:\” Error in WSL2 Ubuntu

If you’re like me and rely on WSL2 (Windows Subsystem for Linux 2) for development work, nothing is more frustrating than opening Ubuntu only to be greeted with this annoying message:

wsl: Failed to mount D:\, see dmesg for more details.

When I dug deeper using dmesg, I found even more alarming messages:

PCI: Fatal: No config space access function found
WSL (1 - init()) ERROR: UtilCreateProcessAndWait:707: /bin/mount failed with status 0x2000
WSL (217) ERROR: CheckConnection: getaddrinfo() failed: -5
misc dxg: dxgk: dxgkio_is_feature_enabled: Ioctl failed: -22
misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
misc dxg: dxgkio_query_adapter_info: Ioctl failed: -2

At first glance, it looks scary but don’t worry. After experimenting with several fixes, I finally solved it. In this blog, I’ll walk you through everything I tried and the exact solution that worked.

What This Error Actually Means

WSL2 automatically tries to mount your Windows drives (like C:\, D:\, etc.) to locations like /mnt/c and /mnt/d. When this fails, it usually means one of the following:

✔️ Drive mounting is disabled in WSL settings
✔️ D:\ is blocked or inaccessible (BitLocker, permission issue, external drive, etc.)
✔️ Virtualization is not fully enabled
✔️ Fast Startup or external drive conflict

So the issue isn’t with Ubuntu it’s with how Windows is presenting the drive.

Reproduce and Diagnose the Issue

I started by confirming whether the D drive was mounted at all.

In PowerShell (Run as Administrator):

wsl --shutdown
wsl -l -v

Then I opened Ubuntu again and ran:

# Check if D drive is mounted
ls /mnt/d

# Try manual mounting
sudo mount -t drvfs D: /mnt/d

If You See This:

mount: /mnt/d: wrong fs type, bad option, bad superblock...

Then you’re facing the same problem I had. Let’s fix it!

Enable Auto Mount in WSL Config

I edited the WSL configuration file to force enable drive mounting.

sudo nano /etc/wsl.conf

Then I added:

[automount]
enabled = true
mountFsTab = false
options = "metadata,umask=22,fmask=11"

Save it using CTRL + O → Enter → CTRL + X.

Then restart WSL:

wsl --shutdown

When I opened Ubuntu again and ran ls /mnt/d — boom — it finally showed my drive!

Bonus Project: Auto Mount Checker Script

Because I love automating things, I wrote a tiny script to check and auto mount the drive if needed. Feel free to reuse it!

#!/bin/bash

DRIVE="/mnt/d"

if mount | grep -q "$DRIVE"; then
  echo "$DRIVE is mounted correctly!"
else
  echo "$DRIVE is not mounted. Attempting to mount..."
  sudo mount -t drvfs D: $DRIVE && echo "Mounted successfully!" || echo "Mount failed!"
fi

To activate it:

chmod +x check_drive.sh
./check_drive.sh

Now I run this script whenever things act up super handy!

Ensure Virtualization Is Fully Enabled

Just in case drive mounting still fails, run the following in PowerShell (Admin mode):

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Then restart your PC yes, a real reboot, not just sleep mode.

Final Thought

This issue had me scratching my head for a while, but once I understood that WSL treats Windows drives as network-mounted file systems, the fix made perfect sense. If you’re running into similar errors don’t panic. It’s rarely a “Linux problem” It’s usually just Windows being picky about access rules.

Related blog posts