WSL has a limitation. Once you install a distro using wsl --install, you cannot just install a second copy of the same distro. The way to get around this is to install the latest distro, such as Ubuntu 24.04, and then make a backup of the pristine distro so that it can be duplicated later via import. It seems like something that should just be an option in wsl --install, but alas, it is not.
In this article I will walk you through the steps required to create this pristine copy of a distro. I will also show you how to name your distro in WSL something besides Ubuntu or Ubuntu 24.04.
To demonstrate a new hence pristine instance of a distro must be installed on WSL. This topic was covered in a previous blog WSL: Always Specify the Distro Version When Installing. Moving forward I will not be doing any work on this distro. See the following demarcated n boldface (courtesy of running wsl -l -v):
For example, on the Ubuntu-24.04 distro I will not install any Azure-related packages or Azure AI packages. Ubuntu-24.04 is my pristine/clean/greenfield distro, and any project-specific work will be done by making a copy.
Once a new distro is installed, I like updating the distro to use the latest packages by running:
On my personal machines I like disabling the sudo prompt, which was covered in this is blog, Ubuntu/Linux: Disable sudo Password Prompt. This means that each copy of the distro instance will also have sudo disabled.
Once the pristine/clean/greenfield distro is patched, make a backup of it by following the steps in WSL: Backing Up and Deleting a Distro, and obviously do not delete the current distro.
When I start a new project, such as my Azure AI Foundry work, I will create a new distro named for the project. It will be a suitable name like AzAiUbuntu-24.04, and I will follow the steps here to import an instance of the distro with the aforementioned name (see WSL: Restoring a Distro from a Backup).
To create (import) a project-specific distro I would use these parameters:
- Distro AzZiUbuntu-24.04Host00
- InstallLocation: C:\Users\jann\AppData\Local\wsl\AzAiUbuntu-24.04
- FileName: C:\Backups\20250921Ubuntu-24.04.tar
No comments :
Post a Comment