Testing with QEMU and Virtual Machines

Using QEMU or Virtual Box for testing

Please Note: When a USB drive is mapped as a drive in a ‘normal’ VM (e.g. QEMU, Virtual Box or VMWare), it will be treated as a ‘hard disk’ and not a Removable USB drive. Also, unless a special utility such as VMUB is used, any sector writes within a USB drive volume by E2B may not work because  the USB drive volumes are not accessible to the VM as it/they are locked by Windows. Also, USB disk writes may be cached by the VM (snapshotted) so that any writes under the VM may not actually be permanent and all file changes to the USB drive may disappear when the VM boots to an OS or after it is shut down. For this reason, for testing purposes, use the 32-bit QEMU emulator included with RMPrepUSB (just press F11 – tip: try to use 900MB or less for memory or QEMU may not run), or use VBox v5+DavidB’s VMUB utility (highly recommended) – these utilities dismount the USB drive before it runs QEMU or VBox and thus allows the VM to fully access the whole USB drive (a few payloads do not even run correctly unless this is done!). 
ALWAYS RE-TEST USING A REAL SYSTEM TO ENSURE IT WILL WORK CORRECTLY IN REAL LIFE!
If testing Windows Install ISOs using a Virtual Machine, ensure that you set 2GB RAM or more in the VM. 

DavidB’s VMUB utility was specifically developed for booting USB drives from within Windows using QEMU or Virtual Box. It first releases the USB drive from Windows before running QEMU or VBox so that they can Lock the drive and have full write-access to the USB drive.

QEMU_MENU_TEST (run as admin).cmd

QEMU is an emulator (it interprets CPU op-codes). The one included with E2B uses the Intel x86 32-bit CPU module.

The \QEMU_MENU_TEST (run as admin).cmd script in the root of the USB drive runs QEMU to create a temporary diskless virtual machine. A 32-bit Intel x86 CPU is emulated and 500MB of RAM (system memory) is allocated. This is just enough to boot to the E2B menu system and to run some small 32-bit payloads (as long as they don’t require too much memory). The E2B USB drive will appear as a disk 0 IDE Hard drive in the Virtual Machine – there will be no internal disk present. 

Note: The Virtual Machine that is configured by QEMU_MENU_TEST does NOT include a virtual hard disk (i.e. a system disk) and does not use VMUB. It is for testing the menu system only – not for running payloads!

  • Most 32-bit payloads will boot from the E2B menu.
  • You can select a .imgPTN file from the E2B menu and switch to it (or just use \SWITCH_E2B.exe). If Windows Explorer does not show you the new USB drive contents after switching to a .imgPTN image, unplug and reconnect the E2B USB drive.
  • 64-bit OS’s cannot be run (only the 32-bit CPU emulator version is used)
  • Because QEMU emulates a CPU, it is quite slow to run.
  • File writes to USB are temporary – e.g. any files that are changed whilst running under QEMU under the virtual BIOS will not be permanently changed (VMUB is not used).

QEMU (in RMPrepUSB)

The ‘Test using QEMU Emulator (F11)’ button in RMPrepUSB will also emulate a 32-bit x86 system. You can allocate up to 900MB of RAM (more may cause errors) to the virtual machine and full read/write access is given to the USB drive (file changes on the USB drive are permanent). You can also create a second virtual IDE hard disk. For instance, you can install XP using Easy2Boot to the virtual hard disk from an E2B USB drive and then boot to the virtual hard disk from E2B. RMPrepUSB also allows you to directly boot from a 32-bit ISO file (Ctrl+F11) or directly boot from the QEMU virtual hard disk (SHIFT+F11) if you created one. 

Oracle Virtual Box

I highly recommend using Virtual Box v5.2 + VMUB (I use this for all my E2B boot testing!). 

Setup VBox using these instructions –>  How to use DavidB’s Virtual Machine USB Boot application.

VMUB is a Windows application which makes it easy to boot from any USB drive. Download VMUB from here.

Tip: Create an Administrator shortcut on your TaskBar for VMUB. Always launch Oracle VBOX Manager using the button on VMUB.

First make a VM in Oracle VBox with just one SATA virtual hard disk at SATA Port 1 and leave SATA Port 0 free. (Note: Ventoy (Legacy boot) seems to have problems with SATA under VBox – it may be better to configure using an IDE or SCSI controller rather than a SATA controller. 2022-10)
Then run VMUB and create a new entry and set your E2B USB drive as the First USB drive.
When you click on Start in VMUB, the USB drive will be dismounted and the VM will then gain full read/write access to the USB drive.

IMPORTANT: Make sure you run VBox and VMUB with Administrator privileges – I suggest you set up shortcuts for each one with the Run as Admin box ticked.
If using VBox, you can set up a VM with VT-x/AMD-V acceleration when testing most features of E2B. However, you may find that the VM won’t run XP Setup unless VT-x/AMD-V acceleration is first turned off. Once the text-mode stage has completed, you can turn on VT-x/AMD-V acceleration to run the 2nd GUI stage.

Some Linux ISOs (e.g. Parted Magic) may also not run correctly with VT-x ON (if you get a ‘Cannot find SQFS’ error, try VT-x OFF or test on a real system). 

IMPORTANT: If the USB drive is configured as HDD0 in the VM and you install Windows to the Virtual Hard Disk 1, Windows may overwrite the MBR and PBR of the E2B USB drive. If you find your E2B USB drive no longer boots to the E2B menu, run RMPrepUSB.exe – Install grub4dos and install to the MBR and the PBR (do not overwrite the grldr file on the E2B drive). 

NOTE: Some features in WinPE\Firadisk don’t seem to work correctly if the VM System OS is set to ‘Windows’. I suggest you use ‘Other\Unknown 64-bit’ or ‘Linux\Ubuntu 64-bit’. I recommend you do not use VBox v6 until a new version of VMUB is available, use VBox v5.  VBOX version 6 is not compatible with VMUB. 

Under VBox, if you get a BSOD when booting to Windows (‘Page fault in nonpaged area‘) try setting the OS type to Windows XP 64-bit and enable PAE.

UEFI

With VBox, you can also UEFI-boot (64-bit or 32-bit UEFI). Just set up a new VM in VBox and specify either a 32-bit or 64-bit OS system and then tick the System – Motherboard – Enable EFI (special OSes only) checkbox. Note that VBOX does not support Win7 64-bit UEFI – it will hang on the 4-part flag graphic if you try it.  Other Windows versions are OK.

Running E2B under VBox+VMUB or QEMU

Be aware of these points when booting under VMUB:

  • The E2B USB drive will appear as Drive 0 even after booting to Windows or Linux.
  • The E2B USB drive will appear as a IDE\SATA\RAID drive in the VM and not as a USB drive
  • The E2B USB drive will appear as a Fixed disk and not as a Removable device.
  • If you have problems with the VM using too high a screen resolution in agFM UEFI mode, switch to a text-mode in agFM (F4 + T) first, before selecting the payload file.
  • XML files will not be automatically used by pre-Win10 Windows Install ISOs because the USB drive is not seen as a ‘Removable’ drive by WinPE (‘CD/DVD drive driver required’ message is seen). If E2B uses WIMBOOT however (default), the XML file will always be used (E2B v1.A8).
  • QEMU\VBox virtual BIOSes do not have the 137GB USB access BIOS bug – but some real systems do! If Legacy booting fails on a real system – it may have the 128GB/137GB bug!

VMWare

You can also boot directly from a USB drive using VMWare – see the VMWare section on this pageHowever, be aware that like VBox, VMWare does not allow direct sector writes to the USB drive volume area, so using .imgPTN files may fail to work and other writes may not be permanent (e.g. deleting or modifying files).
Do not use Plop!  – Plop! uses a read-only USB driver stack. Unless you have write access under the VM, E2B will not work, which is why Plop! is not suitable to use to boot from an E2B USB drive.
If you boot to E2B using Plop! then hold down the SHIFT key as E2B boots to load the grub4dos USB 2.0 driver. 

Many real Legacy BIOSes have a USB 137GB bug – the USB driver in the BIOS cannot access sectors beyond 137GB (the internal hard disk driver is OK, it’s the USB code that is buggy). The BIOSes used by VBox, VMWare and QEMU do not have this bug and so may work when a real system does not! For this reason, keep the E2B USB partition size below 137GB.  

Windows Vista/7/8/10 Installs under a VM

E2B uses WIMBOOT by default which does not require a ‘Removable’ type of USB drive to be used and so Windows Install ISOs should work correctly under a VM. For E2B to use WIMBOOT, the following criteria must be satisfied:

  • The system should contain more than 1300MB of RAM (system memory).
  • The ISO must be a standard (ish) Microsoft Windows Install ISO.

If you do not use WIMBOOT

WIMBOOT can be skipped if you press ENTER when prompted with the message ‘Press ENTER quickly if you do not want to use WIMBOOT’.

If WIMBOOT is not used then Vista/Win7/Win8/10 (NT6+) installs will not work correctly if you attempt to use a VM and install Windows to a virtual hard disk directly from an ISO file. You will see the message ‘A required CD/DVD drive device driver is missing’. This occurs because Windows Setup will only load an Unattend.xml file from a Removable disk and any USB drive which is attached to a VM will be seen by Windows as a Fixed Disk. Therefore LOADISO.CMD will not run and the Windows ISO file will not be loaded as a virtual DVD before Setup starts to look for it. Note: This issue does not apply if using .imgPTN images made from a Windows install ISO using MakePartImage – these images can be successfully run from within a VM. If WIMBOOT is not used by E2B, then to use E2B to install Windows Vista/7/8 manually in a VM from an ISO file, you will need to run LOADISO.CMD manually as follows: 

1. Run the VM and boot to E2B 
2. As soon as Setup loads and asks you for a language/country, press the key combination SHIFT+F10 – a black console window should open (if not, answer the next question and try SHIFT+F10 again) 
3. In the console window, type dir C:\_ISO and press the ENTER key – if the folder is not listed, try dir D:\_ISO  etc. until you find the E2B USB drive letter – let us assume that  ‘dir E:\_ISO’ worked – then the USB drive letter must be E: 
4. Now run loadiso by typing E:\_ISO\e2b\firadisk\loadiso.cmd – a blue console window should open – if then prompted to Repair Windows, just hit ENTER.

 5. The blue console Window should close – now continue with Windows Setup in the normal way. You should not see the ‘A required CD/DVD drive driver is required’ message now. 

Note that the XML file contents will be ignored in this case.

Note that Windows may overwrite the MBR and PBR of the E2B USB drive if it is HDD0 in the VM.

Installing Windows 7/8/10 using XML files

Sample XML files can be found in each SAMPLE XML FILES folder. To use them you need to copy them to the same folder as the ISO.

If using a ‘DiskWipe’ automated unattend XML file, then because the virtual hard disk is configured as HDD1 and the USB drive as HDD0 (with VBox+VMUB) you will need to use a ‘WipeDisk1‘ XML file because a ‘WipeDisk0‘ XML file will cause the E2B drive to be erased by Windows Setup!

New! Ventoy for Easy2Boot v1.0.97 now released!

 

eBooks available (in PDF format)

Easy-to-read eBooks are available in PDF format (each eBook is over 100 pages) – rated 4.5/5 stars.
Learn the secrets of Legacy and UEFI USB booting and then make your perfect multiboot USB drive.
E2B eBook #1 includes instructions on how to remove the E2B 5-second start-up delay blue screen.

E2B is unique in that it uses partition images which allows you to directly boot from Secure Boot images (no need to disable Secure Boot or run MOK manager or modify your UEFI BIOS).

Most eBooks are over 100 pages long, contain original content and step-by-step exercises which are suitable for both the beginner or the more experienced user.
Customer reviews are located at bottom of each eBook product page and multi-buy discounts are available when you buy more than one eBook. Please also visit RMPrepUSB.com and the E2B Forum.
Subscribe to my blog for the latest news, tips, USB boot articles and free eBook updates.