Creating Windows Installation Media on Linux Ubuntu

Downloading and Creating a Windows 11 UEFI Bootable USB, Windows 10 UEFI or Legacy USB or Windows 8.1 UEFI or Legacy USB

Video

Linux Kernel 5.15.1

Linux Kernel 15.5.1 contains a new NTFS Driver alleviating previous issues where large files such as the install.wim file from Windows installation media got corrupted. To update to the latest kernel and create a UEFI Bootable USB the more proper way follow my instructions in:

This updated guide will also work for a Windows 8.1 and Windows 10 UEFI Bootable USB. It does not cover a Legacy Boot.

The Windows 10 Media Creation Tool is an application it cannot run on Linux… When the Windows 10 software download page is accessed on a browser in Linux direct downloads will instead be listed. Direct downloads are also listed by default for Windows 11 Insider Preview ISOs and for the Windows 8.1 ISOs.

Windows 10 Mainstream Channel ISO

Windows 10 was marketed to be compatible with computers that came with Windows 7 or Windows 8.1 however currently supported Windows 10 Builds are only optimised for computers with Solid State Drives (SSDs). If it is easy to access the internals of your system to replace the drive ensure your system has a SSD before reinstalling Windows.

On a system with a mechanical Hard Drive (HDD) you will experience continuous 100 % Disk Usage on Windows 10 Builds past Version 1709 which is no longer supported. You will likely get better performance on Linux Zorin OS 16 (a Linux distro with a Windows like user interface) or an older version of Windows i.e. Windows 8.1 or Windows 7 (End of Life).

Windows 8.1 ISO

Windows 8.1 has reached end of mainstream support but still has extended support.

Product Key Warning: The Windows 8.x Setup is designed to automatically input a Windows 8 or Windows 8.1 OEM Embedded Product Key. However these ISOs are not multi-edition and it is easy to install the wrong Windows edition i.e. Windows 8.1 (Home) opposed to Windows 8.1 (Home) Single Language. The wrong Edition will not inform you have the Product Key of another Edition. Also there are no "with Bing" edition ISOs and Windows 8 is not compatible with Windows 7 product Keys. This is discussed in much more detail in my Windows 8.1 Installation Guide.

Windows 7 ISO

Windows 7 has reached end of extended support and the only ISO available is the Dell Windows 7 Skylake ISO which requires the Dell OS Recovery Tool, a Windows application that cannot be ran in Linux.

The user interface of Microsoft's website for the Windows 8.1, Windows 10 or Windows 11 Insider Preview direct downloads is very similar.

You will prompted to select your "Edition". This actually displays the version as the ISO is a multi-edition ISO which covers all OEM and Retail Licenses:

Once you have selected Windows 10 select Confirm:

Next you will need to select the Language:

Note:

  • English International = English (UK)
  • English = English (US)

Once you have made your selection, select Confirm:

You will be presented a 64 Bit and a 32 Bit Download Link (64 Bit only for Windows 11). When you highlight these download links you will see the direct download links to Microsoft's servers and a time limited download token:

On the download page, there will be an option to verify your Download. These are not available for the Windows Insider Preview ISOs. Clicking this will display the SHA256 checksum for each ISO:

Checking Installation ISO Checksums

Open the Downloads folder.

Right click the ISO and select rename. Select the name plus the .iso extension:

Select Copy:

Once you have copied the file name including the extension, press [Esc] to cancel the rename. Now right click an empty space in the Downloads folder and select "Open in Terminal":

Type in the command:

sha256sum

Followed by a space and then paste the ISO name.

Then press [↵]:

The checksum will display:

You can right click the checksum and select copy:

Then in your browser select [Ctrl] + [ f ] and paste the ISO Checksums. It should find a match. If it does not your ISO is corrupt and you will need to redownload it:

Unfortunately the Windows 10 Download page has no instructions in creating installation media.

Creating a Windows 8.1, Windows 10 or Windows 11 UEFI Bootable USB

All systems manufactured in 2012 or later have a UEFI BIOS with Secure Boot. Windows 8.1 and 10 installation media should be setup to accommodate these technologies for optimal performance. These technologies and other requirements are mandatory for Windows 11.

Only 64 Bit Operating Systems are supported with a UEFI Boot.

A GPT partition scheme allows more than 4 partitions on a SSD/HDD which means there are multiple recovery partitions created during the Windows install making the Windows 10 Boot more robust. A MBR partition scheme on the other hand only had one boot partition which could get easily corrupted rendering the Windows 10 OS Unbootable.

Secure Boot prevents malicious code from Booting up before Windows 10, allowing only signed code to Boot. This allows windows 10 and its inbuilt security to Boot before ransomware. Older Windows versions such as Windows XP and Windows 7 were commonly crippled by ransomware as they did not use Secure Boot.

Checking your Install.wim File Size

A Windows 8.1/10/11 UEFI Bootable USB needs to use the GPT Partition Scheme with a FAT32 Partition in order to Pass Secure Boot. The FAT32 file system unfortunately has an upper limit of 4.0 GB and there is usually an install.wim file on the direct download links ISO which exceeds 4.0 GB (this depends on the Windows 10 Version and Language). As a result most Linux Bootable USB utilities will either truncate the install.wim giving incomplete installation media or format the partition as NTFS meaning the Bootable USB won't pass Secure Boot.

Right click the ISO file:

Select Open with Disk Image Mounter:

You should see the ISO shown to the left hand side. Select it:

Select the Sources folder:

Scroll down and look for the install.wim file. Right click it:

And select Properties:

If the file size exceeds 4.0 GB (4,294,967,296 Bytes) then it exceeds the upper limit for the FAT32 file format. There are theoretically three ways to proceed:

  • Create a USB with a single NTFS Partition and temporary Disable Secure Boot to install Windows.
  • Create a USB with multiple partitions; a FAT32 Boot Partition and a NTFS Install Partition.
  • Create a USB with a single FAT32 Partition and split the install.wim file to install.swm files that are less than 4.0 GB chunks.

In practice, Linux doesn't work very well with the Windows NTFS format and large files and truncates the install.wim when copying it to the USB even though this file format supports larger file sizes. Therefore the only working procedure I found was to split the install.wim into 2 install.swm files and use a single FAT32 partition.

We will copy the install.wim to the downloads folder and split it.

If it does not exceed this limit you shouldn't copy the install.wim over to the Downloads folder or attempt to split it.

Right click the install.wim file:

And select Copy:

Then go to your Downloads folder, right click an empty space and select Paste:

This is a large file and may take several minutes to copy. A progress bar will display on the file icon in the side panel as well as a small progress piechart indicating the progress of the copy.

Software Install

We need two pieces of software:

  • wimtools: wimtools allows use of some equivalent commands to dism gives in Windows when it comes to wim files. In our case we want to split the wim file into swm files.
  • GParted: GParted can be thought of as an equivalent to Disk Management in Windows.

We will install these programs using the terminal. You can use the shortcut key [Ctrl] + [Alt] + [ T ] to open the terminal in Linux:

We will type in the commands:

sudo apt-get update

Let's break this down:

  • sudo is an abbreviation for super user do and can be thought of running as an administrator in Windows.
  • apt is an abbreviation for advanced package tool.
  • apt-get means we will look at the official repositories only.
  • update means we will update the official repositories.

Because the command began with sudo we will be prompted to input our password in order to proceed (this is the Linux equivalent of a User Account Control Prompt):

Once we have input our password it will check to make sure the advanced package tool is update to look for the official repositories.

We will then use the commands to install wimtools and gparted respectively:

sudo apt-get install wimtools
sudo apt-get install gparted

Splitting the Install.wim File into < 4.0 GB Install.swm Files

The wimtools library is command line based. To use a command type in:

wimlib-imagex

This will print a list of available commands. The command of interest is:

We will type in:

wimlib-imagex split Downloads/install.wim Downloads/install.swm 4000

Once the split is done, a new command line prompt will display:

You will have the split install.swm files:

Formatting a USB Flash Drive using GParted

Insert your 16 GB USB Flash Drive and launch GParted:

GParted needs to run as a super user. You will get an authentication required popup (equivalent to a User Account Control Prompt). Type in your password and select Authenticate:

To the top right select the drop down arrow:

Select your 16 GB USB Flash Drive:

Next we need to right click any partitions.

to make sure they are not mounted in the file explorer. If they are select Unmount (if Unmount is already grayed out they are not mounted). Repeat for all partitions on the USB Flash Drive.

Select Device and then Create New Partition Table:

Select a GPT Partition Table and select Apply:

Right click the Unallocated space:

Select New:

Change the File System to FAT32 and add an optional Label. I advise using something like 20H2 to reflect the version of Windows 10 in the installation media. Then select Add:

Select Apply:

Select Apply:

Then select Close. You may now also close GParted.

Remove the USB Flash Drive from the USB port and reinsert it. Ubuntu should automatically mount the blank FAT32 Partition on the GPT Partition Table of the USB Flash Drive.

Copying Windows Setup Files

In this stage we are essentially manually copying all the setup files from the ISO to the Bootable USB. If the install.wim exceeds 4.0 GB, we will copy everything across except this file and in its place use the 2 install.swm files.

Mount the Windows 10 ISO and press [Ctrl] + [ a ] to select all files. Then hold down the [Ctrl] key and highlight the sources folder. Then drag all the other folders across to copy them:

You will be informed when the copy operation is complete:

Now right click an empty space on the USB Flash Drive and select New Folder:

Name the folder sources

Open up the Sources folder on the USB and the ISO:

Press [Ctrl] + [ a ] to select all.

Then scroll down until you find the install.wim file. Hold [Ctrl] and left click it. You will now have selected all files except the install.wim:

Copy all the files across to the Sources folder on the USB:

You will be notified when they are copied across:

Now go to the Downloads folder and select the install.swm and install2.swm files and copy them to the USB:

These are large files and it may take a while to copy them across. You will be informed when they are copied.

The Windows 10 UEFI Bootable USB is now complete. This Bootable USB will pass a UEFI BIOS with Secure Boot.

Enabling a UEFI Boot with Secure Boot

If you have installed an old Linux distribution that doesn't support a UEFI Boot with Secure Boot you should look at enabling these technologies. You can do so by accessing the Boot Menu. In a Dell PC Power Down your Computer. Then Power it up and press [F12].

Look for the Line consisting of Boot Mode. If there is no mention of Boot Mode or UEFI/Legacy on your Boot Menu, it is likely you have a Legacy Only BIOS and should Create a Legacy Only USB (see below). The Windows 10 UEFI Bootable USB will be unable to Boot on an older system:

The Boot Mode should be set to UEFI and Secure Boot should be On.

If it is you can press [↓] to select your Bootable USB and then press [↵] to Boot from it.

If the technologies are not enabled, press the [↓] until you get to Change Boot Mode Settings and then press [↵]:

Select Change Boot Mode Settings:

Set UEFI Boot Mode, Secure Boot On:

Select Yes:

Select Apply:

Creating a Windows 10 Legacy Bootable USB

PCs manufactured before 2010 have a Legacy Only BIOS and do not support a UEFI Boot. To install Windows 10 on these PCs you need to create a Legacy Bootable USB. A Legacy USB must be used for a Windows 10 32 Bit Install.


Software Install

We need two pieces of software:

  • GParted: GParted can be thought of as an equivalent to Disk Management in Windows.
  • WoeUSB: A discontinued utility which can create Windows Legacy Bootable USB Flash Drives.

We will install these programs using the terminal. You can use the shortcut key [Ctrl] + [Alt] + [ T ] to open the terminal in Linux:

This image has an empty alt attribute; its file name is vlcsnap-2020-12-19-23h05m22s818.png

We will type in the commands:Generic HighlightingEnlighterJS Syntax Highlighter

Let's break this down:

  • sudo is an abbreviation for super user do and can be thought of running as an administrator in Windows.
  • apt is an abbreviation for advanced package tool.
  • apt-get means we will look at the official repositories only.
  • update means we will update the official repositories.
This image has an empty alt attribute; its file name is image-10.png

Because the command began with sudo we will be prompted to input our password in order to proceed (this is the Linux equivalent of a User Account Control Prompt):

This image has an empty alt attribute; its file name is vlcsnap-2020-12-19-23h06m50s543.png

Once we have input our password it will check to make sure the advanced package tool is update to look for the official repositories.

This image has an empty alt attribute; its file name is vlcsnap-2020-12-19-23h12m43s977.png

We will then use the commands to install woeusb and gparted respectively:

sudo add-apt-repository ppa:tomtomtom/woeusb
sudo apt install woeusb
sudo apt-get install gparted

WoeUSB is not included in the official APT software repository and we need to add an additional third party repository. To install we use apt install which looks in the official and added third party repositories opposed to apt-get install which only looks in the official repository.

Unmounting any Partitions using GParted

Insert your 16 GB USB Flash Drive and launch GParted:

GParted needs to run as a super user. You will get an authentication required popup (equivalent to a User Account Control Prompt). Type in your password and select Authenticate:

To the top right select the drop down arrow:

Select your 16 GB USB Flash Drive:

Next we need to right click any partitions.

to make sure they are not mounted in the file explorer. If they are select Unmount (if Unmount is already grayed out they are not mounted). Repeat for all partitions on the USB Flash Drive.

Once all partitions are unmounted you can close GParted.

Using WoeUSB to Create a Bootable USB Flash Drive

Launch WoeUSB:

To the top, select the Load ISO button:

Select your Windows 10 ISO and select Open:

Since the install.wim exceeds 4.0 GB, the NTFS file system must be used (this must be used for a Legacy USB irregardless). Select NTFS:

Now select your USB Flash Drive:

Then select "Install". N.B. this refers to making a Bootable USB and not installing Windows 10:

Since this utility needs to be ran as a super user to create a new MBR Partition Table and FAT32 format on your USB flash drive you will get a Authentication required pop up. Input your password and select Authenticate:

WoeUSB will create the Legacy Bootable USB. When it is finished it will state "Installation suceeded!" i.e. the Bootable USB is created.

You now have a Windows 10 Legacy Bootable USB.

Creating a Windows 10 UEFI Bootable USB with Driver Slipstream

It's been reported on the Dell forums that some users are having difficulties installing Windows 10 on an XPS 13 7390 and the Windows installation media needs to be updated to incorporate the Windows 10 Driver Pack in order to install. Unfortunately the wimlib library is unable to perform the driver slipstream and a Windows OS must be used. If you have no additional Windows computer available you can use the Windows 10 ISO you downloaded to create a temporary unlicensed virtual machine using VMware or VirtualBox.

Follow the instructions in Creating a Windows 10 UEFI Bootable USB

  1. Checking your Install.wim File Size
  2. Software Install
  3. Formatting a USB Flash Drive using GParted
  4. Copying Windows Setup Files
  5. Enabling a UEFI Boot with Secure Boot

For section 3, create your VM. Instructions for creating a VM in VMware are below:

Go to the sources folder of the mounted ISO (in Windows or in Ubuntu) and Copy the install.wim.

Paste it directly to C:\ (in your Windows VM)

Select Continue to allow permissions:

Right click the install.wim and select Properties:

Ensure Read Only is not checked then select Apply:

Then select Continue:

We need to use PowerShell to split the install.wim file into multiple install.swm files that are less than 4 GB.

For select business models (OptiPlex, Latitude, Precision and XPS) you also have the option to download the Dell Driver Cab and we can slipstream this into the install.wim using a handful of lines of code. You will also need to download and install 7-zip in order to extract the drivers folder.

This guide focuses more on the Dell systems but it will also work with the Lenovo Business model if you rename the extracted folder Drivers and move it to the C:\ Drive the procedure will be identical.

On the Dell website select your model and then select Windows 10 64 Bit under Operating System and then Systems Management under category.

Select the Driver Pack and select Download:

You will need to extract these drivers. I recommend using 7zip for this.

Right click the CAB file and select 7-Zip and then Extract to " ":

You may get the Warning "There are some data after the end of the payload data". You can ignore this and select Close:

Open the extracted folder:

Select the model:

Select the Win10 folder:

You should now have an x64 folder.

Right click this folder and select rename, rename the folder

Drivers

Copy this folder directly to:C:\

You should now have the following:

Now right click the start button and select Windows PowerShell (Admin):

Accept the User Account Control Prompt:

Copy the following command:Dism /Get-WimInfo /WimFile:C:\install.wim

Right click the file and select run as administrator. Select your index. I will select index 6 for Windows 10 Pro.

Copy and paste in the following command to create a temporary folder:

mkdir C:\WinTemp

Copy the following command (amending the index to desired) to extract the index of the install.wim to the temporary folder:

Dism /Mount-WIM /WimFile:C:\install.wim /index:6 /MountDir:C:\WinTemp

Type in the following command to add the drivers to this folder:

Dism /Image:C:\WinTemp /Add-Driver /Driver:C:\Drivers /Recurse

Type in the following command to commit the changes:

Dism /Unmount-WIM /MountDir:C:\WinTemp /Commit

Type in the following to remove the temporary folder:

rmdir C:\WinTemp

Type in the following to get the updated information about the install.wim

Dism /Get-WimInfo /WimFile:C:\install.wim

Type in the following to split the install.wim into multiple install.swm files:

Dism /Split-Image /ImageFile:C:\install.wim /SWMFile:C:\install.swm /FileSize:4000

You may now close down the Powershell Prompt:

Now copy install.swm and install2.swm:

From your VM to your Ubuntu downloads folder. Follow the remaining instructions in Creating a Windows 10 UEFI Bootable USB:

  1. Checking your Install.wim File Size
  2. Software Install
  3. Formatting a USB Flash Drive using GParted
  4. Copying Windows Setup Files
  5. Enabling a UEFI Boot with Secure Boot

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.