Virtual machines provide machine abstractions that make workload consolidation, isolation, and even full machine emulation possible. Today's studio will focus on the QEMU (pronounced "Q-em-you") machine emulator and the KVM hypervisor, showing you how to boot virtual machines and explore the differences between software emulation and hardware virtualization in Linux.
In this studio, you will:
Please complete the required exercises below, as well as any optional enrichment exercises that you wish to complete.
As you work through these exercises, please record your answers, and when finished upload your results to the appropriate page in Canvas.
Make sure that the name of each person who worked on these exercises is listed in the first answer, and make sure you number each of your responses so it is easy to match your responses with each exercise.
Navigate to https://github.com/sakaki-/gentoo-on-rpi-64bit and follow the instructions to install the Gentoo operating system on your microSD card. You should start from the section titled Prerequisites and download the "full image" rather than the "lite" one.
This link will first walk you through the process of formatting your
Raspberry Pi's microSD card. This will in turn require access to another
computer system that you will plug the microSD card into (e.g., using either a
USB or microSD to SD memory card adapter, provided with your Raspberry Pi if
you purchased from the Canakit website). You will then overwrite the microSD
contents with the Gentoo system files. Note: decompressing and copying
the genpi64.img.xz image to your microSD will likely take around 20
minutes
Once you have formatted your microSD card and installed the Gentoo files on it, proceed to the section titled Booting!. This will require your Raspberry Pi to be connected to a keyboard/monitor/power supply. The process of bringing up the new OS may take a few minutes and will require a couple of reboot cycles, so be patient and follow the on-screen instructions. Once the new system has booted, make sure you at least change the password for the default user demouser and for root. Both passwords are initially set to "raspberrypi64"
Once you've booted into the new OS, open up a terminal, and as the answer to
this exercise, show the output of the command uname -a
During the guest booting process, you may see some error messages, but they are non-catastrophic. The VM will ask you to "Press any key to continue". Do so, and then once the VM has booted, you can login with the username 'ubuntu' and password 'passw0rd'
As the answer to this exercise, show the output of running uname -a in
the Ubuntu VM
Teardown the virtual machine by typing shutdown -h now in
the guest console. Open up a separate terminal window, issue the following command:
time while [ 1 -eq 1 ]; do sleep 10; done
Now, restart the VM by running the same QEMU command line to boot the VM, and, once you have logged in to the VM, type "Ctrl+C" in the window in which you ran the time command. As the answer to this exercise, list the amount of time it took to boot the VM.
Finally, again teardown the VM, and restart the makeshift timer as shown
above. This time, reboot the QEMU VM, but remove the "-accel kvm"
and "-cpu host" options from the QEMU command line. Wait a few
minutes (or as long as the initial boot process took with KVM enabled) and as
the answer to this question, describe what you see on the QEMU console window.
Based on your understanding of KVM and hardware virtualization, describe why
the behavior is different in the two different QEMU boot commands when KVM is
enabled vs disabled.