Virtualization on the command line with KVM
|
Sound Support
The virtual machine creates sound only from the physical machine's sound card. QEMU can provide a few virtual models. You can add Intel HD audio cards found in many current PCs as follows:
$ qemu -cdrom ubuntu.iso -m 1024M -soundhw hda my_img.img
Because Windows XP unfortunately provides no drivers, you can apply an AC97 audio card for a guest system with that operating system, as follows:
$ qemu -cdrom ubuntu.iso -m 1024M -soundhw ac97 my_img.img
A classic one – recommended particularly for older systems – is Sound Blaster 16, with the command as follows:
$ qemu -cdrom ubuntu.iso -m 1024M -soundhw sb16 my_img.img
The qemu -soundhw ? command lists all other supported sound card models. The abbreviation at the beginning of each output line is the one to use as the value after -soundhw .
Media Changes
If you ever need to change the installation media, press Ctrl+Alt+2. You then end up in the monitor console at a special command line you can use to replace, convert, and manipulate the virtual machine hardware while still running. To replace a CD or DVD, first inquire about the current state of the devices using the following command:
(qemu) <info block>
This spits out a few cryptic lines, such as in Figure 5. The QEMU device name is one of the first entries.
In Figure 5, it's easy enough to figure out the CD drive as ide1-cd0 as the "integrated" ISO file along with the removable=1 designation. You can eject the CD or DVD with the following command:
(qemu) <eject -f ide1-cd0>
Here the -f option forces the ejection, in case, for example, the operating system is still holding onto the media.
Once the virtual disk is empty, you can substitute the replacement media, which, in the following example, is located in /home/tim in a file named cdrom2.iso :
(qemu) <change ide1-cd0 /home/tim/cdrom2.iso>
If a virtual machine hangs, you can start it up again in the monitor with system_reset . Also useful is the sendkey monitor command with which you can trigger a key combination on the virtual machine, such as:
(qemu) <sendkey alt-f1>
This command would open the start menu. Exit the monitor with Ctrl+Alt+1.
Buy this article as PDF
Pages: 5
(incl. VAT)