Virtualise Arch
Virtualising Arch the easy way
Want to test software without crashing your computer? Neil Bothwick creates a disposable system that you can crash without consequence.
Credit: www.qemu.org
QEMU
OUR EXPERT
Neil Bothwick is a big fan of virtualisation. You name it and he has virtually done it. Occasionally, he really does something.
When developing and testing software, it helps to have a stable base platform on which to test it. This is particularly true when doing anything low level that would otherwise involve rebooting to test. For this type of testing environment a virtual machine is often the best option. It boots quickly, it doesn’t interfere with your normal system and if it goes wrong, you can easily delete it and start over.
In this article we’ll see how you can create a virtual machine image based on Arch Linux, a distro popular among those who like to get involved with the nuts and bolts of Linux (but may not have the patience to install Gentoo). One of the useful side effects of the way in which Arch Linux (and Gentoo) are installed is that it’s a largely manual process, which can be time-consuming when setting up a full distro, but can be very efficient for setting up a virtual machine.
Because the Arch Linux installer disc is just a live version of Arch, you can just as easily install from an existing Arch system, and that’s what we’ll cover here. Although this requires Arch Linux on the host computer, it’s also possible to follow this when booted from an Arch live disc, or you could boot the emulator from the live disc.
First signs of life! Here’s the guest running in the terminal from which Qemu was run, which proves it works and may be all you need.
Avoiding confusion
Because we’re working with virtual machines, there are often two systems running at the same time. The host is the OS running on your computer as normal, while the guest is the environment running on the virtual machine. We’ve tried to make it clear which commands should be run on the host and which on the guest by prefixing them with /host/ or /guest/ , respectively.
Obviously, you don’t type this in the command, just the part after the $ as normal.
The normal approach is to boot a virtual machine from an installation disc (or USB stick) and then install the OS. However, using Arch as the host system makes it easy to create a disk image without going through the full installation process. We’ll be using the disk image with Qemu, a fully open source emulator, so make sure you’ve that installed, as well as the scripts used by the install discs:
/host/ $ pacman -S qemu arch-install-scripts
Set your limits