Sneaking Linux into Windows
Portable QEMU
Carry a virtual Linux machine with you wherever you go.
Theoretically, a bootable USB stick with a Linux distribution lets you carry your Linux desktop with you without installing any software on the host machine. In practice, however, your Linux-on-a-stick might not be as universal as advertised. Sometimes you must ask the permission of the owner of the computer you are using, and many PC owners are reluctant to let their friends boot to a totally different operating system. In some cases, you might need to manually reconfigure the BIOS to support a USB boot. Many Internet cafes do not even let you reboot the system, so booting into Linux simply isn't an option.
An easy solution to this problem is a virtual machine based on the popular QEMU emulator [1]. With QEMU, you can install a Windows version of QEMU on a USB stick, create a Linux-based virtual machine, and run Linux as a virtual system inside Windows.
The excellent Qemu Manager [2] tool lets you turn your USB stick into a portable computing environment (Figure 1). Qemu Manager wraps the QEMU functionality into a sleek and user-friendly graphical interface that lets you create, manage, and run virtual machines with consummate ease. Installing Qemu Manager is as simple as downloading the zipped version of the tool, unpacking it in a folder on the USB stick, and double-clicking on the QemuManager.exe executable to launch Qemu Manager.
Qemu Manager boasts an easy-to-use interface that provides access to almost all of QEMU's features (Figure 2). If you've ever tried to work with virtual machines in any other virtualization software like VirtualBox or VMware Player, you'll feel at home with Qemu Manager. The main toolbar at the top of Qemu Manager's window contains buttons that allow you to create, delete, and launch virtual machines. In addition, the Create Disk Image button lets you create an image from a CD or DVD. This feature can come in handy if you have to generate an ISO image to use with a virtual machine from a system CD or DVD. To create and manage so-called VM stores or virtual machine repositories containing configuration files and disk images, use the Manage VM Stores button. Finally, the Add/Remove Hardware button allows you to add and remove hardware components in a virtual machine. The right pane of the main Qemu Manager window contains three sections: Hardware, where you manage and configure the virtual machine's hardware modules; Drives, for managing the virtual machine's hard disks, optical drives, and snapshots; and Advanced, where you can tweak QEMU's advanced settings. The left pane lists the current virtual machines.
Working with Virtual Machines
Creating a new virtual machine in Qemu Manager is very easy. Before you press the Create new VM button, though, you need to download an ISO image of the Linux distribution you want to use with Qemu Manager. Alternatively, you can use the Create Disk Image button to convert the inserted CD or DVD into an ISO image. Place the downloaded or generated ISO image into the Media folder inside your Qemu Manager folder on your USB stick. It is important that you keep all .iso images in this folder so your virtual machine can find them no matter which letter Windows assigns to the USB stick. Now you can press the Create new VM button, which starts a wizard that guides you through the process of creating a virtual machine (Figure 3). Setting up a new virtual machine only requires you to specify a few basic settings, such as guest operating system (Linux Distribution), a platform for the virtual machine (choose Standard x86/x64 PC if you plan to use the virtual machine on Intel or AMD-based machines), memory size, and a virtual disk image. The last two settings depend on the Linux distribution you want to use with the virtual machine; for example, running lightweight distros like Puppy Linux or SliTaz will require about 128MB RAM and a relatively small hard disk. When setting up a virtual disk image, you have the option of encrypting it, which provides an additional level of security.
If you need to, you can always modify the virtual machine's settings specified in the wizard in the Hardware section. Editing the settings can be useful when you need to tweak the virtual machine to run optimally on the computer at your disposal. For example, if you run the virtual machine on a computer with a dual-core processor, you can adjust the No of CPUs setting accordingly. Does the host machine use a 64-bit processor? Then set the CPU Type option to 64-bit. When creating a virtual machine, you might also want to enable the Qemu Manager QEMU Client, which adds a few useful features like the ability to manage physical and virtual drives, send the Ctrl+Alt+Del command to the guest system, pause and resume the virtual machine, and manage snapshots.
Before you launch the created virtual machine, you have to specify the .iso image as the boot device. In the main Qemu Manager window, switch to the Drives section, double-click on the CD-ROM item, select the .iso image, and press OK. Now double-click on the Boot Drive item and select CD-ROM from the Boot From drop-down list. Later, if you decide to install the Linux system on the virtual hard drive, you can remove the .iso image and set the Boot Drive to Hard Disk.While you are at it, you can tweak other settings, too. For example, if you want to exchange files between the guest and host systems, you can enable the file transfer feature. File transfer occurs through a local FTP server that the guest system then accesses with the use of an FTP client. To enable the file transfer feature, choose File Transfer | Configure File Transfer Server in the main menu (Figure 4). If you want to share a specific folder, tick the Share The Following Folder Only checkbox and select the desired folder. Once you've configured and saved the server, choose File Transfer | Start File Transfer Server in the main menu to start the server. Then you can access the FTP server from your Linux system running in QEMU with the 10.0.2.2 address and QEMU as both username and password.
Once the virtual machine is configured, fire it up with the Launch Selected VM button on the main toolbar. If you enabled the Qemu Manager QEMU Client, you can control the virtual machine session with the buttons on the top toolbar. Most of these buttons are self-explanatory except, perhaps, VM Snapshot Management.
Like other virtualization systems, QEMU allows you to take a snapshot of the virtual machine's current state. Then you can use the snapshot to launch the virtual machine in exactly the same state you left it. The VM Snapshot Management button provides access to commands that let you take a snapshot of the virtual machine, as well as load and delete existing snapshots.
Emulate or Virtualize
Before you create and run a virtual machine, keep in mind that QEMU can act as either an emulator or a virtualizer. When used as an emulator, QEMU "mimics" the Pentium II processor, dynamically translating the guest application's calls into native instructions. Although QEMU offers decent performance by emulator standards, it is still too slow to be genuinely useful. When used as a virtualizer, QEMU achieves near native performance by executing the guest code directly on the host processor. The virtualizer mode is by far the best way to use QEMU, but it requires the KQEMU accelerator software on the host machine. Fortunately, Qemu Manager makes it extremely easy to install the KQEMU component. Simply choose the Options | Install KQEMU Accelerator command from the main menu to turn QEMU into a virtualizer. Once you're finished using your virtual machine, choose the Uninstall KQEMU Accelerator command.
Final Word
The QEMU/Qemu Manager combo makes a perfect solution for running a Linux environment inside Windows. Using Qemu Manager, you can easily create and manage virtual machines and stay productive, even when you only have access to a Windows machine. Even if you carry your notebook or netbook with you, having a ready-to-use virtual machine on a USB stick provides an excellent backup option.
Infos
- QEMU: http://www.nongnu.org/qemu/
- Qemu Manager: http://www.davereyn.co.uk/
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.