Ubuntu on Windows – almost viable

I am a UNIX/Linux guy to boot. Last time I developed something for Windows was in the last century (literally, circa 1999). Yet, as you would imagine, I do use Windows daily – almost excusively for MS Office. So far a routine with a new machine would be pretty much the same:

  • Install MS Office, configure Outlook
  • Install Firefox or Chrome (or both)
  • Install VMWare or VirtualBox (or both)
  • Install XWin
  • Install PuTTY and WinSCP
  • Install Linux (Ubuntu)
  • Install illumos (OpenIndiana) – optional
  • Start hacking

Have you noticed VMWare/VirtualBox part? Well, using it requires quite a strong machine, with several CPU cores and at least 6-8GB of RAM. This might be a non-issue on a desktop or a workstation, yet for a laptop it inevitably means less battery life and/or more weight – not something a frequent traveler would appreciate.

Two weeks ago I decided to try something new. I got tempted by Microsoft promise of ‘bash on Windows 10’ and followed instructions at www.howotogeek.com.

This actually worked. To the point that I was able to work on the scripts for my next blog using just this strange flavor of Ubuntu. Here’s what I did to make myself productive:

  1. Updated stale repos information in apt:
    sudo apt update
  2. Installed my standard toolset:
    sudo apt install cscope vim cscope git make gcc python-pip
    sudo apt install clang libtool libasan zip xorg jq nodejs
  3. Installed AWS CLI:
    pip install awscli
  4. Generated SSH key pair:
    ssh-keygen
  5. Added public key to my bitbucket.org account
  6. Cloned one of my repo’s:
    git clone ...

Everything just worked. Encouraged, I proceeded to augment environment for my needs:

cat >> ~/.bashrc
export EDITOR=vim

# if installed, use aws_completer
if [ -x /usr/local/bin/aws_completer ]; then
 complete -C '/usr/local/bin/aws_completer' aws
fi

export AWS_ACCOUNT_ID=XXXXXXXXXXX
export AWS_DEFAULT_REGION=us-east-1
^D
cat >> ~/.bash_aliases
alias gll='git log --pretty=format:"%x1b[33m%h%Cred%d%Creset %s %Cgreen(%an)%Creset" -n 200'
^D

This was it – I got my working environment. I actually made it a point to use just it fot my next blog preparation – and I largely succeeded.

Now, I must warn my readers – Windows cmd.exe terminal is not easy to use. Its mouse integration is so MS-DOS, you wouldn’t believe it. I wish I could use PuTTY or xterm, alas it is impossible. Although ‘Windows bash’ looks and feels like a real Ubuntu, it is not – that is, it cannot run any servers, be this sshd, Xvnc or anything else. According to some blogs, this is not a bug, but rather a feature. It has to do with the way Microsoft chose to implement this. Namely, they wrote their own version of libc that simply emulates Linux system calls using Windows API’s. No container or virtualization of any kind.

While I was able to launch gvim using Cygwin/X server, xterm still would not start because of an issue with /dev/pty and/or /dev/pts – most likely, a fixable bug.
Also, neither screen, nor tmux were able to start. And last, but not least, vim ! feature would not work either, i.e. you would not be able to build your code from vim, nor run any other command from it for that matter. This actually may be fixable – provided, there is enough interest from prospective users. In order to fix xterm, screen and tmux, some work on tty/pts subsystem is needed, and inablity to run bash from vim looks like a bug in fork() or exec() implementation.

While I can live without vnc, it would be really nice to be able to use xterm and/or PuTTY – if not via SSH, then maybe using a Windows named pipe or simulated serial port. And of course, not being able to use screen, tmux or vim ! feature is a major blow.

Bottom line: nice toy, but no cigar. Let’s see if any of the issues above will be fixed before GA. If they will, we may see beginning of the end of virtualization on Windows desktop, at least for a bulk of Linux user space developers – those, who do not need an extrnally visible server for their work.

Leave a comment