Bash on Ubuntu on Windows 10

This was announced at the end of last month. I’ve now had a chance to kick the tires on the Beta for Bash on Ubuntu for Windows in the latest Preview build of Windows 10. It’s a huge step forward for Microsoft. But beware early adopters: there be dragons there!

First, to get the Windows Subsystem for Linux (hereinafter, “WSL”), you need to be on the latest Windows Insider program Preview build for Windows 10. This is a brand new feature  for Windows that is not now, and probably never will be, available for previous versions of Windows.

What you get after enabling WSL is a mostly functional Ubuntu Linux userland in a terminal session. From my testing there are still some pieces missing, like its inability to handle raw network sockets (there are a few perl programmers out there who will be sad to hear that). That means that many networking tools like ping and dig won’t work. In addition, you may need to create your own /etc/resolv.conf and list your local nameserver in it. I and others found that WSL doesn’t always set this up automatically. Fortunately the initial environment includes vim, so making that fix is easy enough once you’ve dug through the issues forum far enough to find it.

By and large the apt package system works well, as do most of the software that can be installed with it. It’s actually an educational experience to watch some of my favorites, like nmap, fail with a “route_dst_netlink: cannot create AF_NETLINK socket: invalid argument”. Buy hey, “cat /proc/cpuinfo” works!

Although I enjoy the novelty of this new feature and am happy to toy with it on my Windows 10 test instance, at this point packages like Git for Windows are a lot more useful to me (the latest builds of MSYS2, on which Git for Windows is based, not so much — but that’s a story for another day). Those alternatives still require hunting down and installing native Windows binaries for important things like dig (available in BIND for Win64) and nmap, but that’s the legacy 20 years of Microsoft defending its walled garden at all costs.

Of course if you’ve got the CPU (an i3 or above) and RAM (at least 8GB ) to support it, your best bet if you have to run Windows would be to install Oracle’s free VirtualBox and run a Linux virtual machine inside it (allocating 1 CPU core and 4GB RAM to it). VirtualBox lets you share resources like disk folders and clipboards pretty seamlessly between machines and I’ve found that arrangement is probably best for heavy system administration.

 

This entry was posted in System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).