Install on WSL

From ArchWiki
Jump to: navigation, search

Gnome-colors-add-files-to-archive.pngThis article is being considered for archiving.Gnome-colors-add-files-to-archive.png

Reason: We don't have the human resources to handle the support requests encouraged by this article. (Discuss in Talk:Install on WSL#Category or archive)

Windows 10 has a subsystem that emulates the Linux kernel interface to allow ordinary Linux applications to run. It is somewhat like the opposite of Wine, but at a lower level. By default it comes with Ubuntu user space, but that can be replaced with Arch. To get it working properly you will require access to an existing Arch installation to build some packages. These instructions are based on this guide.

Warning: A WSL install is NOT an Arch Linux installation, so is not supported in the Arch Community support channels.


You must be running the Windows 10 Creator's Update. If you have not used the Windows Subsystem for Linux yet, follow the instructions here to enable it. Basically you enable:

  • Developer mode in Settings > Update and Security > For developers and
  • Windows Subsystem for Linux in Turn Windows features on or off.

If you already have it installed use:

> lxrun /uninstall /full /y

to delete the existing installation entirely (you might want to save some data first).


Note: You can also install Ubuntu from the Windows Store, although you need to be a Windows Insider (or running the upcoming Fall Creators Update). More information.

Open a command prompt and install the official Ubuntu version:

> lxrun /install /y

Start bash:

> bash ~

Download an Arch bootstrap .tar.gz from Arch Linux Downloads, and extract it:

$ tar -zxvf /mnt/c/Users/username/Downloads/archlinux-bootstrap-2017.06.01-x86_64.tar.gz

Uncomment a server in ~/root.x86_64/etc/pacman.d/mirrorlist.

Make WSL autogenerate /etc/resolv.conf:

$ echo "# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line." > ~/root.x86_64/etc/resolv.conf

Exit all bash prompts you have open.

In the Windows explorer, navigate to C:\Users\username\AppData\Local\lxss\rootfs and delete bin, etc, lib, lib64, sbin, usr and var.

Now move (do not copy) the same folders from C:\Users\username\AppData\Local\lxss\root\root.x86_64 to C:\Users\username\AppData\Local\lxss\rootfs

Using a Linux computer build fakeroot-tcpAUR and glibc-wslAUR. Note that --nocheck can be used with makepkg to skip a very time-consuming test suite when building glibc-wslAUR.

Then copy the packages to your Windows PC. glibc-wsl has a workaround for this bug, and fakeroot-tcp is necessary until System V IPC is fully implemented (see here). This step will be unnecessary when those bugs are fixed.

Open bash again, and setup Arch:

# pacman-key --init
# pacman-key --populate archlinux
# pacman -U /mnt/c/Users/username/Downloads/glibc-wsl-2.25-2-x86_64.pkg.tar.xz
# pacman -U /mnt/c/Users/username/Downloads/fakeroot-tcp-1.21-2-x86_64.pkg.tar.xz
# pacman -Syyu base base-devel

Set up a user (does not have to be the same as your Windows username):

# useradd -m -G wheel -s /bin/bash username
# passwd root
# passwd username

Set the user as the default by running the following in a Windows command prompt:

> lxrun /setdefaultuser username