WARNING

This is an old article from the old version of this website and dated from 2018. I consider this article as obsolete, and I don't have plan to update this. The only change I do here, is to do some grammar corrections I miss 3 years ago.

----

Some days ago, I decided to install ArchLinx on WSL, to get a well-known Linux when I am on Windows and for the fun. It is a guide and my feedback about ArchLinux on Windows Subsystem for Linux (WSL). I inspired by the post of David Wood on his website and I adapted to take account new version of Windows 10 and tools I used.

WSL
website

Warning : ArchLinux is not officially supported by WSL, some futures changes in WSL or LxRunOffline can make this guide out-of-date, and I cannot be responsible for bad actions you can do.

LxRunOffline installation

First step is to install LxRunOffline. This tool can create and manipulate WSL instances without used the Microsoft store and can used unsupported Linux distribution.

LxRunOffline

For do install, I prefer to use Chocolatey :

Chocolatey

choco install -y lxrunoffline

With Chocolatey, LxRunOffline will add WSL if not already install on your Windows and do a little modification in Windows Registry. You have to reboot Windows after this step.

Creation of ArchLinux's instance

After that, you have to download the ArchLinux bootstrap, that available on this site or in any ArchLinux mirror in iso/latest folder with the namearchlinux-bootstrap-{yyyy.mm.dd}-x86_64.tar.gz (with {yyyy.mm.dd} the creation date of the archive). In PowerShell (or cmd), you have to execute :

site

lxrunoffline install -n ArchLinux -f X:/where/is/archlinux-bootstrap-{yyyy.mm.dd}-x86_64.tar.gz -d D:/WSL/ArchLinux -r root.x86_64

Note : For the instance creation, I create a new archive based on ArchLinux bootstrap, like said on David Wood's post. I discovered the -r option in the LxRunOffline wiki too late.

If, you got an error like this :

[ERROR] Couldn't open the file or directory "D:\WSL\ArchLinux\rootfs\usr\share\perl5\core_perl\pod\".

It is you have forgotten to do a restart after LxRunOffline installation. You have to remove the instance folder (D:\WSL\ArchLinux for example), reboot and retry.

ArchLinux configuration

Since Windows 10 last update (1803), you have to do a first run of your instance in administration PowerShell. So, to run your ArchLinux's instance, you have to execute (first time as administrator and as normal user the other time) :

lxrunoffline run -n ArchLinux -w

If you try to run the first time as a normal user, you will get this error :

Error : 0x80070005

You started in bash as root user.

Before to do the base installation, you have to choose an ArchLinux mirror (I get the first French mirror, in my case, but you can get any mirror).

echo 'Server = http://archlinux.de-labrusse.fr/$repo/os/$arch' >> /etc/pacman.d/mirrorlist 

Now, you have to initialize the ArchLinux keyring for package validation. You can get the keyring package directly from the ArchLinux's website and do a click on Download From Mirror

ArchLinux's website

pacman-key --init
pacman -U /mnt/X/where/is/archlinux-keyring-20180404-1-any.pkg.tar.xz

Now, you can install the base packages :

pacman -Syu base base-devel

And do the manipulations that you with your ArchLinux's instance (like change language, install packages, ...)

Post installation specific details

Fix fakeroot

The standard fakeroot install by ArchLinux does not work well in WSL, you have to install a special version if you want to build ArchLinux package (from AUR for example). On a real ArchLinux installation, you have to build fakeroot-tcp package :

AUR
fakeroot-tcp

git clone https://aur.archlinux.org/fakeroot-tcp.git
cd fakeroot-tcp
makepkg -s

And pick up the generated package (fakeroot-tcp-1.22-2-x86_64.pkg.tar.xz), then in your ArchLinux's instance, you have to install this package :

pacman -U /mnt/X/where/is/fakeroot-tcp-1.22-2-x86_64.pkg.tar.xz

Change default user

When you have created a user, you can modify your ArchLinux's instance to start on this user instead root :

lxrunoffline config-uid -n ArchLinux -v {uid}

Note : For me, this modification is not awareness immediately and I have to close my Windows session.

Creation of shortcut

I can read this page of LxRunOffline's wiki about shortcut creation. David Wood provides an icon for having a good-looking shortcut.

page
icon

TODO

The next step, for me, will be to see if we can remove some base packages and especially the linux and mkinitcpio packages. We do not need a Linux kernel in WSL and mkinitcpio generate errors on installation/update packages.