Open ohault opened 2 weeks ago
@ohault use Docker and run docker pull mcr.microsoft.com/azurelinux/base/core:3.0
then export the image and import into WSL. It works!
root@toto [ ~ ]# cat /etc/os-release NAME="Microsoft Azure Linux" VERSION="3.0.20241101" ID=azurelinux VERSION_ID="3.0" PRETTY_NAME="Microsoft Azure Linux 3.0" ANSI_COLOR="1;34" HOME_URL="https://aka.ms/azurelinux" BUG_REPORT_URL="https://aka.ms/azurelinux" SUPPORT_URL="https://aka.ms/azurelinux" root@toto [ ~ ]# wslinfo --wsl-version 2.3.25
Hi, I have a project that does this. https://github.com/charles8191/azurelinux-wsl.git
There's a new way to package a WSL distro. See details at https://devblogs.microsoft.com/commandline/whats-new-in-the-windows-subsystem-for-linux-in-november-2024/#how-will-it-work
Here are the files I used to create azurelinux.wsl
package:
/etc/oobe.sh
:
#!/bin/bash
set -ue
DEFAULT_GROUPS='adm,cdrom,sudo,dip'
DEFAULT_UID='1000'
echo 'Please create a default UNIX user account. The username does not need to match your Windows username.'
echo 'For more information visit: https://aka.ms/wslusers'
if getent passwd $DEFAULT_UID > /dev/null; then
echo 'User account already exists, skipping creation'
exit 0
fi
# Prompt from the username
read -p 'Enter new UNIX username: ' username
# Create the user
useradd --create-home --uid $DEFAULT_UID $username
# Add use to additional groups
usermod -aG $DEFAULT_GROUPS $username
# Set user password
passwd $username
/etc/wsl-distribution.conf
:
# /etc/wsl-distribution.conf
[oobe]
command = /etc/oobe.sh
defaultUid = 1000
defaultName = AzureLinux
[shortcut]
icon = /usr/lib/wsl/wslLinux.ico
[windowsterminal]
ProfileTemplate = /usr/lib/wsl/azurelinux-profile.json
The icon and terminal profiles are not needed, unless you want to customize them. Add the above files to a exported mcr.microsoft.com/azurelinux/base/core
image, compress the export and change the extension to .wsl
, open the file explorer and double-click to install it.
oobe.sh
will run on first launch to setup the default user.