QEMU: Testing Linux Versions Easily With My System
by Mike Levin SEO & Datamaster, 05/10/2011
QEMU is a virtual computer, along the lines of VMWare, VirtualBox, Parallels, VirtualPC and all those others, except that it’s free and open source (FOSS), and can emulate different hardware platforms. It was chosen by Google as part of the Android development platform, so it’s unlikely to go away. I chose it for learning Linux, due to it’s ability to let you experiment relatively easily, moving your virtual computer between Macs and PCs with ease.
I set QEMU up as an install-less double-click runnable persistent system that is portable between a Mac and a PC. I did it such a way that you can rapidly experiment with different Linux installations, install options, hard drive configurations. And now that I’m deep into my Linux education, I figured I would share the fruits of my labor.
I wrote extensively on setting up a keychain or pendrive QEMU Linux in earlier blog posts, in what seems like forever ago. I kept running into the likes of pendrivelinux.com and damnsmalllinux.org. These are both excellent projects, and even QEMU itself comes with a (very) tiny linux.img just to get a test-boot going. But all these projects missed the point for my specific project (learning Linux SERVER), making me have to cobble together my own.
So anyway, after all the writing I’ve done on this site, I finally have something to give you: my QEMU “shell” for dropping install.iso files into location, and enjoying all the double-click goodness of the Windows and OS X desktops to launch and experiment with Linux installs. In particular, I suggest you download the 16MB Debian Squeeze netboot installer file from this location: http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/mini.iso …and rename it install.iso and drop it in the LittleSystem folder.
Then, depending on whether you’re on Windows or OS X, go into the appropriate helper directory, and double-click first, reinstall-begin and then reinstall-continue. The first one renames your old virtual harddrive image and moves it to the top folder where you can find and delete it easily. The second one boots Linux using your install.iso as the cdrom and the new empty harddrive image (which was just made with qemu-img) as the hard drive, which will need to be partitioned and formatted in the course of the install.
If you’re into this sort of thing, this system gets you into a nice rhythm of trying a new .iso file or install procedure, deleting it if you don’t like it, and starting over until you get what you want. You can usually just press the Enter button through most of the install, answering only the required answers, like a password for root, and have a working Debian installation. Don’t worry–on Windows, you’ll get a “locked up” DOS window during the install, but the LittleSystem.vbs gets rid of it during normal use (not the install).
Behind the Curtains
There’s a whole bunch of magic going on here. I registered LittleSystem.org, because I think I’m onto something as fundamential as Damn Small Linux (DSL) or linuxpendrive, and want to make a site to document its development. What you’re using is version 1.0. But I’ll just document a little of the magic going on.
First, the most recent compiled executables of QEMU for both the Mac and the PC are bundled into this package. On the PC-side, it’s the unoffical binaries given out by Kazu and Takeda, per qemu.org http://wiki.qemu.org/Links On the OS X side, it’s the Q port http://www.kju-app.org/, also per qemu.org. I just sort of superimposed the two distributions, using an exported Q self-contained OS X .app “package” in which folders masquerade as standalone-programs as the template.
That leads to the second piece of magic: the Mac OS X “package”. That’s why PC users see LittleSystem.app, and must click LittleSystem.vbs to start the system, but OS X users only see the directory as LittleSystem, and when you double-click it, it behaves like an App. This is a vastly powerful and hugely under-rated and under-discussed feature of OS X. Basically, any folder can carry around its dependencies, and I’m using that fact to make it carry around BOTH the OS X and Windows binaries… ha ha ha!
The next piece of the magic is just some very simple, but very carefully written scripts, so that you can try things over and over, and easily find and delete your old virtual hard-drive image. I minimize the chance of losing a virtual hard drive image you didn’t mean to lose by renaming it to deleteme.qcow, which you could always rename back to harddrive.qcow, and copy it back into LittleSystem/LittleSystem.app/Contents/Resources/Guest/LittleSystem.qvm Just don’t run reinstall-begin over and over, or the deleteme.qcow files will override each other, losing your older (and probably, originals). You can rename the files yourself once they pop into the LittleSystem folder, if you want to keep archives.
The next piece of magic that I can think to mention right now is the mere use of the qcow file format, which inflates like a balloon as-needed. Therefore, your installation onto a 900MB virtual hard drive only takes as much room as the files that attempted to install, and will typically come out around 500MB for a barebones Debian system. After stripping out a bunch of nonsense, I regularly get barebones Debian down to about 250MB using some additinoal tricks that are documented in the README.txt in the HelpersWin directory. Unfortunately, the distributed qemu-img binary is a bit ahead on the PC than it is on the Mac, so the file-shrinking trick must be performed on a PC.
And finally, the last piece of magic is that the entire download is only about 3.5MB, which you can download the 3.5 MB LitlteSystem file here: QEMU Testing Linux Versions Easily from my dropbox account, and the 16MB mini.iso Debian netboot installer, rename it to install.iso, drop it in the LittleSystem directory, and follow the instructions.