For development I like the power of a desktop machine, however I also like to not be tied down to a desk. To achieve both I bought a cheap laptop to remote into my desktop, one I wouldn't care about too much. A Chromebook.

Working from the pool with a neoprene mat and waterproof keyboard

I want use this laptop to setup Arch Linux in a sandbox starting with installing the OS and packages. I plan to do this in QEMU. I installed the headless version on my desktop, qemu-base, and will be remotely executing instructions over ssh. Something I can do from the pool side.

First is to create a disk image for storage, Arch wiki states a minimal installation can be less than 2 GiB. I'll be using 60 GiB, mainly to test some configurations.

qemu-img create disk.img 60G

I wrote a script to startup QEMU with the same architecture as the host desktop, this allows KVM accelerations. The default machine type/version is verbosely added in case they are important for future reference. The serial parameter is important to include so that QEMU redirects stdio from the virtual serial port to the desktop terminal. The mon:stdio is used instead of just stdio so we can use Ctrl+c without it stopping QEMU on the host, to actually stop QEMU you'll need to press Ctrl+a and then x.

#!/bin/sh
qemu-system-x86_64 -machine type=pc-i440fx-8.0,accel=kvm -cpu host -serial mon:stdio -drive file=disk.img,format=raw,index=0,media=disk -cdrom archlinux-x86_64.iso -m 1G -boot order=dc

Continuing setup of using a serial port, we need to edit the kernel parameters. Normally you might pass it through QEMU but we don't have a kernel to pass the parameters yet. For the live media installation, I only know know this can be edited when the boot loader menu appears. Simply hit Tab before the timer runs out and append the kernel parameter console=ttyS0. Make sure to add a space in front and hit Enter to continue.

Boot loader menu in QEMU
After adding console=ttyS0

If everything goes well you should see something like below, it will continue loading until it presents a login prompt, which is just "root". If the serial terminal is not setup correctly you will see the first  "Loading" lines and then nothing else almost like it has stalled. If you have a slower machine or are not able to use an acceleration method then it might just be taking a while--so you may want to wait some amount of time.

Output you should be seeing on success

At this point you can follow the Arch wiki and setup the virtual machine any way you like. I won't go into the installation for this post, but you can setup Arch Linux multiple times if you want to try learning how to configure it better or trying different variations before committing a machine. The startup script will need to be adjusted to run any disk image after you install any OS.

I plan to play around with different configurations myself, so there will likely be other posts before I get back to this. I have some more posts related to travel and food being drafted, also working on some RISC-V projects. Hopefully the quality of these posts will improve each time.

If you have any additions or would like to point out errata please feel free to raise an issue on Github.