How do I install wsl on a PC with a clean install of Windows 11 using ubuntu.tar, an image file created and saved on a previous PC?

30 views Asked by At

Clean install Windows 11 to replace Mother Board.

There is an image file, image_file.tar, created for migration on the previous PC, so on the new PC

$ wsl --import Ubuntu-22.04 N:\WSL\Ubuntu-22.04 N:\WSL\ubuntu.tar --version 2

When I try to install with $ wsl.exe, I get a message about how to use wsl.exe and cannot import.

When I look on the net, I often see how to start with $ wsl --install, but I can't seem to find a way to install from the image_file.tar where my settings are saved. How can I install from a .tar file?

1

There are 1 answers

0
LeonhardThird On

As pointed out in the Comment, $ wsl --import was not possible in the clean install state, but after $ wsl --install first.

$ wsl --install # install ubuntu by wsl

Reboot and enter username, password

WSL2 shutdown

$ wsl --shutdown

Check WSL2 running status. it will be Stopped. NAME at this time is the distribution to be removed.

$ wsl -l -v 

Remove distribution from C drive

$ wsl --unregister Ubuntu # -> Use NAME displayed by wsl -l -v

then import

$ wsl --import Ubuntu-22.04 N:\WSL\Ubuntu-22.04 N:\WSL\import_image.tar