WSL: WslRegisterDistribution failed with error: 0x80070005
Environment
Windows build number: `Microsoft Windows [Version 10.0.21343.1000]`
Your Distribution version: Alpine Linux
Whether the issue is on WSL 2 and/or WSL 1: While installing (call to `_registerDistribution`)
Steps to reproduce
Call:
HRESULT WslApiLoader::WslRegisterDistribution(PCWSTR tarGzFilename)
{
HRESULT hr = _registerDistribution(_distributionName.c_str(), tarGzFilename);
if (FAILED(hr)) {
Helpers::PrintMessage(MSG_WSL_REGISTER_DISTRIBUTION_FAILED, hr);
}
return hr;
}
(Or use Alpine Linux App from Store)
WSL logs: https://github.com/agowa338/wsl_etl/blob/main/wsl.etl?raw=true
Expected behavior
API Call succeeds
Actual behavior
API Call throws Access Denied instead of registering the tar.gz
Workaround
- Uninstalling:
- Hyper-V
- Hypervisor Platform
- Container
- WSL
- Reboot
- Reinstall all 4 features
- Reboot
- Call the API again. Now it works.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 20 (1 by maintainers)
If anyone are facing this problem, check if you have an App called Windows Subsystem for Linux, if yes, uninstall it and you will get access to wsl2 again.
It was installed here after running
wsl --updatecommand.wsl --update wsl.exe --list
…to see what linux distros you have. Oddly, though wsl --update reported “The most recent version of Windows Subsystem for Linux is already installed.” I could start Ubuntu after running it.
What worked for me when I got this error:
You will be logged on as the almighty root user, but Alpine is a very lightweight distro, and it is unlikely you will do much that you wouldn’t want root privileges to execute. If you are running Windows Terminal (you should) you’ll see the Alpine distro added to your available launchers. Check out https://docs.microsoft.com/en-us/learn/modules/get-started-with-windows-subsystem-for-linux/7-manage-multiple-distributions which will walk you through creating a (non-root) user in the distro, and then setting that user to default.
I got the same exact problem! After entering registry editor, take ownership of the files, installing and reisntalling wsl and the update; what worked for me is to move the kali linux files of the microsoft store, to somewhere else (like the Downloads folder for example), and then click install.
And worked everything
Thanks for reporting the issue, and for including a trace. The access denied is coming from an attempt to open HKCU (via RegOpenCurrentUser).
Can you check the permissions on that key for your device? And can you share more details about how you are invoking that code fragment?
On a clean VM of 21343, after running wsl.exe --install to get WSL configured, I was able to install the Alpine Linux trial from the Store, and was also able to programmatically register Alpine’s .tar.gz from a test console app. So I’m suspecting there’s something more subtle going on in the environment where you’re seeing this.