Details for revision 1837 of testcase: WSL Import and run



BugReport a bug against the content of this testcase
ID1739
TitleWSL Import and run
LinkNo link provided
Part of testsuitesWSL

RevisionWritten on the 2024-05-10 04:57 by andersson123
RevisionWritten on the 2021-08-23 11:30 by jibel
RevisionWritten on the 2021-08-23 11:27 by jibel
RevisionWritten on the 2021-08-23 11:26 by jibel
RevisionWritten on the 2021-08-23 11:24 by jibel
RevisionWritten on the 2021-08-23 11:16 by jibel
RevisionWritten on the 2021-08-23 11:13 by jibel
RevisionWritten on the 2021-08-23 11:12 by jibel
RevisionWritten on the 2021-08-23 11:11 by jibel
RevisionWritten on the 2021-08-23 11:09 by jibel
RevisionWritten on the 2021-08-23 11:09 by jibel
Text

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

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. TypeCTRL+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
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 xcalc
		[...]
		$ 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.

RevisionWritten on the 2021-08-23 11:06 by jibel
RevisionWritten on the 2021-08-23 10:27 by jibel
RevisionWritten on the 2021-08-23 07:26 by jibel