Qemu on Linux

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to: navigation, search

Computing: Linux: Qemu: on Linux

This is a seed article. You can help HTYP grow by watering it.

This article is about setting up and running the Qemu emulator on Linux.

Reference

Notes

When Bochs mysteriously stopped being able to run Win98, I found that Qemu was able to use the exact same .img file Bochs had been using, and it did manage to load Win98 quite easily. It would appear, then, that the setup for Qemu on Linux is probably quite similar to that of Bochs.

Current issues

  • 2005-12-29 Current repository version of Qemu no longer says "warning: could not open /dev/net/tun: no virtual network emulation", but still can't see anyone on network except the local (virtual) machine. DHCP is not fetching an IP address.
  • Need to figure out how to mount an .img file -- although it's probably not safe to write to an .img while it's in use by the emulator, so this actually wouldn't be all that useful; you'd have to shut down before writing files to the image. Networking is greatly preferable.
  • Is there any way to tell Qemu to show a different window title (other than just "Qemu")? When running multiple sessions, it would be nice to be able to tell them apart at a glance.

Problems/Solutions

  • Problem: "warning: could not open /dev/net/tun: no virtual network emulation"; Solution:
    • as root, run "modprobe tun"; if no error, then the tun module has been installed successfully
    • "ls /dev/net/tun" to make sure the device has been created
    • Try qemu again. If the console asks for a password for "/etc/qemu-ifup", on Ubuntu the password it wants is your user password (not sure if this must be the user who installed qemu or the user who is running qemu; perhaps they have to be the same?); this may be different for other distros
    • However, the network card may still not work at this point; see Current Issues above.

The disk image

  • To create the image:
qemu-img create win98hd.img 2G
qemu -hda win98hd.img -cdrom win98.iso -boot d

...where win98hd.img is the name of your disk-image file (it can be anything) and win98.iso is the name of a CD ISO image (useful for installing an operating system from CD).

Accelerator

For linux host systems, there is a loadable kernel module (called kqemu) that will allow qemu to run at near native speeds. At the time of this writing, there aren't distributed packages available with the module built, so you'll need to download the source from the website and compile it locally.

I've been told that kqemu (or is that qemu-fast, or are they the same thing?) and Win98 don't get along, which seems borne out by my failed attempts so far to boot Win98 using either one of them – but that could be due to some configuration problem, as I haven't tried booting anything else with either of them either. --Woozle 12:10, 18 February 2006 (EST)

Other stuff

The sample /etc/qemu-ifup file which comes with linux-test-*.tar.gz:

#!/bin/sh
sudo /sbin/ifconfig $1 172.20.0.1