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.
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.
Yeah makes sense, thanks. I've given up on trying to get wsl --import to work (tried Powershell vs cmd, admin vs without admin, all with the same result).
Please re-open; the underlying issue persists. I am experiencing it on one of my devices.
Enabling/Disabling the WSL feature doesn't even fix it. Some state is corrupted that doesn't get reset on removal of WSL.
if --import is not supposed to work reliably, what's the point of using it? I have a 56GB tar ball. sigh
same issue here.
same error.
Could you please re-open the issue ?
Thks
Same issue here. The import failed
same issue here! I understand that wsl2 is in preview.. but why is it so difficult to export just the vhd for wsl2 to make it migratable to new hardware?
Same issue. There was absolutely no reason to close this.
wsl --import does not work for me on Windows 10 (release 10.0.19041.207)
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 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
Same issue. Is there some update about the bug?
Please collect WSL logs and post the backlink to the feedback item here.
You may be able to solve this yourself... Follow the instructions here to start logging https://github.com/microsoft/WSL/blob/2cb110aba644d0bb3ff8d6445448d4e08e11df78/CONTRIBUTING.md#8-detailed-logs
While logman is running, try the import and wait for it to fail
Stop logman and open the .etl files. I had Windows Performance Analyzer already installed https://docs.microsoft.com/en-us/windows-hardware/test/wpt/windows-performance-analyzer
I opened lxcore_service.etl since it was the biggest--figured there might be something useful
I doubled-clicked the tile in the top left where it says "Generic Events" and was able to get a trace that seems to indicate my particular issue

This rootfs I generated from the Fedora Live CD rootfs.img using guestfish with xattrs:true so I suppose that did it
Actually to reproduce this shouldn't be too terribly difficult...
I downloaded the Fedora Workstation iso and extracted the squashfs. From that, I extract rootfs.img. I opened that with guestfish and did tar-out-opts / rootfs.tar xattrs:true selinux:true acls:true
Not sure if others are getting the same error, but seems likely depending on how they've tarred up their OS
I also fixed my tar using $ bsdtar --no-xattrs --format=gnutar -cf rootfs2.tar @rootfs.tar (I'm told Windows ships with bsdtar now?). Credit goes to some people in freenode ##linux
Here are the commands I ran (which created the broken tarball)
wget https://download.fedoraproject.org/pub/fedora/linux/releases/32/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-32-1.6.iso
isoinfo -i Fedora-Workstation-Live-x86_64-32-1.6.iso -R -x /LiveOS/squashfs.img > squashfs.img
unsquashfs squashfs.img
LIBGUESTFS_BACKEND=direct guestfish -a squashfs-root/LiveOS/rootfs.img <<EOF
launch
mount /dev/sda /
tar-out-opts / rootfs.tar xattrs:true selinux:true acls:true
EOF
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.
@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.
@jbarrella Thanks for those hints, this did the trick for me too.
It must be something in the air (perhaps COVID), 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.
See my comment above--you can use Windows Performance Analyzer https://github.com/microsoft/WSL/issues/4735#issuecomment-708050588
Usually the hex looking 0x00000000 error messages can be looked up in the DLL concerning the functionality although I don't remember off the top of my head
Edit: Here is some info on the hex codes https://blog.sqlauthority.com/2018/07/15/how-to-convert-hex-windows-error-codes-to-the-meaningful-error-message-0x80040002-and-0x80040005-and-others-interview-question-of-the-week-182/
But yeah, not sure why they chose to capture that exception and repackage it as something more generic