### How to install WinUSB in Ubuntu 15.10

Step by step guide about installing WinUSB bootable Windows flashdrive creator on Ubuntu 15.10 Wily Werewolf

WinUSB is a piece of software that allows you to make a bootable flashdrive for installing Windows by using a Linux computer. Currently this is the only graphical and easy to use method to do this on Linux. There are of course manual guides of doing this but it isn't that easy for inexperienced users. Unfortunately, neither this guide is for beginners. This guide will show you how you can install WinUSB in Ubuntu 15.10 Wily Werewolf.

Update: These instructions are not for Ubuntu 16.04 LTS and newer. The only way to get it working in Xenial and above is to compile after patching the source code to work with wxWidgets 3.0. It is described in detail here.

There are currently some issues with the available builds of WinUSB:
• wrong dependencies: some older versions depend on grub package while Ubuntu uses grub-pc or grub-efi. Installing WinUSB as usual will force grub-pc or grub-efi removal thus rendering your computer non bootable.
• deprecated grub-install method. WinUSB uses the --root-directory argument to specify GRUB install location while it is recommended to use --boot-directory.
• Unspecified bootloader type. There is no --target argument for grub-install so you don't know whether a MBR bootloader or an EFI one will be installed.
• The previous issue raises a limitation. If GRUB decides to use the EFI bootloader, it will install it in a NTFS partition (that's how WinUSB formats the flashdrive) which makes it useless.
So, WinUSB can only be used to make MBR bootable flashdrives. Next is described the installation and tweaking procedure to minimize risk of errors.

You can get a binary build from Launchpad. Go to the second page and select the version suitable for your system architecture. First of all, do NOT try to install anything older than the 1.0.11+trusty1 version. Those have the GRUB dependency issue described above. You can see also the changelog which states:
* Add dependency to grub-pc OR grub-efi
If you don't see the above line choose a different build. So, download the deb file and install it with Software Center, GDebi or from terminal in the download directory using:

sudo dpkg -i winusb*.deb
sudo apt-get install -f
You should now be able to run WinUSB from Dash. And I suggest you do it from terminal (winusbgui), because if you get the following error, there's only one thing left to do: compile from source.
Fatal Error: Mismatch between the program and library build versions detected.
The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1009,wx containers,compatible with 2.6),
and your program used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible with 2.6).
Aborted (core dumped)

If you got this error, grab a source archive and run the following commands from terminal in the directory where you downloaded the source:
tar -xzf winusb*.tar.gz
cd winusb-1.0.11
sudo apt-get install build-essential gcc libwxgtk2.8-dev libwxbase2.8-dev
./configure
make
sudo rm /usr/bin/winusbgui
sudo cp ./src/winusbgui /usr/bin/winusbgui

That's it. You should now have a working WinUSB graphical interface.

 WinUSB running on Ubuntu 15.10 Wily Werewolf
Let's now fix the issues mentioned at the beginning of this post. If you have an UEFI computer you will need a package for the MBR bootloader that you can install with:
sudo apt-get install grub-pc-bin
Next you must edit the winusb script that can be found at /usr/bin. Again from terminal:
gksu gedit /usr/bin/winusb
Use Ctrl+F to find a line starting with grub-install (it is closer to the end of the script) and completely replace that line with:
grub-install --target=i386-pc --boot-directory="$partitionMountPath/boot" "$device"
This forces GRUB to install in MBR mode. That is all. You can now make bootable flashdrives of Windows (from Vista to 10) that boot in MBR BIOS mode. You probably wouldn't want this if you own an UEFI computer, in that situation you can make it manually (the GPT for UEFI section) by formatting USB and copying files.