Andrew Jorgensen
It's better than bad, it's good!

Amazon Linux 2023 on WSL2

This post is an update to Amazon Linux 2022 on WSL2 after container images of AL2023 were made available on the Amazon Linux CDN.

Like almost any Linux distribution that has a container image available, you can run Amazon Linux 2023 on the Windows Subsystem for Linux. This guide assumes you've installed and configured WSL2 and already have something like Debian running under it.


AL2023 container images can be downloaded from:

WSL will be able to import the .tar.xz file directly.


From PowerShell or Command Line, import the image into WSL (you may want to choose a different InstallLocation than I have here):

wsl --import AL2023 C:\WSL\AL2023 Downloads\al2023-container-<version>-x86_64.tar.xz

Assuming that succeeded you can log in (as root):

wsl --distribution AL2023
Processing fstab with mount -a failed.

[root@Lenovo-M90n andrew]# cat /etc/os-release
NAME="Amazon Linux"
PRETTY_NAME="Amazon Linux 2023"

Install Missing Packages

Now even though we used the container image and not container-minimal, a lot of the things you'd find in an AL2023 AMI are missing. That's why Processing fstab with mount -a failed. It's meant to be a container runtime image, not a user-interactive image, so this is normally fine.

dnf -y install util-linux passwd sudo

That will get you mount, useradd, passwd and sudo, which are all you need for the remaining steps. sudo recommends system-default-editor which will default to nano. I'm old enough to prefer vim, and if you add vim-default-editor to the dnf install command it will skip nano.

You probably also want to know when updates are available with the new repository versions feature.

dnf -y install 'dnf-command(check-release-update)'


If you want an unprivileged user, you'll need to add one and set a password (the --groups wheel option makes it so this user can use sudo):

useradd \
  --create-home \
  --user-group --groups wheel \
  --comment User \
passwd user

To configure WSL to use that user by default, you also need to create an /etc/wsl.conf file with the following content:

default = user

Log out, terminate the VM, and start it again. This time you should be logged in as the user you created earlier:

wsl --terminate AL2023
# Wait 8 seconds?
wsl --distribution AL2023

To get it to show up under Windows Terminal you might need to stop WSL or reboot:

wsl --shutdown

I've also needed to delete the state.json file from %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\ to get the icon shortcuts for the Windows Terminal to update, but that's probably a bug.


If you've got WSLg installed you can even install a GUI application and run it from AL2023. Since it doesn't have many GUI applications, you could install and run one from Flathub:

sudo dnf -y install flatpak
flatpak install -y --user --from
flatpak run --user org.gnome.TwentyFortyEight

GNOME 2048 on AL2023 on WSL2