Running Fedora on Windows 10 using WSL

Getting a Fedora root filesystem

Option 1: Trust me and download the rootfs tarball

Includes dnf hacks and exclude rules for hacked packages in dnf.conf (hopefully not needed for too long)
https://drive.google.com/file/d/0B2x_P2FaPipUUjRuSkF4c01WOG8/view

Option 2: Build the rootfs tar yourself from Koji

Download the docker image for Fedora 23
http://koji.fedoraproject.org/koji/tasks?owner=ausil&state=closed&view=flat&method=createImage&order=-id

In this example the latest version was 20160408.

Become root, to maintain permissions on the untarred files, and do the following

tar xfp Fedora-Docker-Base-23-20160408.x86_64.tar.gz
cd dad7397f64776b5ac85b0bdbf5d511bc0a434b363309570bb2cf3082f382aaec
mkdir rootfs
cd rootfs
tar xfp ../layer.tar
tar chf rootfs.tar etc/ usr/ var/ bin lib lib64 sbin

Installing bash (Ubuntu) in Windows 10

  • Start -> Search for “developer settings” -> Select “Developer Mode”
  • Start -> Search for “windows features” -> Check “Windows Subsystem for Linux (Beta)”
  • Reboot
  • Open a command prompt (Start -> Search for “cmd”)
  • Run “bash”
  • Select “y” to install bash

Bootstrapping Fedora

  • Copy the rootfs.tar(.gz) to the Windows desktop for your user (method unspecified)
  • Within the bash shell (at /mnt/c/User/Your User)

    cd Desktop
    cp rootfs.tar* ~
    cd
    tar xfp rootfs.tar*
    exit

Now the select directories of the fedora root filesystem are in the root’s home directory

The next step is to overwrite the select directories in the rootfs.

  • Open a file manager in Windows (Start -> “file”)
  • Go to C:\Users\Your User\AppData\Local\lxss\rootfs
  • Delete etc usr var bin lib lib64 sbin
  • Go to C:\Users\Your User\AppData\Local\lxss\root
  • Cut etc usr var bin lib lib64 sbin
  • Go back to C:\Users\Your User\AppData\Local\lxss\rootfs
  • Paste

Now we have effectively bootstrapped a Fedora userspace

Open a command prompt, type bash and now you are in a Fedora enviroment (run dnf if you don’t believe me)

Patching (if you chose option 2)

The lxscore.sys syscall translation driver supports many linux syscalls, but not all.  There are also some programs that access things in /sys, /proc/,  and /dev that aren’t available in this enviroment.  We have to hack some things in python3 and dnf to work around this.

dnf metadata fetch fails with Error 22: Invalid argument

edit /usr/lib64/python3.4/shutil.py around line 134 (search for “listxattr”)
replace if hasattr(os, 'listxattr'): with if False:

Transaction check failed, not enough disk space

edit /usr/lib/python3.4/site-packages/dnf/rpm/transaction.py around line 108 (search for “DISKSPACE”)
remove if conf.get('diskspacecheck') == 0: and reduce indent for self.ts.setProbFilter(rpm.RPMPROB_FILTER_DISKSPACE)

Prevent hacks from being removed on dnf update

edit /etc/dnf/dnf.conf
add exclude=python3-libs python3-dnf to [main] section