WSL Import and run in Ubuntu WSL in Lunar Daily (archived)

DownloadLink to the download information
WSL Import and runDetailed information on the testcase
Testcase (Report an issue with this testcase)

This test case imports a WSL image from a rootfs and runs it.

It requires a working Microsoft Windows 10 or higher installation with WSL2 enabled. Installing Windows and enabling WSL 2 is outside of the scope of this test case.

To run this test you must download the image from http://cloud-images.ubuntu.com/

For example for latest focal image download: http://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-wsl.rootfs.tar.gz
Make sure to download the image from the download link associated to this test case.

Open Windows Terminal or PowerShell and execute the test case below:

Import the image in WSL
> wsl.exe --import <name of the distro> <location to unpack rootfs> <rootfs> [--version <version of WSL>]

For example:

> wsl.exe --import Ubuntu20.04.3 .\wsl\ .\Downloads\focal-server-cloudimg-amd64-wsl.rootfs.tar.gz --version 2
Verify that the image has been imported by running the following command:
> wsl.exe --list --all --verbose
NAME             STATE           VERSION
*Ubuntu          Running         2
Ubuntu20.04.3    Stopped         2
Ubuntu-Preview   Stopped         2
Ubuntu-20.04     Stopped         2
TestUbuntuWSL    Stopped         2
Check the the name used in previous command appears in the list.
Launch the newly installed application
> wsl -d Ubuntu20.04.3
Verify that you're inside the WSL instance and running the right distribution. For example run:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal
Since the image has been installed directly and not with the distro launcher, you're logged in a root by default and have to create a first user manually.
# adduser ubuntu
Adding user `ubuntu' ...
Adding new group `ubuntu' (1000) ...
Adding new user `ubuntu' (1000) with group `ubuntu' ...
Creating home directory `/home/ubuntu' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for ubuntu
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
Add the newly created user to the sudo group:
# usermod -aG sudo ubuntu
Verify that you can switch to the new user
# su ubuntu
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
$ whoami
ubuntu
Exit WSL. Type CTRL+D twice until you're back to the PowerShell prompt.
Start a WSL session directly with the newly created user.
> wsl -d Ubuntu20.04.3 -u ubuntu
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.10.43.3-microsoft-standard-WSL2 x86_64)

* Documentation:  https://help.ubuntu.com
* Management:     https://landscape.canonical.com
* Support:        https://ubuntu.com/advantage

System information as of Mon Aug 23 03:31:35 PDT 2021

System load:  0.16               Processes:             8
Usage of /:   0.5% of 250.98GB   Users logged in:       0
Memory usage: 6%                 IPv4 address for eth0: 172.30.131.4
Swap usage:   0%

1 update can be applied immediately.
To see these additional updates run: apt list --upgradable

This message is shown once a day. To disable it please create the
/home/ubuntu/.hushlogin file.
ubuntu@WSL:/mnt/c/Users/ubuntu$
Run a command as root with sudo, for instance
$ sudo apt update
Verify that the command ends successfully
Apply any update
$ sudo apt full-upgrade
Verify that the command ends successfully and that any packge that must be upgraded has been upgraded
Install a package
$ sudo apt install hello
Verify that the package has been successfully installed and the application can run
$ hello
Hello, world!
Install and run a graphical application
$ sudo apt install x11-utils
[...]
Start one of the graphical application from the x11-utils package, like xcalc for example:
$ xcalc
(Wait a moment until the application starts and is displayed)
Exit WSL
logout
Check that your back to the PowerShell prompt
Uninstall the application
> wsl.exe --unregister Ubuntu20.04.3
The application is no longer listed
> wsl --list
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
Ubuntu-Preview
Ubuntu-20.04
TestUbuntuWSL
And the directory is empty
> ls .\wsl
>

If all actions produce the expected results listed, please submit a 'passed' result.
If an action fails, or produces an unexpected result, please submit a 'failed' result and file a bug. Please be sure to include the bug number when you submit your result.

ReporterLast updateBugsComment
Passedleok2023-04-26 11:43

Dell [ Optiplex] MT 7060, i7-8700, 32 GB, Intel HD Graphics 630, Intel i219 GB Ethernet, Samsung NVMe 256GB SSD
Testcase:running Windows 11 Pro 22H2 OS build 22621.1555 - installing Ubuntu Lunar -all good

Link to the testcase revision
Passedleok2023-04-26 10:50

ASUS Pro H610M-C i7-12700 Motherboard,32GB,Intel UHDGraphics 770,Intel 219-V GB Ethernet,1TB Intel SSD
Testcase:running Windows 11 Pro 22H2 OS build 22621.1555 - installing Ubuntu Lunar -all good

Link to the testcase revision
Add a test result

You need to be logged in to submit your test results.