This page has been machine-translated from the original page.
Overview of the Problem and the Solution
A while after upgrading from Windows 10 22H2 to Windows 11 24H2, I noticed that I could no longer use WSL2 and Hyper-V virtual machines together.
Specifically, while WSL was running, I could no longer start a Hyper-V virtual machine, and conversely, while a Hyper-V virtual machine was running, I could no longer start WSL.
At that time, both WSL and Hyper-V virtual machines seemed to fail to start with error code 0x80070142, which indicates insufficient resources.
If this problem occurs, you can at least use either the virtual machine or WSL by stopping all Hyper-V virtual machines or shutting down WSL with wsl --shutdown.
However, that was too inconvenient, so I investigated the cause and found a post saying that this happened because .wslconfig directly under USERPROFILE had been deleted for some reason and was not recreated.
So I tried manually creating .wslconfig with the following rough settings, and the problem was resolved. I was able to use WSL and virtual machines together again.
[wsl2]
memory=4GB
swap=0
processors=2Reference: Advanced settings configuration in WSL | Microsoft Learn
Summary
It was a subtle but annoying problem, so I am leaving it here as a quick note.