microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.27k stars 812 forks source link

WSL Export Failure. Error code: Wsl/Service/WSL_E_EXPORT_FAILED #9382

Closed gyutaepark closed 1 year ago

gyutaepark commented 1 year ago

Version

Microsoft Windows [Version 10.0.22621.963]

WSL Version

Kernel Version

5.15.79.1

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

wsl --shutdown wsl --export Ubuntu D:\Extra\wsl\20221220

Expected Behavior

WSL Exports a backup of itself into 20221220 file.

Actual Behavior

Export fails within 10s of seconds. Output file is created but the size does not change during this time. Different output file names were tested including 20221220.tar and 20221220.tar.gz.

Export in progress, this may take a few minutes. Exporting the distribution failed. Error code: Wsl/Service/WSL_E_EXPORT_FAILED

Diagnostic Logs

No response

kele6ra commented 1 year ago

I have the same error. WSL2 Kernel Version: 5.15.79.1-microsoft-standard-WSL2+ Distro Version: Ubuntu 20.04 Maybe we have image size limit to export?

OneBlue commented 1 year ago

/logs

ghost commented 1 year ago

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

ssratkevich commented 1 year ago

Same issue. Logs: WslLogs-2022-12-28_11-00-57.zip

kele6ra commented 1 year ago

Hello! Could you please provide more logs to help us better diagnose your issue? Thank you!

Hello, I have collected logs. Logs: WslLogs-2022-12-28_11-10-41.zip

OneBlue commented 1 year ago

@ssratkevich: Based on the logs it looks like you're trying to export a WSL1 distro, this is probably a different issue. Can you create a new issue to track this ?

@kele6ra: Based on your logs it looks like the directory where the .vhdx is doesn't exist, can you confirm that the directory exists ?

gyutaepark commented 1 year ago

Apologies for the delay. Here are my logs. WslLogs-2022-12-28_20-51-43.zip

OneBlue commented 1 year ago

Thanks @gyutaepark. Looking at the logs, It looks like something is wrong with that distro registration.

Can you share the output of: wsl.exe -l -v ?

Does installing store WSL (via wsl.exe --install) help ?

OneBlue commented 1 year ago

Actually, having a deeper look it looks like store WSL is installed on your machine, but somehow inbox WSL gets invoked. Can you share the output of: wsl.exe --version ?

gyutaepark commented 1 year ago

Interesting. I'm not sure whats causing that.

Can you share the output of: wsl.exe -l -v ?

NAME      STATE           VERSION
* Ubuntu    Stopped         2

Similarly,

Can you share the output of: wsl.exe --version ?

WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.963

Is there any additional information that might help?

Update

In case this might also help.

ssratkevich commented 1 year ago

Hi.

@ssratkevich: Based on the logs it looks like you're trying to export a WSL1 distro, this is probably a different issue. Can you create a new issue to track this ?

I'm created new one yesterday.
https://github.com/microsoft/WSL/issues/9408

OneBlue commented 1 year ago

@gyutaepark: I wonder if you captured logs while the app was updating, can you try to capture logs again while wsl --export is running so I can compare the two executions ?

gyutaepark commented 1 year ago

Of course. Please find the Logs below: WslLogs-2022-12-29_15-53-59.zip

I've ran the script once I've started the export process after shutting down wsl.

OneBlue commented 1 year ago

Ah I think that's the issue. @gyutaepark. Can you run the script first, then run wsl --export, and then stop the script ? This should capture the logs I need to root cause this

gyutaepark commented 1 year ago

I hope this offers a better picture.

WslLogs-2022-12-29_16-04-33.zip

This time, I ran the log script -> Started the export process -> stopped the log script while the export was running.

OneBlue commented 1 year ago

@gyutaepark: I do see the export running in that logs, but I don't see the export error.

Sorry if my previous instructions were not clear. Can you please:

gyutaepark commented 1 year ago

No worries. I should have just let it finish in the first place.

WslLogs-2022-12-29_17-09-07.zip

OneBlue commented 1 year ago

Thank you @gyutaepark.

Now I can see the actual issue: bsdtar invoked oom-killer: gfp_mask=0x1100cca(GFP_HIGHUSER_MOVABLE

Looking at your .wslconfig, I see that the memory limit is 2GB and that swap is disabled, which is probably why bsdtar runs out of memory.

Can you try removing swap and memory from .wslconfig, then run: wsl.exe --shutdown and try exporting again ?

gyutaepark commented 1 year ago

@OneBlue. Interesting. While I do have swap disabled for my wsl, the memory limit was set to 28 GB.

Still, removing the swap line did resolve the issue! The export process finished successfully for me.

Thanks @OneBlue. Should I close the issue?

OneBlue commented 1 year ago

Glad this worked ! Closing since the issue is resolved.

theAkito commented 10 months ago

For anyone finding this via a search machine...

In my case, I experienced this error, when the temporary directory was on a drive with insufficient space for the exported tarball.

velikivelicu commented 5 months ago

Hi, everybody I get the same error, no success on creating .wslconfig file with the following contents in my %USERPROFILE% directory [wsl2] memory=4GB # Limits VM memory in WSL 2 to 4 GB processors=2 # Makes the WSL 2 VM use two virtual processors

But some strange fact is that I can export if I specify --vhd option: wsl --export Ubuntu "C:\WSL Images\Ubuntu_$(get-date -f yyyy-MM-dd).vhdx" --vhd

Any idea why is that? It worked so many times, and noting was changed...

Cheers

vsorin83 commented 3 weeks ago

Hi, everybody I get the same error, no success on creating .wslconfig file with the following contents in my %USERPROFILE% directory [wsl2] memory=4GB # Limits VM memory in WSL 2 to 4 GB processors=2 # Makes the WSL 2 VM use two virtual processors

But some strange fact is that I can export if I specify --vhd option: wsl --export Ubuntu "C:\WSL Images\Ubuntu_$(get-date -f yyyy-MM-dd).vhdx" --vhd

Any idea why is that? It worked so many times, and noting was changed...

Cheers remove <.vhdx" --vhd> and add <">