Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add Azure Linux 3.0 as a Linux distros for WSL ? #10997

Open
ohault opened this issue Nov 10, 2024 · 3 comments
Open

How to add Azure Linux 3.0 as a Linux distros for WSL ? #10997

ohault opened this issue Nov 10, 2024 · 3 comments
Labels
question Further information is requested

Comments

@ohault
Copy link

ohault commented Nov 10, 2024

  • Manually from a command prompt on a local host
  • for your Windows PCs in your corporate environnement
  • by Microsoft in the list of available distros ( wsl -l -o )
  • as WSL Linux distro on the Microsoft Store
@ohault ohault added the question Further information is requested label Nov 10, 2024
@zcobol
Copy link

zcobol commented Nov 10, 2024

@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

@charles8191
Copy link

Hi, I have a project that does this. https://github.com/charles8191/azurelinux-wsl.git

@elsaco
Copy link

elsaco commented Nov 25, 2024

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.

https://learn.microsoft.com/windows/wsl/build-custom-distro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants