Acquiring the image
First, you need to download and install a bootstrapped Arch Linux image.
Open a Windows PowerShell and download a bootstrapped tarball from a suitable Arch Linux mirror:
Extract and repackage the bootstrap image
Extract and repackage the downloaded bootstrap image in another Linux distro, e.g. WSL Ubuntu.
cd /mnt/c/Users/$USER/Downloads/
# Move the downloaded file to the Linux home folder
mv archlinux-bootstrap-x86_64.tar.gz ~
# Go to your home folder
cd
# Extract the tar.gz bootstap file
tar -zxvf archlinux-bootstrap-x86_64.tar.gz
# Go to the following subdirectory
cd root.x86_64
# Repackage the extracted tar.gz (there is a dot at the end)
tar -zcvf archlinux-bootstrap_repackage-x86_64.tar.gz .
# Put the file back to your Windows Downloads folder
mv archlinux-bootstrap_repackage-x86_64.tar.gz /mnt/c/Users/$USER/Downloads/
Pick an installation location
Create a directory in you home folder labeled “wsl”. Make sure that each distro has their own location.
Import the tarball and update the system
Import the tarball requires an installation location with no other distro, or otherwise it will fail.
When importing the tarball is complete, run
You will be greeted with a root user prompt #.
Switch to the home directory with cd.
Enable DNS resolving
Now you will need a working internet connection. In my case, DNS was not resolving from within WSL. If that’s the case for you as well do the following:
[network]
generateResolvConf = false
EOF
And use Google’s DNS:
nameserver 8.8.8.8
nameserver 1.1.1.1
EOF
Make pacman work
Initialize the keyring and populate it
Update packages
Let’s update the system first now that we should have a working network:
Use reflector to find the fastest mirrors
pacman -Sy reflector
# Then use reflector to find the fastest mirror for your location (“Netherlands” in my case).
reflector –country “Netherlands” –age 12 –protocol https –sort rate –save /etc/pacman.d/mirrorlist
Installing some required packages
Setting up passwords and one user with sudo privileges
Uncomment the line containing %wheel ALL=(ALL) ALL; do the same to the next line with %wheel if you want to run sudo tasks without having to provide your password.
root password
Set the root user password with passwd before setting up the login user account.
Creating a user and setting a password
Now create a user and set a password.
Setting up wsl.conf
Because Arch Linux was imported, by default the login user is the root user even with a user account. To prevent this, a config file needs to be created to tell wsl which user to log in. Create the file /etc/wsl.conf and copy the following, replacing ‘rubenjs’ with your own username.
Settings for wsl.conf
enabled = true
options = “metadata,uid=1000,gid=1000,umask=22,fmask=11,case=off”
mountFsTab = true
crossDistro = true
[network]
generateHosts = true # When using with systemd, otherwise `false`.
generateResolvConf = true
[interop]
enabled = true
appendWindowsPath = true
[user]
default = rubenjs
[boot]
systemd=true
Finishing the setup process
If you use Windows Terminal, the best way is to close it, and then reopen it. A new profile for Arch has been added.
Check if systemd is working
If systemd is functional, you should see a green indication, and you can create your own systemctl scripts, but before that, let’s first enable some services.
Installing and aur helper such as yay
cd yay-bin
makepkg -si –noconfirm
Adjust locale
Uncomment the locales you use on your instance. For me, I uncomment nl_NL.UTF-8 UTF-8 and en_US.UTF-8 UTF-8.
Then generate the locales
sudo su
echo “LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE=nl_NL.UTF-8
LC_NUMERIC=nl_NL.UTF-8
LC_TIME=nl_NL.UTF-8
LC_COLLATE=nl_NL.UTF-8
LC_MONETARY=nl_NL.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_ADDRESS=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8
LC_IDENTIFICATION=nl_NL.UTF-8
LC_ALL=
“ > /etc/locale.conf
Optional: Enabling multilib
linenumber=$(grep -nr “\#\[multilib\]” /etc/pacman.conf | gawk ‘{print $1}’ FS=“:”)
sed -i “${linenumber}s:.*:[multilib]:” /etc/pacman.conf
linenumber=$((linenumber+1))
sed -i “${linenumber}s:.*:Include = /etc/pacman.d/mirrorlist:” /etc/pacman.conf