qemu 9 and kqemu for ubuntu dapper and edgy

Open source processor emulator qemu of the 0.9′th version is out, and the new version of kqemu acceleration module is released under GPL. That is the first reason to install or to upgrade them. The second reason is current absence qemu 0.9 and kqemu packages for ubuntu edgy and dapper. And the final reason for a someone can be the kernel panic issue in the guest os runnig in qemu installed from the official ubuntu repository (happend for me only with kqemu).

You can install a packages of qemu 0.9 and kqemu for ubuntu dapper and edgy from my repository. The qemu in my repository is a packaged official binary build of qemu. And the kqemu packages are from from debian experimental repository. In addition qemu package will automaticaly initialise a recommended for qemu system parameters and will insert a kqemu modle if such is installed, after the system bootup (check /etc/init.d/qemu file), even if last is installed not from a package.

instalation

At first add my repository to /etc/apt/sources.list for edgy:

deb http://ubuntu.tolero.org/ edgy main
deb-src http://ubuntu.tolero.org/ edgy main

Or that lines if you’re running dapper (simply mepis 6.0):

deb http://ubuntu.tolero.org/ dapper main
deb-src http://ubuntu.tolero.org/ dapper main

The installation is better to do from the console package manager, rather then from the graphical one. Ensure that you have also ubuntu universe repository included to the sources.list. If so, cross your fingers and pass one by one to the console the next commands:

  1. sudo aptitude update
  2. sudo aptitude install kqemu-common kqemu-source
  3. sudo aptitude install module-assistant
  4. sudo m-a prepare
  5. sudo m-a build kqemu
  6. sudo m-a install kqemu
  7. sudo aptitude install qemu

The commands from 4 to 6 will install a kernel headers, compiller and other assistant packages, will build a kqemu-modules package for your kernel version package and install it. If all ok - the all is done.

41 Comments

  1. Michael Moore:

    Awesome! It all installed correctly. :-)

    Two questions:
    1) Why not combine steps 2 & 3 — both are just install operations

    2) The light gray text of your code sections is very hard to read against the white background. It’s pretty, but hard to read. Any chance of changing up the CSS a tiny bit so that it’s either light on dark or vice versa?

  2. Tolero:

    Thanx for your comment.

    The first point, right now as is just because it will not fit at one line in current blog design.

    And for the second point, yes. I am not very happy with the current design. It is just a default one. I am currently collecting opinions, like your’s, about the things to pay attention to when I’ll decide to change it.

  3. Mr. Pink:

    Does your package add udev rule for kqemu? Like this:
    http://felipe-alfaro.org/blog/2007/02/08/qemu-kqemu-and-udev/

  4. Tolero:

    It creates the /etc/init.d/qemu script which does the same job. The script manually checks for kqemu.ko file, does insmod on it, creates the /dev/kqemu device and sets a+rw permissions.

  5. Darrell:

    Thanks this worked but it complains about access to /dev/kqemu

    after I run qemu -boot d -hda winxp.img -cdrom /dev/cdrom -m 192 -localtime

    I get this when I close the qemu

    Could not open ‘/dev/kqemu’ - QEMU acceleration layer not activated

    but it does boot and install the OS.

    Thanks,

    Darrell

  6. Tolero:

    @Darrell
    Reason 1: kqemu module is not loaded or a device is not created
    Solution: execute

    sudo /etc/init.d/qemu stop
    sudo /etc/init.d/qemu start

    Reason 2: kqemu module is not well compiled or installed.
    Check: does the next three commands pass without errors?

    sudo m-a prepare
    sudo m-a build kqemu
    sudo m-a install kqemu

  7. eia:

    I get errors with these commands:

    sudo m-a prepare
    sudo m-a build kqemu
    sudo m-a install kqemu

    but i tried running apt-get install qemu, and it starts to download, will it not work because of the 3 commands not being successful

  8. Tolero:

    @eia

    Qemu will work without kqume module but very slooow.

    What are the errors when you execute these commands?

    Did you executed the command

    sudo aptitude install module-assistant

    and what is the result?

  9. eia:

    here’s the error for the 3 commands:

    sudo: m: command not found

    I Tried this one –> sudo aptitude install module-assistant, it was ok.

  10. eia:

    Your right, its to slow, how can i install kqemu,

    the ff commands were not recognized:
    sudo m-a prepare
    sudo m-a build kqemu
    sudo m-a install kqemu

  11. Tolero:

    @eia

    Hmm… That is a quite strange output: “sudo: m: command not found”… Should be at least “sudo: m-a: command not found”. See the difference? It is just in m and m-a. Check, that you have no space between m and -a. You can also try to use module-assistant instead m-a, so the commands will be:

    sudo module-assistant prepare
    sudo module-assistant build kqemu
    sudo module-assistant install kqemu

  12. eia:

    I run the this command:
    sudo aptitude install module-assistant

    I receive these:

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Reading extended state information
    Initializing package states… Done
    Building tag database… Done
    No candidate version found for module-assistant
    0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0B of archives. After unpacking 0B will be used.
    Writing extended state information… Done

  13. Tolero:

    @eia

    Aha! Module assistant is at the universe repository. Check that it is included in /etc/apt/sources.list. I’ve pointed that at the instruction, but not concentrated an attention on it.

  14. eia:

    im sorry for that , i guessed didn’t notice the errors, the ‘update’ was never complete…

    but again, i received these:

    sudo aptitude install kqemu
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Reading extended state information
    Initializing package states… Done
    Building tag database… Done
    Couldn’t find package “kqemu”. However, the following
    packages contain “kqemu” in their name:
    kqemu-common kqemu-source
    0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0B of archives. After unpacking 0B will be used.

  15. eia:

    I RECEIVED THESE
    qemu -cdrom /dev/cdrom -hda c.img -m 256 -boot d

    ———————- DirectFB v0.9.24 ———————
    (c) 2000-2002 convergence integrated media GmbH
    (c) 2002-2004 convergence GmbH
    ———————————————————–

    (*) DirectFB/Core: Single Application Core. (2006-10-13 15:40)
    (*) Direct/Memcpy: Using MMXEXT optimized memcpy()
    (!) Direct/Util: opening ‘/dev/fb0′ failed
    –> No such device
    (!) DirectFB/FBDev: Error opening framebuffer device!
    (!) DirectFB/FBDev: Use ‘fbdev’ option or set FRAMEBUFFER environment variable.
    (!) DirectFB/Core: Could not initialize ’system’ core!
    –> Initialization error!
    Could not initialize SDL - exiting

  16. Tolero:

    No, not sudo aptitude install kqemu. Just execute lines 3, 4, 5, 6 from the instruction. If got no errors, the simpliest is to reboot the machine.

    After reboot check that file /dev/kqemu exists. That means that all is done properly.

    Just for the note: there is no kqemu package, it is compiled from kqemu-sorce package. And you have always to build it if a new (or updated) linux kernell installed.

  17. Tolero:

    Are you trying to run qemu from a text console or on the server?

    If you’re on a server, you have to work through an serial port emulation (but no graphics will be), or you have to forward a video output through vnc session. I’m not familar with bot of them, and can’t help there.

    If you’re running qemu from a text console, just install a libdirectfb-0.9-24 package, and probably reboot to get a /dev/fb0 device.

  18. eia:

    apt-get install libdirectfb-0.9-24

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    libdirectfb-0.9-24 is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 156 not upgraded.

    after these i received this error again :

    qemu -cdrom /dev/cdrom -hda c.img -m 256 -boot d

    ———————- DirectFB v0.9.24 ———————
    (c) 2000-2002 convergence integrated media GmbH
    (c) 2002-2004 convergence GmbH
    ———————————————————–

    (*) DirectFB/Core: Single Application Core. (2006-10-13 15:40)
    (*) Direct/Memcpy: Using MMXEXT optimized memcpy()
    (!) Direct/Util: opening ‘/dev/fb0′ failed
    –> No such device
    (!) DirectFB/FBDev: Error opening framebuffer device!
    (!) DirectFB/FBDev: Use ‘fbdev’ option or set FRAMEBUFFER environment variable.
    (!) DirectFB/Core: Could not initialize ’system’ core!
    –> Initialization error!
    Could not initialize SDL - exiting

  19. Tolero:

    @eia
    Sorry, that is out of my knowledge :(

  20. eia:

    how can i remove qemu + kqemu, i want to redo all the steps. ARe there other ways to install? I really need to run WIndows XP inside qemu.

    Thanks

  21. Tolero:

    @eia:

    At first get a list of all related packages:

    sudo dpkg -l "*qemu*"

    And purge them all with dpkg. In my case that is:

    sudo dpkg --purge qemu kqemu-source \
        kqemu-modules-2.6.17-11-generic \
        kqemu-modules-2.6.17-11-386 \
        kqemu-modules \
        kqemu-common

  22. nagercoin:

    When I try to install module-assistant, the aptitude says that’s not a candidate to be installed

  23. Tolero:

    @nagercoin:
    Probably you’re also missed reqirenment for a ubuntu universe repository to be included.

  24. zythos:

    Everything compiled with no errors and I’ve rebooted my machine, but there is no kqemu script in /etc/init.d/ and after reboot no /dev/kqemu
    The module is there, but no device

  25. Tim:

    i have a /dev/kqemu file. now i want to start kqemu. how do i do this? do i need to start it from the command line with options? or can i somehow start a gui that will let me setup the virtualization?

  26. Tolero:

    @zythos:
    At the /etc/init.d/ should be qemu script, which will change the flags at the linux kernel and init the kqemu module. Also check the output of the command:

    dpkg -L qemu | grep "init.d"

    Is the init script listed there? If not, you’ve installed something not from my repository.

  27. Tolero:

    @Tim:
    Qemu itself doesn’t provide a graphical interface. You can try external launchers for it from the qemu-launcher or qemuctl packages. They can help much to start using qemu quickly.

  28. greywinters:

    Everything went swimmingly - I am about to try it out. But I got the following warning when I ran “sudo aptitude install kqemu-common kqemu-source”:

    WARNING: untrusted versions of the following packages will be installed!

    Untrusted packages could compromise your system’s security.
    You should only proceed with the installation if you are certain that
    this is what you want to do.

    kqemu-common kqemu-source

    Do you want to ignore this warning and proceed anyway?
    To continue, enter “Yes”; to abort, enter “No”: yes

    I got a similar warning when I tried to install qemu.

    Otherwise, this page is awesome! Thanks!

  29. Tolero:

    @greywinters:
    Quite pertinent note from the aptitude. I don’t make a promise that these packages are fully faultless. But I glad that much of users have had to setup qemu from my repository well.

  30. Steve:

    thanks for this great tutorial, works fine! tried to install a qemu-ed windows XP without your kqemu-tutorial and it lagged like hell, now it’s nice and smooth - great work!

  31. SuzyQ:

    I get this error when i use the m-a prepare command please help!

    m-a prepare
    Getting source for kernel version: 2.6.17-11-generic
    Kernel headers available in /lib/modules/2.6.17-11-generic/build
    apt-get install build-essential
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.

    Since you only requested a single operation it is extremely likely that
    the package is simply not installable and a bug report against
    that package should be filed.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    build-essential: Depends: libc6-dev but it is not going to be installed or
    libc-dev
    Depends: g++ (>= 4:4.1.1) but it is not going to be installed
    E: Broken packages

    Done!

  32. SuzyQ:

    get a failure on this command too m-a build kqemu
    and
    m-a install kqemu

    but this probable because the prepare command didn’t work

    sorry im sort of a noob
    I have been running Ubuntu Edgy for about 5 months.

  33. Tolero:

    @SuzyQ
    Looks like you have no main repository listed in the /etc/apt/sources.list

  34. SuzyQ:

    How do I put a main repository in /etc/apt/sources.list? I know how to add a repository in synaptic package manager…… Hey at least I’m learning!

  35. Tolero:

    @SuzyQ
    It is quite the same. Check for the main repository at the synaptic.

  36. Lurchgs:

    I, too, am experiencing SuzyQ’s problem. The ’sudo m-a prepare’ went off without a hitch (or so it said). ’sudo m-a build kqemu’ blows up. The build file is pretty useless (just the start time).

    The command line has the following:

    lurch@Eve:/tmp$ sudo m-a build kqemu
    The source tarball could not be found!
    Package kqemu-source not installed?
    Running "m-a -f get kqemu-source" may help.
    find: /usr/src/modules: No such file or directory

    I’m in /tmp with kqemu-1.3.0pre11.tar

    Trying m-a get. gets me:

    lurch@Eve:/tmp$ sudo m-a -f get kqemu-source
    Reading package lists... Done
    Building dependency tree... Done
    E: Couldn't find package kqemu-source

    Updated infos about 1 packages

    I have your repository in apt sources list:

    deb http://ubuntu.tolero.org/ dapper main
    deb-src http://ubuntu.tolero.org/ dapper main

    did I miss something?

  37. Lurchgs:

    For the life of me, I have no idea what’s different. I got frustrated with trying to install and get kqemu last night [again!]. This morning, I came downstairs and (because I can be lazy) used the history on my Ubuntu 6 machine to try again… and it went off without a hitch.

  38. Barry:

    Everything installed smoothly, but when I put in:

    qemu -boot c -hda winxp.img -m 512 -localtime

    I get this:

    ‘/dev/kqemu’ - QEMU acceleration layer not activated

    I’ve read the above replies, and for the life of me I can’t seem to get this working. I’m a newb for linux, and step by step instructions on what to do to get kqemu working would be greatly appreciated! Thanks! :)

  39. LarsR:

    Barry, check out the bug described in

    /dev/kqemu is not created by udev
    https://bugs.launchpad.net/ubuntu/+source/kqemu/+bug/105933

    It solved it for me…
    I did

    echo ‘KERNEL==”kqemu”, NAME=”%k”, MODE=”0666″‘ >> /etc/udev/rules.d/90-kqemu.rules

    mv /etc/modprobe.d/kqemu /etc/modprobe.d/disabled-kqemu

  40. Daniel:

    You may need to sudo qemu -boot c ……….. if kqemu doesn’t have the correct permissions set up .

    have a look at this

    https://help.ubuntu.com/community/WindowsXPUnderQemuHowTo

    hope it helps

  41. Rafa:

    Would you be so kind as to include a Feisty repository for qemu? Thanks in advance

Leave a comment