Stage 2: Install Ubuntu on the QEMU disk image
Next we install the Ubuntu base system onto a QEMU disk image. You’re going to need to download the Ubuntu net install disc ISO.
The following steps come almost verbatim from the “Ubuntu on OLPC XO” article on wiki.laptop.org. If you haven’t already read this article you need to do so now.
Run qemu-launcher. In qemu-launcher:
- Disable “Snapshot mode” and enable “Use CD-ROM”.
- Select “CD-ROM” from the Boot Disk drop-down menu.
- In the “CD-ROM” field, select the mini.iso file you downloaded.
- For Hard Disk 0, click New and choose create a RAW disk image that is 1.8GB in size in some location.
- On the Network tab, use 1 card. For “Card 0”, select Use the user mode network stack, remove any redirects, ignore the IP address, and use the MAC address of the network card that is currently connected to the internet (make sure letters are lower case!). You can get the MAC address by running ifconfig in a terminal.
- Click Launch to boot from your image.
After QEMU boots the ISO, you’ll see an Ubuntu grub splash. Type cli to proceed with CLI installation. During the “Download installer components” step, if you’re unlucky the install will fail and you’ll be treated to this nice little screen:
Select Continue twice and you’ll be back at the Ubuntu installer main menu. Just select “Download installer components” and don’t select any optional components to work around the error. You’ll then be free to go through the rest of the text-based Ubuntu install. It should find QEMU’s virtual network card and configure it automagically. If it doesn’t, then go back and check your MAC address for capital letters where your hexadecimal digits go.
When prompted, partition the the image manually with just one large partition formatted with the ext2 filesystem, and with a mountpoint at “/” (root). Set the noatime flag and mark the partition as bootable. Ignore the suggestion for swap as it will only eat the flash card.
The netboot install will get all of the latest packages from the repository and install a complete x86 based OS (minus a GUI). This step is going to take a long time so go get some food or watch a movie.
When Ubuntu finishes installing it will try to reboot and you’ll be looking at the boot CD splashscreen. Close the QEMU window and bring qemu-launcher back up. Switch the boot disk from CD-ROM to Hard disk 0 and launch QEMU.