Skip to content

Import Rocky Linux to WSL

Prerequisites

The Windows-Subsystem for Linux feature has to be enabled. This is possible with one of these options:

  • Open an administrative Terminal (either PowerShell or Command-Prompt) and run wsl --install (ref.)
  • Go to the graphical Windows Settings and enable the optional feature Windows-Subsystem for Linux

This feature should be available on every supported Windows 10 and 11 version right now.

Steps

  1. Get the container rootfs. This is possible in multiple ways:

    • Download the image from the latest Github Action build
    • Download the image (the layer.tar.xz file) from one of the branches of the Github repo
    • Extract the image from either Docker Hub or Quay.io (ref.)\ <podman/docker> export rockylinux:9 > rocky-9-image.tar
  2. (optional) You might have to extract the docker rootfs layer from the image you got (you need the tar file)

  3. Create the directory where the WSL will store its files (mostly somewhere in the userprofile)
  4. Finally, import the image into WSL (ref.):

    • WSL: wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-9-image.tar>
    • WSL 2: wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-9-image.tar> --version 2

WSL vs. WSL 2

Generally speaking WSL 2 should be faster than WSL, but that might differ from use-case to use-case.

Windows Terminal

If you have Windows Terminal installed, the new WSL distro name will appear as an option on the pull-down menu, which is quite handy for launching in the future. You can then customize it with colors, fonts, etc.

systemd

Microsoft finally decided to bring systemd into the WSL. (ref) You only need to add systemd=true to the boot ini section in the /etc/wsl.conf file! (Please make sure you are running a WSL version equals or later 0.67.6)

Microsoft Store

Currently there is no image in the Microsoft Store, if you want to help with bringing it to there join the conversation in the Mattermost SIG/Containers channel! There has been some effort a long time ago, which can get picked up again.


Last update: September 26, 2022

Author: Lukas Magauer