Contributing to the code¶
We anticipate that most code contributions will be for the Ubuntu Pro for WSL application.
The source for the Pro for WSL code can be found on GitHub:
Information helpful for the development of this Windows application is included below.
Prerequisite: a Windows machine¶
To test and debug Ubuntu on WSL and Pro for WSL you will need a Windows machine with WSL installed.
It is possible to run Ubuntu on WSL in a VM with nested visualisation but we do not recommend this as a testing environment.
Additional dependencies for Ubuntu Pro for WSL¶
Ubuntu 26.04 LTS installed in WSL
Visual Studio Community 2022 or above
Go
Flutter
An Ubuntu Pro token
The test suite for Ubuntu Pro for WSL¶
The source code includes a comprehensive test suite made of unit and integration tests. All the tests must pass with and without the race detector.
Each module has its own package tests and you can also find the integration tests at the appropriate end-to-end (e2e) directory.
The test suite must pass before merging the PR to our main branch. Any new feature, change or fix must be covered by corresponding tests.
Building and running the binaries for Ubuntu Pro for WSL¶
For building, you can use the following two scripts:
Note
You’ll need to create a self-signing certificate to build the Windows Agent.
Install individual components of Ubuntu Pro for WSL for development¶
This guide will show you how to install Pro for WSL for local development and testing.
Requirements:
A Windows machine with access to the internet
The Windows Subsystem for Linux optional feature enabled
One or more instances of Ubuntu on WSL installed
1. Download the Windows Agent and the WSL Pro Service¶
Go to the repository actions page.
Click the latest successful workflow run.
Scroll down past any warnings or errors, until you reach the Artifacts section.
Download:
Windows agent: UbuntuProForWSL+…-production
wsl-pro-service: Wsl-pro-service_…
Notice that, for the step above, there is also an alternative version of the MSIX bundle enabled for end-to-end testing. Most likely, that’s not what you want to download.
2. Install the Windows Agent¶
This is the Windows-side agent that manages the distros.
Uninstall Pro for WSL if you had installed previously:
PS>Follow the download steps to download UbuntuProForWSL
Unzip the artefact
Find the certificate inside. Install it into
Local Machine/Trusted people.Double click on the MSIX bundle and complete the installation.
The Firewall may ask for an exception. Allow it.
The GUI should show up. You’re done.
3. Install the WSL Pro Service¶
This is the Linux-side component that talks to the agent. Choose one or more distros Jammy or greater, and follow the instructions.
Uninstall the WSL-Pro-Service from your distro if you had it installed previously:
$Follow the download steps to download the WSL-Pro-Service.
Unzip the artifact.
Navigate to the unzipped directory containing the .deb file. Here is a possible path:
$Install the deb package.
$Ensure it works via systemd:
$
Restart Ubuntu Pro for WSL during development¶
Some configuration changes only apply when you restart Ubuntu Pro for WSL. Here is a guide on how to restart it. There are two options.
Option 1: Restart your Ubuntu Pro for WSL host machine¶
This is the simple one. If you’re not in a hurry to see the configuration updated, just wait until next time you boot your machine.
Option 2: Restart only Ubuntu Pro for WSL¶
Stop the agent:
PS>Stop the distro, or distros you installed WSL-Pro-Service in:
PS>PS>Alternatively, stop all distros:
PS>Start the agent again:
Open the start Menu and search for “Ubuntu Pro for WSL”.
The GUI should start.
Wait a minute.
Click on “Click to restart it”.
Start the distro, or distros you installed WSL-Pro-Service in.
Access Ubuntu Pro for WSL logs for debugging¶
At some point you may want to read the Ubuntu Pro for WSL logs, most likely for debugging purposes. The agent and the service store their logs separately. This guide shows you where to find each of the logs.
Access the logs for the WSL Pro service¶
To access the logs of a specific distribution’s WSL-Pro-Service, you must first launch the distribution and then query the journal:
$ For more information on using the journal, you can check out its man page with man journalctl or online.
These logs may be insufficient for proper debugging, so you may be interested in looking at the agent’s logs as well.
Access the logs for the Windows Agent¶
To access the logs for the Windows Agent:
Go to your home directory
Open the file explorer
Write
%USERPROFILE%at the address
In the home directory, find the
.ubuntuprodirectory and double-click on it.In the
.ubuntuprofolder, find filelogand open it with any text editor.This file contains the logs sorted with the oldest entries at the top and the newest at the bottom.
Enable opt-in features of Ubuntu Pro for WSL during development¶
Some features in Ubuntu Pro for WSL are opt-in or can be toggled on and off via the Windows Registry. While the code is arranged such that CI always tests with those features enabled, when running Pro for WSL on your machine, you may need to toggle them on and off explicitly via the Windows registry. This guide shows you how to do that.
Enable subscribing via the Microsoft Store¶
Open the Windows registry editor: press
Win + R, typeregeditand pressEnter.Navigate to the following key:
HKEY_CURRENT_USER\Software\Canonical\UbuntuPro\.Create a new DWORD value named
AllowStorePurchaseand set it to1.
The next time you open the GUI you’ll find the button to subscribe to Ubuntu Pro via the Microsoft Store.
Warning
This can incur real charges if you proceed with the purchase.
Disable Landscape configuration in the GUI¶
Landscape configuration page and related buttons are enabled by default, but can be disabled via registry.
Open the Windows registry editor: press
Win + R, typeregeditand pressEnter.Navigate to the following key:
HKEY_CURRENT_USER\Software\Canonical\UbuntuPro\.Create a new DWORD value named
LandscapeConfigVisibilityand set it to0.
The next time you open the GUI, you’ll find that the Landscape configuration
page can be shown via the set up wizard or by clicking on the ‘Configure
Landscape’ button.
If that value is not present or set to anything other than 0, Landscape configuration page
and related buttons will be visible.
Reset Ubuntu Pro for WSL to factory settings¶
You can reset Ubuntu Pro for WSL to factory settings following these steps:
Shut down WSL
PS>Uninstall the package and shut down WSL:
PS>Remove the public directory:
PS>Remove the registry key:
Press Win+R
Type
regedit.exeand click OKWrite
HKEY_CURRENT_USER\Software\Canonical\UbuntuProat the address barIf this fails, you are done (the key does not exist).
Find the
UbuntuProkey on the leftRight-click on it
Click delete
Install the Windows Agent package again (see the section on how to install). You do not need to re-install the WSL-Pro-Service.
You’re done. Next time you start the GUI it’ll be like a fresh install.