I created a .wslconfig file following the first answer here to limit wsl resource consumption on my Win10 os. It does not work and I have no clue why. I am using Docker Desktop. File:
# Limit the wsl or vmmem consumption of resources
[wsl2]
memory=3GB # Limits VM memory in WSL 2 to 3 GB
processors=3 # Makes the WSL 2 VM use 3 virtual processors
localhostForwarding=true # Boolean specifying if ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via localhost:port.
- I am using windows build 19042.1526, which should be able to handle such file
- The file itself is actually a .wslconfig and not an accidental .txt
- I have restarted my PC and used
Restart-Service LxssManager
in my admin powershell successfully - I am actually using WSL 2
- I saved the file in
C:UsersPC Paul
which is the main user
I am at my wits end, do you have any idea where the problem might be?
Thanks,
Paul
3
Answers
Ok it seems like the file has to start with [wsl2]. I deleted the comment at the top and now it seems to work.
Edit: Further help if it doesn't work may be found here: https://superuser.com/questions/1632543/wslconfig-not-applied-for-wsl2
In my case, it turns out that the memory parameter is case sensitive. I.e. you have to use
GB
, notGb
. E.g. this works…This doesn’t work…
In my case I created the .wslconfig file by creating a new file like this:
After saving it the icons displayed was this:
I thought it should work because the name is correct.
But when I open the userprofile folder in command prompt and type in
dir
it showed .wslconfig.txt
Solution:
Open command prompt, change directory and then rename file manually