Qemu is running without kvm acceleration in maverick

Bug #695825 reported by Neil Hunt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qemu-kvm (Ubuntu)
Won't Fix
Wishlist
Unassigned

Bug Description

Binary package hint: qemu-kvm

1. Ubuntu 10.10 Maverick
2. qemu-kvm 12.5
3. We are supposed to be able to run guests on a 64-bit Linux at up to 512gb of ram, and I am only trying to run it with 8gb of ram and it is failing.

When I'm trying to launch a VM with more than 4gb RAM, I receive the error message:

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 814, in run_domain
    vm.startup()
  File "/usr/share/virt-manager/virtManager/domain.py", line 1296, in startup
    self._backend.create()
  File "/usr/lib/python2.6/dist-packages/libvirt.py", line 333, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error process exited while connecting to monitor: char device redirected to /dev/pts/5
qemu: without kvm support at most 4095 MB RAM can be simulated

I have the packages qemu-kvm, libvirt-bin, and virt-manager installed from apt.

I see something about a patch being applied to qemu 12.0 that addresses this exact message, but the Ubuntu package qemu-kvm is 12.5 so it should be fixed?
http://www.spinics.net/lists/kvm/msg30336.html

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for reporting this bug and helping to make Ubuntu better.

I don't have the qemu git history handy at the moment, but looking at the maverick package, based on the 0.12.5 source, the 'correct fix' is not yet applied there.

Changed in qemu-kvm (Ubuntu):
status: New → Won't Fix
importance: Undecided → Wishlist
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Please note that running with kvm acceleration, you will be able to give guests more memory.

Revision history for this message
Neil Hunt (nwhunt) wrote : Re: [Bug 695825] Re: Ubuntu KVM error with guest memory >4gb ram

Sean,

how can I enable KVM Acceleration? I am actually getting very poor
performance from Ubuntu KVM at the moment. Running on a 24-core server
with 64gb ram, but my guests are running very slowly. Is there
anything I can do to improve this? Also, if I enable this somehow,
does this fix the 4gb ram limit or do I need to apply a patch?

On Mon, Jan 3, 2011 at 11:26 AM, Serge Hallyn <email address hidden> wrote:
> Please note that running with kvm acceleration, you will be able to give
> guests more memory.
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/695825
>
> Title:
>  Ubuntu KVM error with guest memory >4gb ram
>
> Status in “qemu-kvm” package in Ubuntu:
>  Won't Fix
>
> Bug description:
>  Binary package hint: qemu-kvm
>
> 1. Ubuntu 10.10 Maverick
> 2. qemu-kvm 12.5
> 3. We are supposed to be able to run guests on a 64-bit Linux at up to 512gb of ram, and I am only trying to run it with 8gb of ram and it is failing.
>
> When I'm trying to launch a VM with more than 4gb RAM, I receive the error message:
>
> Traceback (most recent call last):
>  File "/usr/share/virt-manager/virtManager/engine.py", line 814, in run_domain
>    vm.startup()
>  File "/usr/share/virt-manager/virtManager/domain.py", line 1296, in startup
>    self._backend.create()
>  File "/usr/lib/python2.6/dist-packages/libvirt.py", line 333, in create
>    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
> libvirtError: internal error process exited while connecting to monitor: char device redirected to /dev/pts/5
> qemu: without kvm support at most 4095 MB RAM can be simulated
>
> I have the packages qemu-kvm, libvirt-bin, and virt-manager installed from apt.
>
> I see something about a patch being applied to qemu 12.0 that addresses this exact message, but the Ubuntu package qemu-kvm is 12.5 so it should be fixed?
> http://www.spinics.net/lists/kvm/msg30336.html
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/695825/+subscribe
>

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Quoting Neil Hunt (<email address hidden>):
> Sean,
>
> how can I enable KVM Acceleration? I am actually getting very poor
> performance from Ubuntu KVM at the moment. Running on a 24-core server
> with 64gb ram, but my guests are running very slowly. Is there

Ah, then the two most likely problems are that (a) it is turned off
in the bios, or (b) the xml is defined to not use it. To check for (b),
if you do 'virsh edit <domainname>', make sure the emulator line is
 <emulator>/usr/bin/kvm</emulator>
and not
 <emulator>/usr/bin/qemu</emulator>

Also either check the bios settings, or you can use the program 'sudo kvm-ok'.
If it says 'KVM acceleration can be used', then the bios is not the problem.

> anything I can do to improve this? Also, if I enable this somehow,
> does this fix the 4gb ram limit or do I need to apply a patch?

Yes, enabling kvm acceleration will remove the 4Gb limit for you.

-serge

Revision history for this message
Neil Hunt (nwhunt) wrote : Re: Ubuntu KVM error with guest memory >4gb ram

I checked (a) and indeed it is enabled (receive "KVM acceleration can be used"). However, each of the virtual machines had <emulator>/usr/bin/qemu-system-x86_64</emulator>. I changed several of them to <emulator>/usr/bin/kvm</emulator>, restarted the VMs, however, the performance is still dismal and I'm also still getting the error when setting RAM >4gb, not letting me set the RAM above that amount. I run essentially the same VM on my MacBook with 2 core and 4gb ram using VirtualBox, allocating only 1gb ram to the guest, and it flies where this KVM is excruciatingly slow. Any other thoughts?

Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 695825] Re: Ubuntu KVM error with guest memory >4gb ram

Quoting Neil Hunt (<email address hidden>):
> I checked (a) and indeed it is enabled (receive "KVM acceleration can be
> used"). However, each of the virtual machines had <emulator>/usr/bin
> /qemu-system-x86_64</emulator>. I changed several of them to
> <emulator>/usr/bin/kvm</emulator>, restarted the VMs, however, the
> performance is still dismal and I'm also still getting the error when
> setting RAM >4gb, not letting me set the RAM above that amount. I run
> essentially the same VM on my MacBook with 2 core and 4gb ram using
> VirtualBox, allocating only 1gb ram to the guest, and it flies where
> this KVM is excruciatingly slow. Any other thoughts?

Odd. When you do:

 kvm -monitor stdio -vnc :1

and then on the terminal type 'info kvm', does it also say 'kvm support:
enabled'? Could you give the result of:

 ls -l /dev/kvm
 grep kvm /etc/group
 grep libvirt /etc/group
 grep qemu /etc/group

and the contenets of /var/log/libvirt/qemu/X.log where X is the name of
a vm you've been starting with libvirt?

summary: - Ubuntu KVM error with guest memory >4gb ram
+ Qemu is running without kvm acceleration in maverick
Revision history for this message
Neil Hunt (nwhunt) wrote :
Download full text (3.1 KiB)

Results of commands (all run as root):

nwhunt@fluke:~$ sudo kvm -monitor stdio -vnc :1
pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
inet_listen_opts: bind(ipv4,0.0.0.0,5901): Address already in use
inet_listen_opts: FAILED

nwhunt@fluke:~$ sudo ls -l /dev/kvm
crw-rw---- 1 root kvm 10, 232 2011-01-03 23:22 /dev/kvm

nwhunt@fluke:~$ grep kvm /etc/group
kvm:x:110:

nwhunt@fluke:~$ grep libvirt /etc/group
libvirtd:x:111:

nwhunt@fluke:~$ grep qemu /etc/group
(nothing returned)

Contents of /var/log/libvirt/qemu/UbuntuServier-10.10-maverick.log.1:

LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin QEMU_AUDIO_DRV=none /usr/bin/qemu-system-x86_64 -S -M pc-0.12 -no-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name UbuntuServer-10.10-maverick -uuid d275d6d3-7e96-43c3-b50f-cb5a061ab44c -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/UbuntuServer-10.10-maverick.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -no-reboot -boot c -drive file=/var/lib/libvirt/images/UbuntuServer-10.10-maverick.img,if=none,id=drive-ide0-0-0,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -device rtl8139,vlan=0,id=net0,mac=52:54:00:74:7c:58,bus=pci.0,addr=0x3 -net tap,fd=65,vlan=0,name=hostnet0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device AC97,id=sound0,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
char device redirected to /dev/pts/0
qemu: could not open disk image /var/lib/libvirt/images/UbuntuServer-10.10-maverick.img: No such file or directory
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin QEMU_AUDIO_DRV=none /usr/bin/qemu-system-x86_64 -S -M pc-0.12 -no-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name UbuntuServer-10.10-maverick -uuid d275d6d3-7e96-43c3-b50f-cb5a061ab44c -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/UbuntuServer-10.10-maverick.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -no-reboot -boot c -drive file=/var/lib/libvirt/images/UbuntuServer-10.10-maverick.img,if=none,id=drive-ide0-0-0,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -device rtl8139,vlan=0,id=net0,mac=52:54:00:74:7c:58,bus=pci.0,addr=0x3 -net tap,fd=65,vlan=0,name=hostnet0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device AC97,id=sound0,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
char device redirected to /dev/pts/0
qemu: could not open disk image /var/lib/libvirt/images/UbuntuServer-10.10-maverick.img: No s...

Read more...

Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 695825] Re: Qemu is running without kvm acceleration in maverick

Quoting Neil Hunt (<email address hidden>):
> Results of commands (all run as root):
>
> nwhunt@fluke:~$ sudo kvm -monitor stdio -vnc :1
> pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
> inet_listen_opts: bind(ipv4,0.0.0.0,5901): Address already in use
> inet_listen_opts: FAILED

Drat. could you try

 sudo kvm -monitor stdio -vnc :11

> nwhunt@fluke:~$ sudo ls -l /dev/kvm
> crw-rw---- 1 root kvm 10, 232 2011-01-03 23:22 /dev/kvm
>
> nwhunt@fluke:~$ grep kvm /etc/group
> kvm:x:110:
>
> nwhunt@fluke:~$ grep libvirt /etc/group
> libvirtd:x:111:
>
> nwhunt@fluke:~$ grep qemu /etc/group
> (nothing returned)

Hm, please edit /etc/group and add your username (nwhunt) at the
end of the kvm and libvirt lines, i.e. make them:

kvm:x:110:nwhunt
libvirtd:x:111:nwhunt

Revision history for this message
Neil Hunt (nwhunt) wrote :

ok that is done. Yes it says KVM enabled under the kvm -monitor.

I have added my username (I used "administrator", rather than "nwhunt"). What should I try now?

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Quoting Neil Hunt (<email address hidden>):
> ok that is done. Yes it says KVM enabled under the kvm -monitor.
>
> I have added my username (I used "administrator", rather than "nwhunt").
> What should I try now?

Try again to start one of the VMs through libvirt for which you had
changed the <emulator> line to /usr/bin/kvm. Hopefully it'll now be
running with acceleration.

Revision history for this message
Neil Hunt (nwhunt) wrote :

OK - I figured it out! In addition to <emulator>/usr/bin/kvm</emulator> change needing to be made, the actual root node <domain> was
<domain type='qemu'>
I changed to
<domain type='kvm'>

and suddenly I could have as much RAM as I wanted, and my VMs started flying!

Now as to why they defaulted to qemu domains rather than kvm, that's something I'll have to look into later, but at least I'm up and running! Hope this helps someone else in the future.

Serge, thanks for all your help.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Great - thanks for letting us know how it got fixed, Neil!

Revision history for this message
Neil Hunt (nwhunt) wrote : Quick Favor?

Hey,

I just signed the petition "Julius Jones is innocent. Don't let him be
executed by the state of Oklahoma." and wanted to see if you could help by
adding your name.

Our goal is to reach 7,500,000 signatures and we need more support. You can
read more and sign the petition here:

https://chng.it/n2kqmpfxgD

Thanks!
Neil

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.