This document is about how to setup the environment for booting Linux on qemu, an open source machine emulator. This document just sets up qemu. Downloading, building and booting Linux is explained elsewhere.
THESE INSTRUCTIONS ARE NOT GUARANTEED TO WORK. They are intended to give you a good head start so that you can figure the rest out for yourself. Surmounting obstacles is vital to doing systems work and for appreciating systems work.
If you discover that these instructions need to be modified, let me know. Systems work is highly collaborative.
I will be indicating variables for you to fill in with <>, as in "<you decide this>". A repeated variable name will indicate that you want to use the same value as before.
I recommend that you look up any command (e.g. dd) or command-line option you aren't familiar with using man (e.g. execute "man dd").
We will be using a number of command line options for QEMU here. I suggest you make shell scripts to organize them.
5GB disk space quota allowed to graduate students(or 1GB for undergrads) on CS machines might not be sufficient for programming assignments. You can use local disk partition at /var/local/ on CS machines instead. This partition typically has 30+ GB and also is not part of NFS system which will make I/O faster.
Ensure QEMU (or qemu-kvm) is installed (or build it yourself).
The qemu binary will be
I recommend the 64-bit server version (if you have a 64-bit system; I'm not sure that you can emulate a 64-bit VM on a 32-bit system). You will get a file <ubuntu image.iso> .
Use VNC to start
QEMU command line options:Note that this isn't secure; someone else can log into your VNC server. "-nographic" will help with that, and there's also a VNC password option if you are paranoid (that I have not played with).
For future QEMU running, I won't collect all the options in one command; you can do that yourself.
Use a VNC client. For Linux, you can use vinagre. The VNC server with display at ":<x>" is generally available at port <5900+x>.
Most options are pretty self explanatory. I have not messed with LVM, so I don't know how turning that on will affect your image. You should have net access (though you can't connect to the VM from the outside, only from in the VM outward).
When you come to the end of the install process, you don't need to "eject" your CD - when you reset the VM, the VM will crash. That's fine and expected. Kill the QEMU process.
There are a few things you need to do to put your system in the final state you will want:
You won't want to use VNC forever with a text-only interface. You need to ensure that a serial console is loaded to use the non-graphical option.
Copy /etc/init/tty
Change the text inside so that tty<x> becomes ttyS0 everywhere, and change the "getty" line to:
exec /sbin/getty -L 115200 ttyS0 vt100(this by experiment works, other variants may as well)
When you have done this, you will now replace the "-vnc :0" option to qemu with "-nographic", this causes your terminal to instead connect to qemu directly. (You may want to have another terminal handy to kill the qemu process, or use a terminal manager like "screen".) If you don't do that, your kernel will appear to hang when it is done booting. That's just because you're not seeing the action.
You may still see plymouth messages (see below), but it seems in non-graphical boot this is not a problem (you will still reach a terminal). You can remove these by removing Plymouth from startup as below.
For reasons I admit I don't fully understand yet, Plymouth (a graphical bootloader for Ubuntu) will mess up your (graphical only it seems) boot process when you don't have a ramdisk. So if you want to keep using VNC with your custom kernel, you have to remove /etc/init/plymouth*.conf .
I also suggest opening /etc/modprobe.d/blacklist-framebuffer and adding "blacklist vga16fb" to the list, or else listing long directories will be painfully slow.