Creating virtual machines with .vmdk files in QEMU

It is inconvenient because I cannot copy/paste on a certain OS. So we will use qemu to make this happen.

QEMU (Quick EMUlator) is an open source virtualization software. Below is a brief description of the main features and functions of QEMU.

Overview of QEMU

  1. Virtualization and Emulation:.
    • QEMU emulates the hardware of the host machine to create a virtual machine (VM). This allows operating systems and software of different architectures to run on the host machine.
    • For example, it is possible to run an ARM architecture OS on an x86 architecture machine.
  2. Performance: The VM can be used as a virtual machine for
    • QEMU delivers near-native performance when combined with virtualization technologies such as kernel-based virtual machines (KVM) and Xen. when combined with KVM, QEMU can be virtualized at high speeds with the hardware support of the host.
  3. Flexibility:.
    • QEMU supports a wide variety of CPU architectures (x86, ARM, PowerPC, SPARC, etc.) and can be used as a test environment for various OS and software.
  4. Disk Image: QEMU can be used as a test environment for a variety of operating systems and software.
    • QEMU supports multiple disk image formats (qcow2, raw, vmdk, etc.) for flexible virtual machine storage management.
  5. Network virtualization: QEMU supports
    • QEMU supports virtual network devices, allowing virtual machines to build network connections to each other and to the host machine.

Examples of QEMU Applications

  • Development and Testing:.
    • Used for software development and testing for different architectures.
  • Security Research: Used for
    • Virtual environments can be used for secure malware analysis and security testing.
  • Education:.
    • Used as a learning and experimentation environment for different operating systems and architectures.

Visual conceptual diagram (example)

  1. Basic structure diagram of QEMU:.
    • Host OS: Main OS running (e.g. Windows, Linux)
    • QEMU: virtualization software
    • Guest OS: OS in a virtual machine running on QEMU (e.g. Linux, Windows)
 ----------------------- 
| Host OS |
| (Windows/Linux) |
-----------------------
| (Windows/Linux)
v
-----------------------
| QEMU |
-----------------------
| QEMU | QEMU
v
-----------------------
| Guest OS |
| (Linux/Windows) |
-----------------------
  1. An example of realizing the above flow diagram: (Linux/Windows)
    • Step 1: Install QEMU on the host OS
    • Step 2: Download guest OS ISO image
    • Step 3: Create a new virtual disk
    • Step 4: Install Guest OS on QEMU
    • Step 5: Boot and use the Guest OS

Practice
Install qemu on the virtual machine (ubuntu24.04) created on Proxmox VE; VirtualBox, VMware, or WSL may also work; for Windows or Mac, download and install the binary from the official site.

sudo apt-get install qemu qemu-kvm

However, an error occurs.

Loading package list… Completed
Creating dependency tree… Done
Reading status information… Done
Note, select ‘qemu-system-x86’ instead of ‘qemu-kvm
Package qemu is not available, but is referenced by another package.
This means that the package is missing, obsolete, or only available from another source
available only from another source.

E: Package ‘qemu’ has no installation candidates

So, change the command as instructed.

sudo apt-get install qemu-system-x86

Next, prepare the .vmdk file used by VMware. The .vmdk file should reside in a specific folder. For example, they reside in a path such as /path/to/your/vmdk/file.vmdk. In this case, we were creating a virtual machine with windows VMware, so we will send the .vmdk file to the virtual machine (ubuntu24.04). By the way, I used TeraTerm’s SSH SCP to transfer the file.

Start the virtual machine using the .vmdk file with QEMU.

qemu-system-x86_64 -hda /path/to/your/vmdk/file.vmdk

However, another error occurs.

mamu@vm102:~/vmdk$ qemu-system-x86_64 -hda /home/mamu/vmdk/FreeDOS1.3.vmdk
gtk initialization failed

The gtk initialization failed error indicates that the GUI environment could not be properly initialized when QEMU is trying to boot in GUI mode. To work around this error, you can try several methods.

Method 1: Start QEMU in headless mode

Start QEMU in headless mode and do not use the graphical user interface. In this case, use VNC or SSH to access the console of the virtual machine. The error above was resolved with this command.

qemu-system-x86_64 -hda /home/mamu/vmdk/FreeDOS1.3.vmdk -nographic

Method 2: Boot using SDL or VNC

You can avoid GTK initialization errors by modifying the QEMU front end. For example, use SDL or VNC to boot QEMU.

If you use SDL:.

qemu-system-x86_64 -hda /home/mamu/vmdk/FreeDOS1.3.vmdk -display sdl

Using VNC: qemu-system-x86_64

qemu-system-x86_64 -hda /home/mamu/vmdk/FreeDOS1.3.vmdk -vnc :1

This will start QEMU as a VNC server and allow you to connect to the virtual machine using a VNC client (e.g., vncviewer ).

Method 3: Install GTK dependencies

If you encounter GTK initialization errors, you may be missing GTK dependencies. Use the following command to install the necessary packages

sudo apt-get install gtk3.0

Log of FreeDOS started

SeaBIOS (version 1.16.3-debian-1.16.3-2)

JemmEx v5.79 [02/02/20].
JemmEx loaded
Kernel: allocated 46 Diskbuffers = 24472 Bytes in HMA

FreeCom version 0.85a – WATCOMC – XMS_Swap [Jul 10 2021 19:28:06].

Error: DIGN8002 The BLASTER environment settings are invalid.

Performing action: APMDOS
If APMDOS slows down any app, use ADV:REG instead.
Going resident.

CuteMouse v2.1 beta4 [FreeDOS].
Installed at PS/2 port

CD-ROM initialization.
CuteMouse v2.1 beta4 [FreeDOS] Installed at PS/2 port CD-ROM initialization. attempting to use the UDVD2 CD driver, success
attempting to load SHSUCDX CD extenstions, success
successfully started the CD driver and extenstions for drive D: (FDCDX001)

Modules using memory below 1 MB: Name Total Conventional Upper Memory

Name Total Conventional Upper Memory
——– —————- —————-
SYSTEM 17,072 (17K) 10,768 (11K) 6,304 (6K)
JKEYB 6,000 (6K) 6,000 (6K) 0 (0K)
COMMAND 3,376 (3K) 0 (0K) 3,376 (3K)
FDAPM 928 (1K) 0 (0K) 928 (1K)
CTMOUSE 3,104 (3K) 0 (0K) 3,104 (3K)
UDVD2 1,984 (2K) 0 (0K) 1,984 (2K)
SHSUCDX 6,160 (6K) 0 (0K) 6,160 (6K)
Free 717,104 (700K) 637,056 (622K) 80,048 (78K)

QEMU network detected.

Physical hardware networking is not supported at this time.

CD-ROM configured as D: drive (FDCDX001)

Done processing startup files C:\FDCONFIG.SYS and C:\FDAUTO.BAT

Type HELP to get support on commands and navigation.

Welcome to the FreeDOS 1.3 operating system (http://www.freedos.org)

I was able to boot and copy and paste, but there were many problems, such as the music player not starting.

Please share if you like it!
TOC