Windows 10 – Bash on Ubuntu on Windows

The latest versions of the Windows 10 Insider Preview have a nice new feature with a very odd name, I give you “Bash on Ubuntu on Windows” – Yes that really IS it’s name!



Although Microsoft showed this off with a bit of fanfair at the Build Conference, they have not really shown how to get it all up and running, so I’ll pop the steps down here.

Some things to note before we start,

  1. This is not a Hyper-V of Ubuntu! This is Bash Shell running inside a container inside Windows (Think of it like Wine on Linux, but the other way round)
  2. This will only work on Insider builds of Windows 10 after 14316
  3. x64 only
  4. Like I say this is NOT Linux, and the Linux Kernel is NOT running, as such not everything will work
  5. Canonical worked with Microsoft on this. MS did the Kernel mapper (maps Linux Kernel calls over to equivalent Windows Kernel calls) and Canonical created the run space (it’s 14.04LT at the moment, although 16.04LT is coming soon)
  6. Yes, it’s the NATIVE executable files running on Windows, not some re-compiled version, so even if you add other package repo you can install them with APT
  7. The Windows part of it is NOT open source, although there is a GitHub for the project

Right with all that out of the way, let’s get to the install.

  • Fire up features and settings, pop down towards the bottom and tick the Windows Subsystem for Linux optionFeatureAdd
    This will install all the stuff, and reboot the PC
  • Once your back up and running, click Start and type Bash and the bash installer will pop up, say Y to the prompt and it will download the Canonical package from the Windows Store
  • Let that finish, it will unpack and close the window, now click start then type Bash and you will have the Canonical icon on the results, launch that. Hey presto, Bash Shell, running natively on Windows!
  • Paste the below script into the shell, this will fix some known issues with APT-GET
    cat > /usr/sbin/policy-rc.d <<EOF
    exit 101
    chmod +x /usr/sbin/policy-rc.d
    dpkg-divert –local –rename –add /sbin/initctl
    ln -s /bin/true /sbin/initctl
  • type sudo apt-get update then sudo apt-get upgrade (make sure you create a /etc/apt/apt.conf file if you need proxy support, same as any other Debian based Linux)
  • Install anything you fancy having a play with.

Some useful things

  • You can remove / re-install the Canonical part of the system without unchecking the feature etc. Just use LxRun.exe /uninstall and LxRun.exe /install to re-download the Canonical parts afresh.
  • X11 stuff is not working at the moment, so Shell only.
  • Some packages work out of the box, some require a little massaging as at the moment junctions are a bit squiffy (have a look on the GitHub bugs list for workarounds)