WSL: WSL --import returns Unspecified error

I had to get my computer replaced because of a hardware problem, and I backed up my wsl distro in preparation for moving it to the new computer. When I copy the tar file over to the new computer and try wsl --import, I get an Unspecified error.

Windows version / build number

Both computers: Windows [Version 10.0.18362.476]

Steps required to reproduce

On the old computer: wsl --export Ubuntu ubuntu_backup_2019_12_04.tar

On the new computer: Enable WSL (Enable developer mode, turn on WSL in Windows Features) wsl --import Ubuntu C:\Users\yphillip\AppData\Local\Packages\Ubuntu C:\Users\yphillip\wsl_backup\2019_12_04\ubuntu_backup_2019_12_04.tar The only output I get from this is Unspecified error.

The tar file is about 16 GB, and I have no problems sharing it if it might help someone debug my problem. Just let me know. Hoping I can salvage my old setup so I don’t have to re-setup everything from scratch on the new computer.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 25
  • Comments: 78

Most upvoted comments

Not a fan of the unspecified error myself.

Practical suggestion is to install a fresh distro on your new box. Unpack your tarball there. Cherry pick the stuff you care about, notably your /home. Then apt install your favorite stuff.

if --import is not supposed to work reliably, what’s the point of using it? I have a 56GB tar ball. sigh

Please re-open; the underlying issue persists. I am experiencing it on one of my devices.

Had this same issue after exporting/importing a fairly new Ubuntu 18.04, with a Windows reset in between.

Fixed the issue by importing(installing) the distribution with LxRunOffline.

Thank you so much! This is the only fix in my case. running LxRunOffline.exe install -n <distro name> -d <installation directory> -f <full path to the tarball> in powershell did the magic.

Afterwards, Ubuntu1804.exe(your distro) config --default-user <user name> sets the right user.

@jbarrella Thanks for those hints, this did the trick for me too.

I’m sorry, but I strongly feel like trying to make a point. 16 years ago I abandoned Windows XP in favour of Red Hat 9. My primary motivation back then was that I found it impossible to debug all the random problems that you can encounter: poor error messages, obscure logs, condescending “please contact your administrator” dialogues. Don’t get me wrong, Linux back then had many many flaws and shortcomings, but it treated me maturely with log files and descriptive error messages in predictable places. 16 years later and situations like these make me feel like little has improved in Windows-land. “Unspecified error” is next-to-useless. Obviously this is not all the WSL devs’ fault (so don’t take it personal!), but it is something that genuinely puts me off from trying to use software. I appreciate that errors happen everywhere, but please give me the necessary information and tools to solve them on my own rather than leaving me guessing and trying one after the other random seemingly-unrelated thing I find off the internet.

Had this same issue after exporting/importing a fairly new Ubuntu 18.04, with a Windows reset in between.

Fixed the issue by importing(installing) the distribution with LxRunOffline.

Same issue here. The import failed

same error.

Could you please re-open the issue ?

Thks

same issue here.

As a workaround I was able to do the import (moving system to other location) by importing original 135GB vhdx file directly instead of 95GB .tar file:

wsl --import Ubuntu-20.04-d D:\WSL\Ubuntu-20.04\ C:\Users\user\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx --vhd

In case anyone cares, I see this problem of a corrupted .TAR file only when I export a container (docker export) from PowerShell.

When I export from a regular command prompt, it’s fine.

I followed the above instructions to capture an event log (sorry, I will not publicly upload the entire log here) and this is clearly the problem for me (tar file is 370GB, distro is Ubuntu 18.04):

image

not sure why tar is running in a cgroup that allows 64MB of memory on a box with 128GB… 🤣

just a side note though. the fundamental issue here is poor error reporting. the software knows it needs to run an import process inside the VM, and you know you can’t parse all possible outputs into a meaningful error code. Printing out E_FAIL and then I get to go read through a 3 year old closed github issue that conflates every single possible error into one “it has an error” error, is not ideal. You have the logs – show them to me.

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you’re still experiencing this issue please re-open it.

Thank you!

🖕🏼

The bot settings are stupid and force you to post a spam comment every 7 days which just wastes everyone’s time.

Please collect WSL logs and post the backlink to the feedback item here.

I solved this problem by doing this (for Gentoo)

  1. Extracted .tar.xz file to get the actual .tar file
  2. Imported using wsl --import Gentoo path\to\Gentoo\WSL\storage path\to\the\tar\file

Now, no errors

Had the same issue. I exported two WSL 2 distros and then did a clean install of my Windows OS. “Unspecified error” came up when I tried to import them.

I fixed it by downloading the Linux kernel update package referred to at https://docs.microsoft.com/en-us/windows/wsl/install-win10 and then running the command wsl --set-default-version 2.

After this, my two distros imported without error.

This worked for me. I had the whole thing still in the console so here is a screencap…

image

Have same issue as guys. And yes it is already for 3 years, how did you do this?)

#4735 (comment)

this works wsl --import Ubuntu-22.04 "C:\Users\fract\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc" D:\Ubuntu.tar

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you’re still experiencing this issue please re-open it.

Thank you!

In my case it works while changing from: wsl --import Ubuntu "C:\Users\{userName}" fileName.tar to: wsl --import Ubuntu "C:\Users\{userName}" .\fileName.tar

@moyans This didn’t work either. The issue still exists

add memory and swap in .wslconfig image

I tried these two schemes and finally succeeded.

Had the same issue. I exported two WSL 2 distros and then did a clean install of my Windows OS. “Unspecified error” came up when I tried to import them.

I fixed it by downloading the Linux kernel update package referred to at https://docs.microsoft.com/en-us/windows/wsl/install-win10 and then running the command wsl --set-default-version 2.

After this, my two distros imported without error.

Same issue here, but changing: wsl --import Ubuntu-22.04 D:\WSL\Ubuntu-22.04 D:\WSL\Ubuntu-22.04.tar to: wsl --import Ubuntu-22.04 .\Ubuntu-22.04 .\Ubuntu-22.04.tar did the trick, wth?

worked for me when moving distro to another drive Thanks @rjoomen

Same error.

I’v tried many versions of backups. If the size of imported file ---- ext4.vhdx is under 8G (mine is 7,829,504KB) can work.

Check this out.

Ron

I meet the same problem ,the configuration of my PC is : win11, wsl2. My .tar is about 150G. I solve this problem by updating my wsl with wsl --update, then I import it again , it works

I finally resolved this amiss during the following steps (Windows 10.0.19045 Build 19045):

  1. Running wsl.exe --import Ubuntu A:\wsl\Ubuntu A:\wsl\Ubuntu.tar = > Unspecified error 💣
  2. Running LxRunOffline.exe install -n Ubuntu -d A:\wsl\Ubuntu -f A:\wsl\Ubuntu.tar => [ERROR] Couldn't get the value "DistributionName" of the registry key "Software\Microsoft\Windows\CurrentVersion\Lxss\AppxInstallerCache" 💣
  3. Removing the Software\Microsoft\Windows\CurrentVersion\Lxss\AppxInstallerCache registry key
  4. Running LxRunOffline.exe install -n Ubuntu -d A:\wsl\Ubuntu -f A:\wsl\Ubuntu.tar => [ERROR] Couldn't get the value "DistributionName" of the registry key "Software\Microsoft\Windows\CurrentVersion\Lxss\TryStoreWSL" 💣
  5. Removing the Software\Microsoft\Windows\CurrentVersion\Lxss\TryStoreWSL registry key
  6. Running LxRunOffline.exe install -n Ubuntu -d A:\wsl\Ubuntu -f A:\wsl\Ubuntu.tar => ✔
  7. Running ubuntu.exe config --default-user arman => ✔
  8. done 🎉

Same issue here, but changing: wsl --import Ubuntu-22.04 D:\WSL\Ubuntu-22.04 D:\WSL\Ubuntu-22.04.tar to: wsl --import Ubuntu-22.04 .\Ubuntu-22.04 .\Ubuntu-22.04.tar did the trick, wth?

Try executing “wsl --import” as an administrator, it works for me

I was trying to move my WSL to another drive and now I can’t import it because of this error 😕

Leaving my 2 cents:

I was experiencing the same issue and making sure all the instances of wsl were down did the trick.

Somehow, wsl --shutdown command was not stopping all my current distributions. I use my machine mainly for coding with VSCode and Docker Desktop. My VSCode was left opened in another workspace holding back a distro up. Closing it, then forcing shutdown and re-importing my .tar file worked.

As a workaround I was able to do the import (moving system to other location) by importing original 135GB vhdx file directly instead of 95GB .tar file:

wsl --import Ubuntu-20.04-d D:\WSL\Ubuntu-20.04\ C:\Users\user\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx --vhd

I was experiencing this issue on a fresh Windows installation with the newest version of WSL/kernel – imports failed randomly after about 18-22GB for a 26GB .tar, either because they would stall indefinitely (no disk activity) or they would return this E_FAIL unspecified error.

The suggestion above (importing the vhdx directly instead of using the .tar from the --export command) worked for me.

I’ve had a .wslconfig with the following contents:

[wsl2]
memory=25GB
swap=0
localhostForwarding=true

after temporarily deleting the file, restarting PC, I was able to successfully import 19GB tar file of Ubuntu distro. Hope that saves someone a few hours!

In case anyone cares, I see this problem of a corrupted .TAR file only when I export a container (docker export) from PowerShell.

When I export from a regular command prompt, it’s fine.

This fixed it for me!

Importing WSL in powershell… getting unspecified error… tried doing the docker export with CMD instead of powershell, now the import works perfectly!