Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 0x8007000e Not enough memory resources are available to complete this operation. #5240

Closed
hmartinez82 opened this issue May 20, 2020 · 35 comments
Labels
distro-mgmt problems related to import, export, conversion

Comments

@hmartinez82
Copy link

hmartinez82 commented May 20, 2020

  • Your Windows build number:

Microsoft Windows [Version 10.0.19041.264]

  • What you're doing and what's happening:

Setting of an existing WSL 1 distro to WSL 2. E.g: Ubuntu 20.04 :

wsl --set-version Ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Not enough memory resources are available to complete this operation.

Or installing a new distro after setting the default version to 2 with wsl --set-default-version 2. E.g: Alpine WSL:

...
Verifying Hash: OK
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8007000e
WslRegisterDistribution failed
Error: 0x8007000e Not enough memory resources are available to complete this operation.

Press any key to continue...
  • What's wrong / what should be happening instead:
    Unable to use WSL 2 at all 😞. Error message: Not enough memory resources are available to complete this operation.
@onomatopellan
Copy link

With 32Gb RAM the problem is probably a too small virtual memory page file.
Open Performance options -> Advanced tab -> Virtual Memory -> "Change..." button and make sure "Automatically manage paging file size for all drives" is checked.

@hmartinez82
Copy link
Author

hmartinez82 commented May 21, 2020

@onomatopellan That's already checked. The page size is 4.8GB
This is a week old fresh install of Win 10 2004. WSL 2 was working for a a day or two I installed Windows. Then, I don't know if some of the recent updates that took place two days are what caused the issue. Also, WSL 1 is working, Also my regular Hyper-V VMs start completely fine. And no they are not running when I try to start WSL 2

@onomatopellan
Copy link

Do those errors appear instantly of after a while? Take a look at C:\pagefile.sys to see if it grows during the conversion.

@hmartinez82
Copy link
Author

Yes they are instant. Should I try manually increasing the pagefile to something larger than 4.8 GB?

@onomatopellan
Copy link

Yes, and also last option is to disable pagefile in every drive.

@hmartinez82
Copy link
Author

@onomatopellan I tried increasing the pagefile to 16GB, rebooted, same error
Then unset the pagefile in all drives, rebooted, same error :(

@hmartinez82
Copy link
Author

Manual import is also not working

C:\WSL>wsl --import "Alpine" C:\WSL\Alpine C:\LinuxImages\alpine-minirootfs-3.11.4-x86_64.tar.gz
Not enough memory resources are available to complete this operation.

@onomatopellan
Copy link

Ok, then set it to "Automatically manage" again.

I 'm seeing in your Windows Error Reporting logs you had plenty of errors in last 3 days. (PerfWatson, devenv.exe, Chrome) First one was on 5/18.

Just to make sure RAM is ok run the Windows Memory Diagnostic.

@hmartinez82
Copy link
Author

I found a solution. I manually created a file called .wslconfig in %userprofile% with this content:

[wsl2]
memory=4GB
processors=4

and now it's working 🎉

@hmartinez82
Copy link
Author

@onomatopellan thank you a ton for helping :)

Do you know how to increase the memory and proc count of my distro after I already created it?
I've changed the .wslconfig file to:

[wsl2]
memory=12GB
processors=12

but the VM still comes up with just 4GB and 4CPUs

@onomatopellan
Copy link

onomatopellan commented May 21, 2020

you need to wsl.exe --shutdown before using the new values. All the distros are running in the same lightweight VM.

@jgwinner
Copy link

I had the same problem!

In fact, Docker crashes hard with the same error message if I use Linux containers (which is the default).

I do have "Automatically manage paging file size for all drives". Right now I only have a 10G page file, and a 27G Hiberfil

I have 64GB of RAM and 41GB of RAM available. I DO have a NUMA setup - dual Xeon processors. I'm currently running Windows Workstation. I thought maybe that was the problem as clearly I have plenty of RAM, with both processors. I am running Hyper-v but leave most of the VM's shut down.

The docker people weren't any help at all, despite me uploading several logs.

Interestingly, my laptop, which as 48G, ran Docker fine. Single physical CPU. Also has Hyper-V, VM's shut down.

So I tried the wslconfig and that fixed both WSL2 as well as Docker with Linux containers.

It's still a bug, IMHO - needs to be fixed, but at least this is a workaround.

Thank you!

    == John ==

P.S. For those that claim we need 2x physical as a swap file - that's long obsolete. I do NOT need 128G of swap. I'd rather have little to no swap, and let processes run out of RAM. Having absurdly large amounts of swap makes a system less stable (I ran an Oracle Consulting company and installed thousands of Linux/Unix hosts. We always had the same problem with Oracle's scripts; often we'd just set the settings up high, then the client sysadmin would restore them :)

@jgwinner
Copy link

Maybe the setup program is using an int, and blows up if you have more than 4Gig? o.O

It's weird it works fine on a 48G system, and not at all on a 64G system. Does that give us a clue?

    == John ==

@gubenkoved
Copy link

gubenkoved commented Sep 5, 2020

also having the same issue, host has 16GB, tried everything I found, and nothing helped... still "0x8007000e Not enough memory resources are available to complete this operation".

It seems to me related to recent windows updates, since it used to work flawlessly (at least WSL 1 for me) about a month ago, and now it's all broken. Docker also does not work, as it requires Hyper-V...

UPDATE. Just figured my issue out -- service "Hyper-V Host Compute Service" was in disabled state, it seems to be the reason for "Hyper-V Virtual Machine Management" to fail with such a misleading error!

image

@jgwinner
Copy link

jgwinner commented Sep 5, 2020

Did you try the .wsl config? That absolutely fixed my problem. I also updated the Docker folks. They just pass on the error message without explaining WHERE it came from.

@gubenkoved
Copy link

@jgwinner, i've updated my comment -- my issue had a completely different reason, but i was confused by totally irrelevant error message.

@apa64
Copy link

apa64 commented Feb 22, 2021

I have the same error with this setup:

  • Edition Windows 10 Pro
  • Version 20H2
  • OS build 19042.804
  • Experience Windows Feature Experience Pack 120.2212.551.0
  • Processor Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz 2.11 GHz
  • Installed RAM 24,0 GB (23,8 GB usable)
  • System type 64-bit operating system, x64-based processor

I just upgraded to 20H2 and installed WSL:

Run in PowerShell as Administrator:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2

Downloaded and installed "WSL2 Linux kernel update package for x64 machines". Installed Ubuntu 20.04 from Microsoft Store.

Now when I start Ubuntu from Start Menu or run in shell window the error is this:

Microsoft Windows [Version 10.0.19042.804]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>ubuntu.exe
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80070008
Error: 0x80070008 Not enough memory resources are available to process this command.

Press any key to continue...

I have tried setting up %USERPROFILE%\.wslconfig but it does not fix the problem. Tried with 4 and 8 GB mem and 2 and 4 processors:

~$ cat .wslconfig
[wsl2]
memory=4GB
processors=4

Event Viewer does not show any errors for Hyper-V when starting Ubuntu install. It does show that it successfully starts up things and then deletes immediately as the install fails.

I have rebooted. Page file is managed by Windows. I am using Docker on this Windows and it's working just fine so I think virtualization must be OK.

What memory resource does the install process need to have? How can I allocate more for it?

@jgwinner
Copy link

You're showing ~$ cat ... dumb question, but are you doing this in the Windows shell? That looks like GitHub desktop. I'd try plain DOS, maybe it's CR\LF sensitive.

@apa64
Copy link

apa64 commented Feb 22, 2021

You're showing ~$ cat ... dumb question, but are you doing this in the Windows shell? That looks like GitHub desktop. I'd try plain DOS, maybe it's CR\LF sensitive.

Actually I did it in Git for Windows Bash shell - I want to replace my MINGW "linux" with WSL2 :) The .wslconfig file had LF linefeeds, I verified that.

@apa64
Copy link

apa64 commented Mar 3, 2021

This did not help: "Settings > Apps and Features > Ubuntu 20.04 LTS > Advanced options > Reset" (clutching on any straws here... inspired by https://stackoverflow.com/q/60377834/339052)

@apa64
Copy link

apa64 commented Mar 3, 2021

Same error with Alpine WSL from Microsoft Store:

Temporary directory: C:\Users\xxx\AppData\Local\Temp\wsl_Alpine_setup
Downloading   : http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-minirootfs-3.12.1-x86_64.tar.gz
To local file : install.tar.gz
The current working directory is: C:\Users\xxx\AppData\Local\Temp\wsl_Alpine_setup
Error deleting file: No such file or directory
Status code : 32
Finding resource...
Connecting...
Sending request...
Mime type available
Begin download
Cache filename available
100% [====================]
End download
Downloaded OK
Hash of file install.tar.gz is: 5c81856823d1ee629af5245d4023a31f0144696c00edc9091db43c404e1cd02b

Verifying Hash: OK
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80070008
WslRegisterDistribution failed
Error: 0x80070008 Not enough memory resources are available to process this command.

Press any key to continue...

@apa64
Copy link

apa64 commented Mar 5, 2021

WSL1 works: I uninstalled WSL rebooted etc and did only:

  1. enable WSL
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  1. reboot
  2. install Alpine from Microsoft Store
  3. force wsl1 and run alpine install in admin powershell
PS C:\Users\xxx> wsl --set-default-version 1
PS C:\Users\xxx> wsl
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
PS C:\Users\xxx> Alpine.exe
Temporary directory: C:\Users\xxx\AppData\Local\Temp\wsl_Alpine_setup
Downloading   : http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-minirootfs-3.12.1-x86_64.tar.gz
To local file : install.tar.gz
The current working directory is: C:\Users\xxx\AppData\Local\Temp\wsl_Alpine_setup
File successfully deleted
Mime type available
Begin download
Cache filename available
100% [====================]
End download
Downloaded OK
Hash of file install.tar.gz is: 5c81856823d1ee629af5245d4023a31f0144696c00edc9091db43c404e1cd02b

Verifying Hash: OK
Installing, this may take a few minutes...
Executing bugfixing command: /bin/chmod 755 /
Executing bugfixing command: /sbin/apk --no-cache add shadow
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/2) Installing linux-pam (1.3.1-r4)
(2/2) Installing shadow (4.8.1-r0)
Executing busybox-1.31.1-r19.trigger
OK: 8 MiB in 16 packages
Executing bugfixing command: /bin/sed -i 's/^export PATH/#export PATH/' /etc/profile
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: wsl

To (re-)set root password run `wsl.exe --user root --distribution Alpine passwd`

New password:
Retype new password:
passwd: password updated successfully
Installation successful!
mycomputer:~$ pwd
/home/wsl

@apa64
Copy link

apa64 commented Mar 5, 2021

... but trying to convert installed WSL1 Alpine to WSL2 fails:

Windows Subsystem for Linux Distributions:
Alpine (Default)
PS C:\Users\xxx> wsl --set-version alpine 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Not enough memory resources are available to process this command.

@spmadden
Copy link

I'm getting all the same issues as @apa64 - I'm on Windows 10 1909 with 32GB of RAM. The ~/.wslconfig file didn't help as that seems to have been added in a later build of windows. Are there any logs I can provide to help diagnose this issue?

@apa64
Copy link

apa64 commented Mar 17, 2021

Without knowing how or what calls what when WSL is registering Ubuntu for WSL 2... Is it using WSL-DistroLauncher? I found these references to WslRegisterDistribution. I guess the error message comes from inside wslapi.dll but can't find source code for that, only API doc: https://docs.microsoft.com/en-us/windows/win32/api/wslapi/nf-wslapi-wslregisterdistribution

HRESULT WslApiLoader::WslRegisterDistribution()
{
    HRESULT hr = _registerDistribution(_distributionName.c_str(), L"install.tar.gz");
    if (FAILED(hr)) {
        Helpers::PrintMessage(MSG_WSL_REGISTER_DISTRIBUTION_FAILED, hr);
    }

    return hr;
}
HRESULT InstallDistribution(bool createUser)
{
    // Register the distribution.
    Helpers::PrintMessage(MSG_STATUS_INSTALLING);
    HRESULT hr = g_wslApi.WslRegisterDistribution();
    if (FAILED(hr)) {
        return hr;
    }
...

@miron
Copy link

miron commented Apr 22, 2021

Thank you guys, wanted to summarize that:

%USERPROFILE%.wslconfig

[wsl2]
memory=8GB

wsl.exe --shutdown

fixed for me being low on memory in docker container.

@apa64
Copy link

apa64 commented Apr 23, 2021

.wslconfig didn't work for me :( Thanks for the comment anyway!

Microsoft Windows [Version 10.0.19042.928]
(c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>cd\

C:\>type %USERPROFILE%\.wslconfig
[wsl2]
memory=8GB
processors=4

C:\>wsl --shutdown

C:\>wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Stopped         1

C:\>wsl --set-version Ubuntu-20.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Not enough memory resources are available to process this command.

@miron
Copy link

miron commented Apr 23, 2021

.wslconfig didn't work for me :( Thanks for the comment anyway!

Microsoft Windows [Version 10.0.19042.928]
(c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>cd\

C:\>type %USERPROFILE%\.wslconfig
[wsl2]
memory=8GB
processors=4

C:\>wsl --shutdown

C:\>wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Stopped         1

C:\>wsl --set-version Ubuntu-20.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Not enough memory resources are available to process this command.

Do you get this error while converting to WSL2 ? This is different, it changes RAM allocation when you are allready on WSL2. Unfortunately it doesn't work for me either. It changed my RAM inside the WSL container from 3GB to 8GB, but any succcesive atempts did nothing, It is stuck on 8GB now, no matter what i set with memory=...

@adrastogi adrastogi added the distro-mgmt problems related to import, export, conversion label May 6, 2021
@apa64
Copy link

apa64 commented Aug 5, 2021

No change with the newest Windows update:

image

C:\WINDOWS\system32>Alpine.exe
Temporary directory: C:\Users\xxx\AppData\Local\Temp\wsl_Alpine_setup
Downloading   : https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-minirootfs-3.13.4-x86_64.tar.gz
To local file : install.tar.gz
The current working directory is: C:\Users\xxx\AppData\Local\Temp\wsl_Alpine_setup
File successfully deleted
Mime type available
Begin download
Cache filename available
100% [====================]
End download
Downloaded OK
Hash of file install.tar.gz is: 8e21c85c4a5bb406180136aa03f814c56ffc7498ba7886c5ea13fec92d528ead

Verifying Hash: OK
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80070008
WslRegisterDistribution failed
Error: 0x80070008 Not enough memory resources are available to process this command.

Press any key to continue...

I have no .wslconfig file:

C:\>dir %USERPROFILE%\.wslconfig
 Volume in drive C is System
 Volume Serial Number is 4814-5985

 Directory of C:\Users\xxx

File Not Found

@RockNHawk
Copy link

RockNHawk commented Dec 13, 2021

These steps works for me

1.re-enable wsl subsystem module, reinstall ubuntu App

2.add %USERPROFILE%.wslconfig
[wsl2]
memory=4GB
processors=4

wsl.exe --shutdown

3.and also:

#2576 (comment)
ATTENTION: data will erase when you do wslconfig /u
Follow these steps in the command line:

Find out the name of the problematic distribution by using
wslconfig /list
Remove this distribution by using

wslconfig /u <Name of the distribution>
Reinstall the distribution by calling the respective exe file.

wslconfig /list
wslconfig /u docker-desktop-data

@observ3r
Copy link

observ3r commented Feb 2, 2022

@apa64 Did you get it fixed? What worked? I have tried everything in this thread (among others) with no luck.

@apa64
Copy link

apa64 commented May 17, 2022

@apa64 Did you get it fixed? What worked? I have tried everything in this thread (among others) with no luck.

No, I never found a solution. Eventually I got a new laptop and then everything just worked, Win 10 + WSL 2 with normal install instructions.

@BigHobbit55
Copy link

Running Win 10 with UEFI as Host and trying to Deploy Server 2016 Images;
I was getting this error when the Wim tried to deploy;

GPEdit.msc >Local Policy >Computer Configuration >Administrative Templates >System >Device Guard >Turn on Virtualization Based Security = Disabled

Turning VM Security off in GPO fixed my issue.

@xmers
Copy link

xmers commented Nov 6, 2022

... but trying to convert installed WSL1 Alpine to WSL2 fails:

Windows Subsystem for Linux Distributions:
Alpine (Default)
PS C:\Users\xxx> wsl --set-version alpine 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Not enough memory resources are available to process this command.

I am having the same issue as apa64.

Unfortunately, none of the recommendation on this threat help :(

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distro-mgmt problems related to import, export, conversion
Projects
None yet
Development

No branches or pull requests