Adventures in QEMU

I’ve decided to try and rice my computer, which means I’m going to make it look ~cool~ and completely unusable to anyone but me. It’s like modding your car, but for dweebs and computersThere’s a lot of inspiration over at /r/unixporn, if you’re into that kind of thing, or just want to see what I’m talking about. It’s a lot of boxes with colors around them. That’s really all it is..

ANYWAY, to rice, I’ve decided to set up a virtual machine running ArchBTW. so that I can keep using my laptop. I have used VirtualBox before, but it seems heavy, so I decided to try QEMU. I’ve tried it half-heartedly before but could never figure out what incantation to use to get it to run right. This time, I finally got there, so I’m sharing it with you (and of course, me in the future).

Create the image

First things first, you have to make a disk image to act as your pretend hard drive. That’s easy:

qemu-img create -f raw rice.img 6G

This creates a 6-gigabyte image in the raw format, which I think is just 6G allocated on-disk? I’m not sure, to be honest. But it’s the format I used.

Install Arch (or whatever, obviously)

Next up, you need to spin up a virtual machine with an install medium. I downloaded an Arch ISO using

curl -Lo arch.iso

which saved to a file called arch.iso in my working directory.

Then I ran this command to load the Arch ISO as a CD:

qemu-system-x86_64 -cdrom arch.iso -boot order=d -drive file=rice.img,format=raw -m 2G

And ran through the Arch Linux Install Process as per usual.

Make sure to enable the dhcpcd service! I did not, and thought something was wrong with my network stack. It wasted some time.

Scripting the VM

Finally, I wrote a bash script to run the virtual machine whenever I want to customize away. It looks like this:

Ready to RICE

Now I have a nice base image to rice away to my heart’s content. I’m going to try something with wmutils, I think. I’ll post here about it when I’m happy with it.

Addendum: Resources