3

I'm trying to migrate my WSL1 Ubuntu 18.04 distro from my old Dell laptop to my new HP laptop that has WSL2 setup. I've run through the following steps many times:

  1. Export the distro on the old laptop (making sure to run Command Prompt in admin mode):

    wsl --export Ubuntu-18.04 C:\Users\[myusername]\Ubuntu-18.04.tar
    
  2. Move the TAR file to the new laptop via a USB drive.

  3. Import the distro on the new laptop (again making sure to run Command Prompt in admin mode):

    wsl --import Ubuntu-18.04 C:\Users\[myusername]\Ubuntu-18.04\ C:\Users\[myusername]\Ubuntu-18.04.tar
    

Every time it fails with the generic message Unspecified error. I've tried adding the argument --version 1, then tried it with --version 2, no difference.

I've heard that this can happen if you run out of memory during the import process. I have 16 gigs of RAM and a quad core processor on the new laptop, plus the distro TAR file is only about 3.3 gigs, so that seems unlikely. Nevertheless I tried making a .wslconfig file in the home directory with absurdly generous provisions:

[wsl2]
memory=8GB
processors=4
swap=120GB

All to no avail, even with the --version 2 option. It just fails much more quickly. (Regarding that huge swap size, I have 405 gigs of free disk space, in case that matters.)

I've even gone to the trouble of upgrading Windows on my old laptop to version 2004, upgrading to WSL2 (while keeping my Ubuntu distro at version 1) and re-exporting the distro to see if that made a difference, but of course it didn't.

Keep in mind that I don't want to have to upgrade my Ubuntu distro to use WSL2 just yet if it can be avoided. I'll do it if it must be done, but this process is supposed to work smoothly even when migrating a WSL1 distro to a WSL2 system. What could be going wrong??

  • [Be sure the directory doesn’t have spaces, to avoid, syntax issues](https://superuser.com/questions/1589877/how-do-you-clone-a-wsl-distro/1589880#1589880) – Ramhound Oct 29 '20 at 14:38
  • Be sure you have the correct name of the distribution and are using something other than *Ubuntu-18.04* when you import it to avoid conflicts with an existing distribution already installed with that name. – Ramhound Oct 29 '20 at 14:40
  • Ramhound, the directory doesn't have spaces, and there are no existing distros. I checked with `wsl --list --all`. – William Beaumont Oct 29 '20 at 17:23
  • Suspect [this](https://blog.codonomics.com/2020/09/wsl-for-development-in-windows-10-is.html?m=1#:~:text=Note%20that%20if%20your%20import%20fails%20with%20%27Unspecified,limit%20memory%20as%20mentioned%20in%20ProTip%205%20above.) will solve the problem. Suspect you have allocated to much memory – Ramhound Oct 29 '20 at 23:03

2 Answers2

0
 wsl --import Ubuntu-18.04 'C:\Users\[myusername]\Ubuntu-18.04\' .\ubuntu.tar

Try with quotes. Should be ok.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 08 '22 at 19:02
  • This did not work for me. It still prints “Unspecified error”. – Fenhl May 25 '23 at 19:57
0

For me, the solution was to update WSL by running the following command as administrator:

wsl --update --web-download

The --web-download option ensures that the WSL update isn't installed from the Microsoft Store, which would prevent it from working inside an SSH session. If you don't need to use WSL this way, the --web-download option may not be necessary.

Fenhl
  • 101
  • 2