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

WSL --import returns Unspecified error #4735

Closed
yphillip opened this issue Dec 5, 2019 · 76 comments
Closed

WSL --import returns Unspecified error #4735

yphillip opened this issue Dec 5, 2019 · 76 comments
Assignees
Labels
distro-mgmt problems related to import, export, conversion needs-author-feedback

Comments

@yphillip
Copy link

yphillip commented Dec 5, 2019

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.

@therealkenc
Copy link
Collaborator

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.

@yphillip
Copy link
Author

yphillip commented Dec 5, 2019

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).

@yphillip yphillip closed this as completed Dec 5, 2019
@dleslie
Copy link

dleslie commented Jan 5, 2020

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

@dleslie
Copy link

dleslie commented Jan 5, 2020

Enabling/Disabling the WSL feature doesn't even fix it. Some state is corrupted that doesn't get reset on removal of WSL.

@Congee
Copy link

Congee commented Feb 25, 2020

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

@yuis-ice
Copy link

same issue here.

@antonymarion
Copy link

same error.

Could you please re-open the issue ?

Thks

@jbdamiano
Copy link

Same issue here.
The import failed

@4iter4life
Copy link

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?

@kennystrawnmusic
Copy link

Same issue. There was absolutely no reason to close this.

@yphillip yphillip reopened this May 4, 2020
@jozefizso
Copy link

wsl --import does not work for me on Windows 10 (release 10.0.19041.207)

@torvnen
Copy link

torvnen commented May 26, 2020

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.

@Ron2014
Copy link

Ron2014 commented May 29, 2020

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

@hbhbts
Copy link

hbhbts commented Aug 15, 2020

Same issue.
Is there some update about the bug?

@therealkenc
Copy link
Collaborator

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

@nijave
Copy link

nijave commented Oct 13, 2020

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
image

This rootfs I generated from the Fedora Live CD rootfs.img using guestfish with xattrs:true so I suppose that did it

@nijave
Copy link

nijave commented Oct 14, 2020

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

@jbarrella
Copy link

jbarrella commented Oct 31, 2020

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.

@RSpliet
Copy link

RSpliet commented Nov 3, 2020

@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.

@nijave
Copy link

nijave commented Nov 3, 2020

@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 #4735 (comment)

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

@mslinn
Copy link

mslinn commented Jan 8, 2021

Very unhappy with this problem. I tried @jbarrella's workaround but "Unspecified error" came back. No hex code. Nothing to work with. Seriously, Microsoft, you need to do better than this lame error message!

@timkscripts
Copy link

After creating the wslconfig file in my $HOME directory and also checking '/etc/wsl.conf.' inside the TAR file to be sure of no conflicts, setting my RAM etc did not resolve the 'unspecified error' issue.
Using logman.exe as noted above didn't populate my etl files either.
I have tried every solution in this thread and a few other threads.
It turns out I opened my .tar file with 7-zip and it said it was corrupted with no end-of-file.
I extracted the TAR and it extracted with 1 error.
Data error in ".\version-pack-data...\docker...\diff\binaries\crictl" File is broken.

Unfortunately, re-taring my broken .tar does import after doing wsl --import again, however it does not boot when calling WSL. so its broken.
I already unregistered the image after exporting it thinking it was backed up. And I do not see it anymore under the /local/ folders.
So, I think I lost my image. I guess its good to learn this lesson early on that if something zips or tars, check it somehow.

@teenphly
Copy link

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.

@jiceorange
Copy link

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.

I'm also seeing "unspecified". Can you be a bit more detailed about the cherry pick process? Do you mean to hand copy the files into the newly installed distro? What's a safe way to do that that preserves ownership and permissions?

@buliaoyin
Copy link

Unspecified error wins Nothing above worked for me, I think I lost everything I had configured in my wsl instance. I have the TAR, and it is not corrupted, I tried to get logs during the process but after following https://github.com/microsoft/WSL/blob/2cb110aba644d0bb3ff8d6445448d4e08e11df78/CONTRIBUTING.md#8-detailed-logs the files

lxcore_kernel.etl
lxcore_service.etl
lxcore_user.etl

never been filled.
Seems there is a problem with the vdhx size for WSL2, all the time the error came after the vdhx size reaches 256GB, mine is bigger than that. I unregistered the WSL instance after exporting it using the wsl command, I'm not able to compress or try to resize the vdhx to a smaller size.
DON'T try to move your vdhx to another drive if your current one is bigger than 256GB, I tried everything, and looks like there is no solution and no one knows exactly how to solve it. I saw comments on many places that few were able to solve the problem when instances are less than 256Gb.
Importing the instance as WSL1 completes the process but the Ubuntu system now is corrupted and nothing is working as expected, errors are everywhere on almost every command. Trying to set the WSL1 to WSL2 is not working, again fails when the vdhx reaches the 256GB.
Just don't bother yourself trying to move your instance to another ssd/hdd.

Exactly the same situation. A lot of my work in ubuntu lost. Hope feature version could restore my .tar.

I'm thinking make another basic ubuntu distro, then extract my .tar inside. Hope me have luck.

It seems worked, first make a new ubuntu distro, then migrate to new disk, enlarge to 1T, at last extract tar file in the new ubuntu distro to replace all of the files.

@ghost ghost closed this as completed Dec 22, 2022
@ghost
Copy link

ghost commented Dec 22, 2022

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!

@SuperSandro2000
Copy link

SuperSandro2000 commented Dec 24, 2022

bump

@vbarrancos
Copy link

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.

@SuperSandro2000
Copy link

SuperSandro2000 commented Jan 5, 2023

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.

@duncanvsn
Copy link

I worked around this error following the instructions here: #8787 (comment)

I hope this issue can be re-opened and we get a proper solution.

@myfeing
Copy link

myfeing commented Jan 18, 2023

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

yes, it does work, my tar file up to 10g

@girol
Copy link

girol commented Jan 27, 2023

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.

@Mistic92
Copy link

Mistic92 commented Feb 2, 2023

I was trying to move my WSL to another drive and now I can't import it because of this error :/

@monadstack
Copy link

monadstack commented Feb 9, 2023

reproducible on corrupt vhd, the error could be more descriptive, so that debugging is ez.

@gabeklavans
Copy link

Just happened to me. I just did another import, exact same command, and it worked. Kinda weird.... please output a more descriptive error.

@Wall1e
Copy link

Wall1e commented Feb 17, 2023

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

@monadstack
Copy link

Unspecified error

The error itself is just "Unspecified error", no other descriptive means, turns out my problem was my wsl vhd is corrupt, hence. if it was fresh from store, then it is fine.

@YAmikep
Copy link

YAmikep commented Feb 18, 2023

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.

The same worked for me. Phew! I thought for a moment that the backup distro I made would be useless...
@girol Thank you for the tip 🙏

The export/import feature not being reliable is definitely a concern...

@rjoomen
Copy link

rjoomen commented Feb 21, 2023

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?

@sonnguyenmaxava
Copy link

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

@eiz
Copy link

eiz commented Mar 7, 2023

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.

@fractalzombie
Copy link

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

@MiloDC
Copy link

MiloDC commented Mar 24, 2023

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

#4735 (comment)

@fractalzombie
Copy link

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

@ken-cdit
Copy link

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

@armanexplorer
Copy link

armanexplorer commented Apr 25, 2023

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 🎉

@mslinn
Copy link

mslinn commented Apr 25, 2023

I will document that on https://www.mslinn.com/blog/2022/01/10/wsl-backup.html later this week.

@jcrben
Copy link

jcrben commented Oct 23, 2023

I was originally trying to do this from an msys2 shell

Changing to powershell and running the command with a .\ as suggested here fixed it for me:

wsl --import wsl-vpnkit-2 ../bin/wsl-distros .\wsl-vpnkit-3.8.tar.gz --version 2

@taljacob2
Copy link

I was originally trying to do this from an msys2 shell

Changing to powershell and running the command with a .\ as suggested here fixed it for me:

wsl --import wsl-vpnkit-2 ../bin/wsl-distros .\wsl-vpnkit-3.8.tar.gz --version 2

Thanks!
Stating the --version 2 solved this for me!

@carpe1
Copy link

carpe1 commented Mar 21, 2024

I also had this issue, later I found out that the reason was just because of lack of space, I solved this problem simply by freeing up more disk space.

@daydreamingwill
Copy link

For anyone who needs to hear it…
If you're importing a .vhdx instead of a .tar, wsl needs the “—-vhd” parameter to be parsed.

It's my bad, as I missed that detail in the docs; however, surely Microsoft could do better than “unspecified error” when a spoon like me parses a .vhdx without “-—vhd”?

@syhesyh
Copy link

syhesyh commented Sep 22, 2024

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

This issue was closed.
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 needs-author-feedback
Projects
None yet
Development

No branches or pull requests