exFAT Filesystem Fails to Work with VeraCrypt on WSL2
Expected behavior
Creating a VeraCrypt volume with the exFAT filesystem on WSL2 (Windows Subsystem for Linux 2) should work without errors.
Observed behavior
When attempting to create a VeraCrypt volume with the exFAT filesystem on WSL2, the following error occurs:
Error: device-mapper: create ioctl on veracrypt1 failed: Device or resource busy
Using the --filesystem=FAT option works, but only when the -m=nokernelcrypto flag is used.
Steps to reproduce
- Run the following command in WSL2:
sudo veracrypt --text --non-interactive -m=nokernelcrypto --create ./testporeboot.tc \ --password=1234 --size=200M --volume-type=normal \ --encryption=AES --hash=SHA-512 --filesystem=exFAT - Observe the error output.
- Change the
--filesystemoption toFATand re-run the command. - Notice that the command succeeds only with the
-m=nokernelcryptoflag.
Screenshots
Your Environment
VeraCrypt version: 1.26.14
Operating system and version:
Microsoft Windows
Windows 11
Version 24H2 (OS Build: 26100.2605)
WSL version:
- WSL Version: 2.3.26.0
- Kernel Version: 5.15.167.4-1
- WSLg Version: 1.0.65
- MSRDC Version: 1.2.5620
- Direct3D Version: 1.611.1-81528511
- DXCore Version: 10.0.26100.1-240331-1435.ge-release
WSL Distribution: Kali Linux
Kernel version in WSL2: 5.15.167.4-microsoft-standard-WSL
System type: 64-bit
Additional Information and Troubleshooting Steps
I have tested this issue on two different machines running Windows 11 with WSL2, and the problem persists across both setups. Below is a summary of the troubleshooting steps that I have attempted:
-
Tested Fixes:
- Manually closing any mapped volumes using:
sudo cryptsetup close <volume_name> - Restarting WSL2 using:
wsl --shutdown - Verifying the behavior persists after a full system reboot.
- Manually closing any mapped volumes using:
-
Behavior Observed on Other Platforms:
- The issue does not occur on native Linux distributions (e.g., Ubuntu) or macOS. This suggests that the problem is specific to WSL2's handling of the exFAT filesystem.
-
WSL2 exFAT Support:
- The exFAT filesystem is supported by WSL2. For example, I tested this by using the native VeraCrypt application on Windows to mount an exFAT volume. I then attached the mounted volume to Linux within WSL2, and it worked as expected.
- This confirms that exFAT functionality is available in WSL2 when using this indirect approach, but the issue remains when attempting to use VeraCrypt directly within WSL2.
-
Why I Use WSL2 Instead of Windows:
- I use WSL2 to avoid the limitations of the Windows version of VeraCrypt. On Linux, VeraCrypt provides a native text interface, making it much easier to run commands directly, debug issues, and integrate with scripts.
- In contrast, the Windows version lacks a native command-line interface (CLI). Commands need to be run "blindly" using the
/qand/s) flags, which is cumbersome and unsuitable for automation or workflows that require precise control.