Difference between revisions of "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 Jump to search
m (→‎Notes: /etc/qemu-ifup sample)
(→‎Current issues: window title)
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
===Current issues===
 
===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.
 
* 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 once you've got a bootable, networked OS. Networking is the way to exchange files.
+
* 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===
 
===Problems/Solutions===
 
* '''Problem''': "warning: could not open /dev/net/tun: no virtual network emulation"; '''Solution''':
 
* '''Problem''': "warning: could not open /dev/net/tun: no virtual network emulation"; '''Solution''':
Line 14: Line 16:
 
** 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
 
** 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.
 
** 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 <u>win98hd.img</u> 2G
 +
[[qemu]] -hda <u>win98hd.img</u> -cdrom <u>win98.iso</u> -boot d
 +
...where <u>win98hd.img</u> is the name of your disk-image file (it can be anything) and <u>win98.iso</u> is the name of a CD ISO image (useful for installing an operating system from CD).
 +
* '''To access the image''', i.e. to read and write files to it by [[mount]]ing it as a folder, see [[accessing a disk image in Linux]]
 +
===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 &ndash; but that could be due to some configuration problem, as I haven't tried booting anything else with either of them either. --[[User:Woozle|Woozle]] 12:10, 18 February 2006 (EST)
 
===Other stuff===
 
===Other stuff===
 
The sample <u>/etc/qemu-ifup</u> file which comes with linux-test-*.tar.gz:
 
The sample <u>/etc/qemu-ifup</u> file which comes with linux-test-*.tar.gz:
 
  #!/bin/sh
 
  #!/bin/sh
 
  [[sudo]] /sbin/[[ifconfig]] $1 172.20.0.1
 
  [[sudo]] /sbin/[[ifconfig]] $1 172.20.0.1

Latest revision as of 16:26, 7 April 2006

Computing: Linux: Qemu: on Linux

This page is a seed article. You can help HTYP water it: make a request to expand a given page and/or donate to help give us more writing-hours!

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