Installing WinUSB on Ubuntu 14.04 [duplicate]

Solution 1:

WinUSB is old, obsolete, and outdated. It can cause problems on newer systems. You should be using WineUSB or other software in place of WinUSB.

This answer is, however, left here as-is for historical purposes.

Create a bootable Windows USB (Vista and above) from Ubuntu through WinUSB software.

Ubuntu 12.04 through 15.04

Run the below commands on terminal to install WinUSB from a PPA,

sudo add-apt-repository ppa:colingille/freshlight
sudo apt-get update
sudo apt-get install winusb

WinUSB screenshot

Warning for Ubuntu EFI:

installing WinUSB on EFI loaded Ubuntu will uninstall the grub-efi packages in order to install the grub-pc packages. It will make your system unbootable if you don't manually reinstall grub-efi package before rebooting.

To do the manual re-install do:

sudo update-grub
sudo grub-install /dev/sda
sudo update-grub
sudo reboot

Solution 2:

Any Ubuntu version

even other Linux distros as long as GParted and GRUB are installed.

Install GParted, GRUB, 7z, and NTFS on Ubuntu with:

sudo apt-get install gparted grub-pc-bin p7zip-full ntfs-3g

For BIOS: MBR partition scheme

  1. Using GParted, rewrite the USB drive's partition table as msdos, format it as NTFS, and then "Manage flags" and add the boot flag.

  2. In GParted, right click the USB partition and select Information. Copy the UUID somewhere as you will need it.

  3. Mount your Windows ISO or DVD and copy all its files to the USB drive.

  4. Go to the USB drive, and if the folder named boot has uppercase characters, make them all lowercase by renaming it.

  5. Install GRUB on the USB drive.

    In the below command, replace /dev/sdX with the device (e.g. /dev/sdb, not /dev/sdb1) and replace <USB_mount_folder> with the folder where you mounted the USB drive (which could be like /media/<username>/<UUID>).

    sudo grub-install --target=i386-pc --boot-directory="/<USB_mount_folder>/boot" /dev/sdX
    
  6. Create a GRUB config file in the USB drive folder boot/grub/ with the name grub.cfg.

    Write this into the file, replacing <UUID_from_step_2> with the UUID you copied down in step 2.

    echo "If you see this, you have successfully booted from USB :)"
    insmod ntfs
    insmod search_fs_uuid
    search --no-floppy --fs-uuid <UUID_from_step_2> --set root
    ntldr /bootmgr
    boot
    
  7. Unmount the USB drive.

  8. Now to use it, restart your PC, and boot from the USB drive.

For UEFI: GPT partition scheme *

* Older Windows versions / editions may not be properly supported or not supported at all. I suggest reading the Microsoft UEFI Firmware page.

  1. Using GParted, rewrite the partition table of the USB drive as GPT.
  2. Create a new primary partition and format it as FAT32.
  3. Mount your Windows ISO or DVD and copy all its files to the USB drive.
  4. Look on USB in the efi/boot/ folder. If there's a file bootx64.efi (bootia32.efi) then you're done. The USB is bootable. Skip to step 7.
  5. Otherwise, open sources/install.wim with the Archive Manager (you must have 7z installed) and browse to ./1/Windows/Boot/EFI/. From here extract bootmgfw.efi somewhere, rename it to bootx64.efi (or bootia32.efi for supported 32 bits OS [?]) and put it on USB in efi/boot/ folder.
  6. If you're making a Windows 7 USB, copy the boot folder from efi/microsoft/ to efi folder.
  7. Don't forget to unmount (safely remove) the USB drive.
  8. Select the proper EFI loader from your BIOS.

Source: My blog post about this can be found at Make a bootable Windows USB from Linux.

Note

When properly used with a compatible target operating system, both of these methods should get you a bootable USB drive. However this does not guarantee successful installation of Windows.

Solution 3:

Writing ISOs with WoeUSB (WinUSB fork)

Some answers are outdated, since WinUSB is not working anymore. But there is a working fork called WoeUSB.

Github: https://github.com/WoeUSB/WoeUSB

TLDR:

sudo woeusb --target-filesystem NTFS --device /path/to/your.iso /dev/sdX

Installation

It does not uninstall grub-efi anymore!

☞ Ubuntu / Debian

sudo add-apt-repository universe # contains the p7zip-full dependency
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt update
sudo apt install woeusb

☞ Arch  

pacaur -S woeusb

☞ Fedora

dnf install -y WoeUSB

☞ OpenSUSE

zypper install WoeUSB

Identifying the USB stick (the /dev/sdX path)

GUI approach

Search for a programm called disks, or if you use gnome you can launch it by executing gnome-disks.

Command line approach

There are several commands available to list storage devices. You might try one of these:

sudo lsblk --scsi --paths 
sudo lshw -class disk -short

Identify your usb device and see which path it has (like /dev/sdX).

Writing the ISO

After installation, write the windows ISO to your storage device with the following command. In the command below replace the X in /dev/sdX with your usb device path (see above how to find it).

sudo woeusb --target-filesystem NTFS --device /path/to/your.iso /dev/sdX

The --target-filesystem NTFS flag is required if the installation image is greater than 4GB, which is the case for the current Windows 10 official ISO file.

Solution 4:

WoeUSB is a tool for creating a bootable USB flash drive used for installing Windows. Native UEFI booting is supported for Windows 7 and later images. WoeUSB is an updated fork of the WinUSB project.

Some third-party installers feature Windows installation images (/sources/install.wim) greater than 4GB making FAT32 as target filesystem impossible. NTFS filesystem support has been added to WoeUSB 3.0.0 and later.

WoeUSB (GUI+CLI) installation

Ubuntu 18.04 and later

  1. Visit the WoeUSB GitHub page and look for a file with the form woeusb-x.x.x.bash (example: woeusb-5.2.2.bash).

  2. Download woeusb-x.x.x.bash (example: wget https://github.com/WoeUSB/WoeUSB/releases/download/v5.2.2/woeusb-5.2.2.bash but the latest version may be different from 5.2.2).

  3. Right-click the woeusb-x.x.x.bash file that you downloaded, select Properties, and under the Permissions tab put a check in the checkbox before where it says Allow executing file as program.

  4. Open the terminal and change locations with cd to the directory that contains woeusb-x.x.x.bash.

  5. Install wimtools.

    sudo apt install wimtools
    
  6. Insert a USB flash drive. If there are any files on the USB flash drive back them up to a different device. Open the disks application and make a note of the Device to be used later in step 7. The device should have the form /dev/sdX where X is a letter of the alphabet, and in step 7 you must replace the X with the correct letter of the alphabet that you found in Disks.

  7. Run the woeusb-x.x.x.bash script.

    sudo ./woeusb-x.x.x.bash --target-filesystem NTFS --device Windows10.iso /dev/sdX # for Windows 10

    or

    sudo ./woeusb-x.x.x.bash --target-filesystem NTFS --device Windows11.iso /dev/sdX # for Windows 11

    The command for other versions of Windows has a similar form to the above two commands.

The USB drive with Windows installer boots in either UEFI mode or BIOS mode.

  • UEFI mode (also boots with Secure Boot enabled)

  • BIOS mode (may be called CSM or Legacy mode)

Ubuntu 14.04-18.04

sudo add-apt-repository ppa:nilarimogard/webupd8 
sudo apt update  
sudo apt install woeusb

This will install the WoeUSB graphical interface and the WoeUSB command line tool. WoeUSB supports both UEFI and BIOS for FAT32/NTFS/ExFAT USB flash drives.

To install the WoeUSB command line tool snap package in all currently supported versions of Ubuntu open the terminal and type:

sudo snap install --edge woe-usb  
sudo snap connect woe-usb:removable-media

To launch the woe-usb snap package command line tool run the following command:

/snap/bin/woe-usb.woeusb

If you get a permission denied error click the Permissions button on the woe-usb screen in Ubuntu Software and toggle the permissions options from OFF to ON as shown in the below screenshot.

woe-usb Permissions

The WoeUSB GUI is easier to use than the WoeUSB command line tool. Click the radio button to the left of where it says From a disk image (iso), browse to the location of the Windows .iso file, under Target device select a USB flash drive, open Disks application and check that the Device name in Disks matches the Target device in WoeUSB (it should be something like /dev/sdX where X is a letter of the alphabet), and click the Install button to install to create a bootable Windows installation media on the USB flash drive.

enter image description here

Windows USB drive from Ubuntu failing repeatedly
WoeUSB Issues