[libvirt-users] qemu-monitor-command

Hello Everyone, I am working on a grad school project for virtual introspection. I have a vm running (with 512mb of memory) and want to access the pmemsave function through virsh with the qemu-monitor-command. I am typing the following: virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912 image.dump' Shawn is the name of my vm and image.dump is the name of my output file. No matter what I do, I keep getting: Could not open 'image.dump' I have tried the above with sudo and with the absolute path of where the newly created dump file should go and I still get that error. Any help is appreciated as to how I should enter this command. If I type in virsh qemu-monitor-command --hmp Shawn 'info mem' or any other command without an output path, it works fine and brings up information about my running vm. Regards, Shawn

On 20.03.2012 14:30, Shawn Davis wrote:
Hello Everyone,
I am working on a grad school project for virtual introspection. I have a vm running(with 512mb of memory) and want to access the pmemsave function through virsh with the qemu-monitor-command. I am typing the following:
virsh qemu-monitor-command --hmp Shawn ‘pmemsave 0 536870912 image.dump’
Shawn is the name of my vm and image.dump is the name of my output file. No matter what I do, I keep getting: Could not open ‘image.dump’
I have tried the above with sudo and with the absolute path of where the newly created dump file should go and I still get that error. Any help is appreciated as to how I should enter this command.
If I type in virsh qemu-monitor-command --hmp Shawn ‘info mem’ or any other command without an output path, it works fineand brings up information about my running vm.
Regards,
Shawn
I guess qemu can't access the path you are trying, esp. when you run it without root privileges. However, you can use virDomainMemoryPeek() instead. Michal

On 03/20/2012 07:30 AM, Shawn Davis wrote:
Hello Everyone,
I am working on a grad school project for virtual introspection. I have a vm running (with 512mb of memory) and want to access the pmemsave function through virsh with the qemu-monitor-command.
Why? I would just access it through the public API virDomainMemoryPeek instead, then you don't have to worry about the nuances. Alas, virDomainMemoryPeek has not yet been wired into virsh (patches welcome!), so you'll have to access it through a custom C program, or through one of the other language bindings such as python or perl.
virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912 image.dump'
Shawn is the name of my vm and image.dump is the name of my output file. No matter what I do, I keep getting: Could not open 'image.dump'
That's because when you do raw pass-through like this, you are asking qemu to open the relative pathname 'image.dump', relative to the current working directory of qemu, which isn't necessarily the current working directory of your virsh process. Furthermore, if you are accessing a remote connection (such as -c qemu+ssh://remote/system), the file name is relative to the remote system, but you probably want the file to appear on the machine where you are running virsh. Finally, if SELinux is in effect, you have to ensure that qemu has proper permissions, including SELinux label, to open() the file; this is something that libvirt can do for you via the virDomainMemoryPeek API, but if you go through qemu-monitor-command, you are on your own. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Thanks guys. I will check out the virDomainMemoryPeek api. I am still curious though as to how to get the monitor command to work. I am running it on the same physical host as the vm so it is not remote. What would be an example of a path that one of you has gotten to work? I have tried many path forms and get the same Could not open ... error message. Thanks, Shawn -----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Tuesday, March 20, 2012 10:09 AM To: Shawn Davis Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] qemu-monitor-command On 03/20/2012 07:30 AM, Shawn Davis wrote:
Hello Everyone,
I am working on a grad school project for virtual introspection. I have a vm running (with 512mb of memory) and want to access the pmemsave function through virsh with the qemu-monitor-command.
Why? I would just access it through the public API virDomainMemoryPeek instead, then you don't have to worry about the nuances. Alas, virDomainMemoryPeek has not yet been wired into virsh (patches welcome!), so you'll have to access it through a custom C program, or through one of the other language bindings such as python or perl.
virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912 image.dump'
Shawn is the name of my vm and image.dump is the name of my output file. No matter what I do, I keep getting: Could not open 'image.dump'
That's because when you do raw pass-through like this, you are asking qemu to open the relative pathname 'image.dump', relative to the current working directory of qemu, which isn't necessarily the current working directory of your virsh process. Furthermore, if you are accessing a remote connection (such as -c qemu+ssh://remote/system), the file name is relative to the remote system, but you probably want the file to appear on the machine where you are running virsh. Finally, if SELinux is in effect, you have to ensure that qemu has proper permissions, including SELinux label, to open() the file; this is something that libvirt can do for you via the virDomainMemoryPeek API, but if you go through qemu-monitor-command, you are on your own. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

I understood what was said by the way about the permissions. I temporarily switched off SElinux. I think I just may not be entering the command correctly. If I put home/testa/image.dump I get Could not open 'image.dump' If I put /home/testa/image.dump I get Invalid char in expression from the first slash. Can someone who has gotten this to work please tell me how they typed out the entire command in full detail? I don't really care where it saves it, I just need the dump of the memory. I have tried this with various forms of the path: sudo virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912 image.dump' Regards, Shawn -----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Tuesday, March 20, 2012 10:09 AM To: Shawn Davis Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] qemu-monitor-command On 03/20/2012 07:30 AM, Shawn Davis wrote:
Hello Everyone,
I am working on a grad school project for virtual introspection. I have a vm running (with 512mb of memory) and want to access the pmemsave function through virsh with the qemu-monitor-command.
Why? I would just access it through the public API virDomainMemoryPeek instead, then you don't have to worry about the nuances. Alas, virDomainMemoryPeek has not yet been wired into virsh (patches welcome!), so you'll have to access it through a custom C program, or through one of the other language bindings such as python or perl.
virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912 image.dump'
Shawn is the name of my vm and image.dump is the name of my output file. No matter what I do, I keep getting: Could not open 'image.dump'
That's because when you do raw pass-through like this, you are asking qemu to open the relative pathname 'image.dump', relative to the current working directory of qemu, which isn't necessarily the current working directory of your virsh process. Furthermore, if you are accessing a remote connection (such as -c qemu+ssh://remote/system), the file name is relative to the remote system, but you probably want the file to appear on the machine where you are running virsh. Finally, if SELinux is in effect, you have to ensure that qemu has proper permissions, including SELinux label, to open() the file; this is something that libvirt can do for you via the virDomainMemoryPeek API, but if you go through qemu-monitor-command, you are on your own. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 21.03.2012 04:43, Shawn Davis wrote:
I understood what was said by the way about the permissions. I temporarily switched off SElinux. I think I just may not be entering the command correctly. If I put home/testa/image.dump I get Could not open 'image.dump' If I put /home/testa/image.dump I get Invalid char in expression from the first slash. Can someone who has gotten this to work please tell me how they typed out the entire command in full detail? I don't really care where it saves it, I just need the dump of the memory.
If qemu is running under non-root user I wouldn't expect it to be able to access $HOME.
I have tried this with various forms of the path:
sudo virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912 image.dump'
Although I must admit this doesn't play nice. I can get two different results: virsh # qemu-monitor-command --hmp f16 "pmemsave 0 1024 /tmp/dummy.img" invalid char in expression virsh # qemu-monitor-command f16 '{"execute":"pmemsave", "arguments": {"val":0, "size":1024, "filename":"/tmp/dummy.img"}}' {"return":{},"id":"libvirt-12"} In the latter case image is successfully created. But I am not sure whose bug is it - libvirt or qemu. Michal

Hi Michal, Thanks for testing that for me. When I try to run the latter command which was: virsh qemu-monitor-command Shawn '{"execute":"pmemsave", "arguments": {"val":0, "size":536870912, "filename":"/tmp/testimage.dump"}}' I get: Unknown command: '{\"execute\":\"pmemsave\",' Any ideas? My versions are: Compiled against library: libvir 0.9.2 Using library: libvir 0.9.2 Using API: QEMU 0.9.2 Running hypervisor: QEMU 0.14.1 -----Original Message----- From: Michal Privoznik [mailto:mprivozn@redhat.com] Sent: Wednesday, March 21, 2012 3:21 AM To: Shawn Davis Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] qemu-monitor-command On 21.03.2012 04:43, Shawn Davis wrote:
I understood what was said by the way about the permissions. I temporarily switched off SElinux. I think I just may not be entering the command correctly. If I put home/testa/image.dump I get Could not open 'image.dump' If I put /home/testa/image.dump I get Invalid char in expression from the first slash. Can someone who has gotten this to work please tell me how they typed out the entire command in full detail? I don't really care where it saves it, I just need the dump of the memory.
If qemu is running under non-root user I wouldn't expect it to be able to access $HOME.
I have tried this with various forms of the path:
sudo virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912 image.dump'
Although I must admit this doesn't play nice. I can get two different results: virsh # qemu-monitor-command --hmp f16 "pmemsave 0 1024 /tmp/dummy.img" invalid char in expression virsh # qemu-monitor-command f16 '{"execute":"pmemsave", "arguments": {"val":0, "size":1024, "filename":"/tmp/dummy.img"}}' {"return":{},"id":"libvirt-12"} In the latter case image is successfully created. But I am not sure whose bug is it - libvirt or qemu. Michal

On 03/21/2012 08:49 AM, Shawn Davis wrote:
Hi Michal,
Thanks for testing that for me.
When I try to run the latter command which was:
virsh qemu-monitor-command Shawn '{"execute":"pmemsave", "arguments": {"val":0, "size":536870912, "filename":"/tmp/testimage.dump"}}'
I get:
Unknown command: '{\"execute\":\"pmemsave\",'
Any ideas?
Your qemu is old enough that it isn't running the QMP monitor, so you can only pass HMP commands. It may be worth upgrading to a newer qemu.
My versions are:
Compiled against library: libvir 0.9.2 Using library: libvir 0.9.2 Using API: QEMU 0.9.2 Running hypervisor: QEMU 0.14.1
I think we didn't turn on QMP until 0.15; and now 1.0 is out. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

I installed qemu 1.0 from source from the qemu site and all of the dependencies it needed. I rebooted my system and now if I type virsh version I get: Compiled against library: libvir 0.9.2 Using library: libvir 0.9.2 Using API: QEMU 0.9.2 Error: failed to get the hypervisor version Error: internal error Cannot find suitable emulator for x86_64 If I try to launch my vm now I get: virsh -c qemu:///system start Shawn error: Failed to get domain 'Shawn' error: Domain not found: no domain with matching name 'Shawn' virsh uri qemu:///system If I run: Sudo libvirtd start I get: 12:37:48.742: 2886: info : libvirt version: 0.9.2 12:37:48.742: 2886: error : qemudWritePidFile:532 : Failed to open pid file '/var/run/libvirtd.pid' : File exists Ps -ef | grep libvirtd Root 1049 1 0 12:10 ? 00:00:00 /usr/sbin/libvirtd -d Testa 2925 1897 0 12:43 pts/0 00:00:00 grep --color=auto libvirtd It appears my libvirt isn't finding qemu. Any ideas on how to fix? Thanks, Shawn -----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Wednesday, March 21, 2012 9:56 AM To: Shawn Davis Cc: 'Michal Privoznik'; libvirt-users@redhat.com Subject: Re: [libvirt-users] qemu-monitor-command On 03/21/2012 08:49 AM, Shawn Davis wrote:
Hi Michal,
Thanks for testing that for me.
When I try to run the latter command which was:
virsh qemu-monitor-command Shawn '{"execute":"pmemsave", "arguments": {"val":0, "size":536870912, "filename":"/tmp/testimage.dump"}}'
I get:
Unknown command: '{\"execute\":\"pmemsave\",'
Any ideas?
Your qemu is old enough that it isn't running the QMP monitor, so you can only pass HMP commands. It may be worth upgrading to a newer qemu.
My versions are:
Compiled against library: libvir 0.9.2 Using library: libvir 0.9.2 Using API: QEMU 0.9.2 Running hypervisor: QEMU 0.14.1
I think we didn't turn on QMP until 0.15; and now 1.0 is out. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

[please don't top-post on technical lists] On 03/21/2012 11:45 AM, Shawn Davis wrote:
I installed qemu 1.0 from source from the qemu site and all of the dependencies it needed. I rebooted my system and now if I type virsh version I get:
Compiled against library: libvir 0.9.2 Using library: libvir 0.9.2 Using API: QEMU 0.9.2 Error: failed to get the hypervisor version Error: internal error Cannot find suitable emulator for x86_64
Older libvirt had a bug where it wouldn't parse qemu 1.0 version (the change from 3 digits to 2 confused the older libvirt). If you're going to go with self-built qemu, you might also want to try self-built libvirt 0.9.10. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Wed, Mar 21, 2012 at 1:48 PM, Eric Blake <eblake@redhat.com> wrote:
[please don't top-post on technical lists]
On 03/21/2012 11:45 AM, Shawn Davis wrote:
I installed qemu 1.0 from source from the qemu site and all of the dependencies it needed. I rebooted my system and now if I type virsh version I get:
Compiled against library: libvir 0.9.2 Using library: libvir 0.9.2 Using API: QEMU 0.9.2 Error: failed to get the hypervisor version Error: internal error Cannot find suitable emulator for x86_64
Older libvirt had a bug where it wouldn't parse qemu 1.0 version (the change from 3 digits to 2 confused the older libvirt). If you're going to go with self-built qemu, you might also want to try self-built libvirt 0.9.10.
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not finding the following: testa@testaT4:~$ virsh list virsh: /usr/lib/libvirt-qemu.so.0: version `LIBVIRT_QEMU_0.9.4' not found (required by virsh) virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_0.9.10' not found (required by virsh) virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_0.9.9' not found (required by virsh) virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_0.9.7' not found (required by virsh) virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_0.9.8' not found (required by virsh) virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_0.9.3' not found (required by virsh) virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_0.9.5' not found (required by virsh) virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_PRIVATE_0.9.10' not found (required by virsh) virsh: /usr/lib/libvirt.so.0: version `LIBVIRT_0.9.4' not found (required by virsh) I can't install qemu 1.0 and libvirt 0.9.10 through apt right? I assume I had to get them from source. Anyways, please let me know how I can get virsh to see that I have 0.9.10. Once I get this working and can run that monitor command I will be in good shape. Thanks! Shawn

On 03/21/2012 02:58 PM, Shawn Davis wrote:
Older libvirt had a bug where it wouldn't parse qemu 1.0 version (the change from 3 digits to 2 confused the older libvirt). If you're going to go with self-built qemu, you might also want to try self-built libvirt 0.9.10.
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not finding the following:
testa@testaT4:~$ virsh list virsh: /usr/lib/libvirt-qemu.so.0: version `LIBVIRT_QEMU_0.9.4' not found (required by virsh)
Ouch - you've now got version mismatch, where you didn't completely uninstall the distro version, and your self-built version is installed in locations that pick up the distro version. Did you use the right configure flags?
I can't install qemu 1.0 and libvirt 0.9.10 through apt right?
Ah, apt - are you on debian or ubuntu? I don't know as much about the versions that those distros are using (I'm personally using Fedora 16, along with the fedora-virt-preview repo, which gives 0.9.10 pre-built).
I assume I had to get them from source. Anyways, please let me know how I can get virsh to see that I have 0.9.10. Once I get this working and can run that monitor command I will be in good shape.
There might be someone already shipping a pre-built 0.9.10 apt, but I wouldn't know where to tell you to look, so building from source is the other alternative. If you build from libvirt.git, you can use './autobuild.sh --system' to help set the ./configure options that match with the typical installation directories for at least Fedora, but again, I don't know how that fares with the debian installation layout (and patches are welcome to autobuild.sh for anyone that wants to use it on a debian layout). -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Wed, Mar 21, 2012 at 4:03 PM, Eric Blake <eblake@redhat.com> wrote:
On 03/21/2012 02:58 PM, Shawn Davis wrote:
Older libvirt had a bug where it wouldn't parse qemu 1.0 version (the change from 3 digits to 2 confused the older libvirt). If you're going to go with self-built qemu, you might also want to try self-built libvirt 0.9.10.
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not finding the following:
testa@testaT4:~$ virsh list virsh: /usr/lib/libvirt-qemu.so.0: version `LIBVIRT_QEMU_0.9.4' not found (required by virsh)
Ouch - you've now got version mismatch, where you didn't completely uninstall the distro version, and your self-built version is installed in locations that pick up the distro version. Did you use the right configure flags?
I can't install qemu 1.0 and libvirt 0.9.10 through apt right?
Ah, apt - are you on debian or ubuntu? I don't know as much about the versions that those distros are using (I'm personally using Fedora 16, along with the fedora-virt-preview repo, which gives 0.9.10 pre-built).
I assume I had to get them from source. Anyways, please let me know how I can get virsh to see that I have 0.9.10. Once I get this working and can run that monitor command I will be in good shape.
There might be someone already shipping a pre-built 0.9.10 apt, but I wouldn't know where to tell you to look, so building from source is the other alternative. If you build from libvirt.git, you can use './autobuild.sh --system' to help set the ./configure options that match with the typical installation directories for at least Fedora, but again, I don't know how that fares with the debian installation layout (and patches are welcome to autobuild.sh for anyone that wants to use it on a debian layout).
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Yeah, I am using Ubuntu 11.10. I was able to uninstall the old libvirt and virsh works again but still getting this when trying to start the vm: testa@testaT4:~$ virsh list Id Name State ---------------------------------------------------- testa@testaT4:~$ virsh version Compiled against library: libvir 0.9.10 Using library: libvir 0.9.10 Using API: QEMU 0.9.10 error: failed to get the hypervisor version error: internal error Cannot find suitable emulator for x86_64 testa@testaT4:~$ virsh -c qemu:///system start Shawn error: Failed to connect socket to '/usr/local/var/run/libvirt/libvirt-sock': No such file or directory error: failed to connect to the hypervisor testa@testaT4:~$ Thanks again for helping me out!

On 03/22/2012 05:40 AM, Shawn Davis wrote:
On Wed, Mar 21, 2012 at 4:03 PM, Eric Blake <eblake@redhat.com <mailto:eblake@redhat.com>> wrote:
On 03/21/2012 02:58 PM, Shawn Davis wrote:
>> Older libvirt had a bug where it wouldn't parse qemu 1.0 version (the >> change from 3 digits to 2 confused the older libvirt). If you're going >> to go with self-built qemu, you might also want to try self-built >> libvirt 0.9.10. >> >> -- >> Eric Blake eblake@redhat.com <mailto:eblake@redhat.com> +1-919-301-3266 <tel:%2B1-919-301-3266> >> Libvirt virtualization library http://libvirt.org >> > > I installed libvirt 0.9.10 from source and now virsh is not finding the > following: > > testa@testaT4:~$ virsh list > virsh: /usr/lib/libvirt-qemu.so.0: version `LIBVIRT_QEMU_0.9.4' not found > (required by virsh)
Ouch - you've now got version mismatch, where you didn't completely uninstall the distro version, and your self-built version is installed in locations that pick up the distro version. Did you use the right configure flags?
> I can't install qemu 1.0 and libvirt 0.9.10 through apt right?
Ah, apt - are you on debian or ubuntu? I don't know as much about the versions that those distros are using (I'm personally using Fedora 16, along with the fedora-virt-preview repo, which gives 0.9.10 pre-built).
> I assume I > had to get them from source. Anyways, please let me know how I can get > virsh to see that I have 0.9.10. Once I get this working and can run that > monitor command I will be in good shape.
There might be someone already shipping a pre-built 0.9.10 apt, but I wouldn't know where to tell you to look, so building from source is the other alternative. If you build from libvirt.git, you can use './autobuild.sh --system' to help set the ./configure options that match with the typical installation directories for at least Fedora, but again, I don't know how that fares with the debian installation layout (and patches are welcome to autobuild.sh for anyone that wants to use it on a debian layout).
-- Eric Blake eblake@redhat.com <mailto:eblake@redhat.com> +1-919-301-3266 <tel:%2B1-919-301-3266> Libvirt virtualization library http://libvirt.org
Yeah, I am using Ubuntu 11.10. I was able to uninstall the old libvirt and virsh works again but still getting this when trying to start the vm:
testa@testaT4:~$ virsh list Id Name State ----------------------------------------------------
testa@testaT4:~$ virsh version Compiled against library: libvir 0.9.10 Using library: libvir 0.9.10 Using API: QEMU 0.9.10 error: failed to get the hypervisor version error: internal error Cannot find suitable emulator for x86_64
testa@testaT4:~$ virsh -c qemu:///system start Shawn error: Failed to connect socket to '/usr/local/var/run/libvirt/libvirt-sock': No such file or directory
I guess you're using a old virsh with new libvirt, you may check your virsh command location, if `which virsh` says '/usr/bin/virsh' and `which libvirtd` says /usr/sbin/libvirtd, and socket is /var/run/libvirt/libvirt-sock not above socket path, it's right. It probably your virsh command path is /usr/local/bin/virsh, and your socket path is /var/run/libvirt/libvirt-sock now, if so, you may explicitly specify /usr/bin/virsh or clean up your dirty environment then directly run virsh instead of a absolute path. Good Luck! Alex
error: failed to connect to the hypervisor testa@testaT4:~$
Thanks again for helping me out!
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

From: Alex Jia [mailto:ajia@redhat.com] Sent: Wednesday, March 21, 2012 9:52 PM To: Shawn Davis Cc: Eric Blake; libvirt-users@redhat.com Subject: Re: [libvirt-users] qemu-monitor-command On 03/22/2012 05:40 AM, Shawn Davis wrote: On Wed, Mar 21, 2012 at 4:03 PM, Eric Blake <eblake@redhat.com> wrote: On 03/21/2012 02:58 PM, Shawn Davis wrote:
Older libvirt had a bug where it wouldn't parse qemu 1.0 version (the change from 3 digits to 2 confused the older libvirt). If you're going to go with self-built qemu, you might also want to try self-built libvirt 0.9.10.
-- Eric Blake eblake@redhat.com +1-919-301-3266 <tel:%2B1-919-301-3266>
Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not finding the following:
testa@testaT4:~$ virsh list virsh: /usr/lib/libvirt-qemu.so.0: version `LIBVIRT_QEMU_0.9.4' not found (required by virsh)
Ouch - you've now got version mismatch, where you didn't completely uninstall the distro version, and your self-built version is installed in locations that pick up the distro version. Did you use the right configure flags?
I can't install qemu 1.0 and libvirt 0.9.10 through apt right?
Ah, apt - are you on debian or ubuntu? I don't know as much about the versions that those distros are using (I'm personally using Fedora 16, along with the fedora-virt-preview repo, which gives 0.9.10 pre-built).
I assume I had to get them from source. Anyways, please let me know how I can get virsh to see that I have 0.9.10. Once I get this working and can run that monitor command I will be in good shape.
There might be someone already shipping a pre-built 0.9.10 apt, but I wouldn't know where to tell you to look, so building from source is the other alternative. If you build from libvirt.git, you can use './autobuild.sh --system' to help set the ./configure options that match with the typical installation directories for at least Fedora, but again, I don't know how that fares with the debian installation layout (and patches are welcome to autobuild.sh for anyone that wants to use it on a debian layout). -- Eric Blake eblake@redhat.com +1-919-301-3266 <tel:%2B1-919-301-3266> Libvirt virtualization library http://libvirt.org Yeah, I am using Ubuntu 11.10. I was able to uninstall the old libvirt and virsh works again but still getting this when trying to start the vm: testa@testaT4:~$ virsh list Id Name State ---------------------------------------------------- testa@testaT4:~$ virsh version Compiled against library: libvir 0.9.10 Using library: libvir 0.9.10 Using API: QEMU 0.9.10 error: failed to get the hypervisor version error: internal error Cannot find suitable emulator for x86_64 testa@testaT4:~$ virsh -c qemu:///system start Shawn error: Failed to connect socket to '/usr/local/var/run/libvirt/libvirt-sock': No such file or directory I guess you're using a old virsh with new libvirt, you may check your virsh command location, if `which virsh` says '/usr/bin/virsh' and `which libvirtd` says /usr/sbin/libvirtd, and socket is /var/run/libvirt/libvirt-sock not above socket path, it's right. It probably your virsh command path is /usr/local/bin/virsh, and your socket path is /var/run/libvirt/libvirt-sock now, if so, you may explicitly specify /usr/bin/virsh or clean up your dirty environment then directly run virsh instead of a absolute path. Good Luck! Alex error: failed to connect to the hypervisor testa@testaT4:~$ Thanks again for helping me out! I ended up starting over and reinstalled Ubuntu 11.10. I removed the exiting kvm and downloaded qemu-kvm-1.0.tar.gz and built it from source out of my Downloads directory. I then did the same thing with libvirt 0.9.10. Virsh works but still when I do the version it still says: error: failed to get the hypervisor version error: internal error Cannot find suitable emulator for x86_64 I also can't seem to start libvirtd and it is not located in /etc/init.d Sorry for the noob question but how do I configure and build qemu-kvm and libvirt so that they are all installed in the correct places? Is there a specific flag I need to use or do I need to install them from a specific directory? It looks like the files and being put all over the place. Some are in /etc and some are in /usr/local/etc. If I can get everything to install in the correct spots I should be good I would hope. Thanks! Shawn _______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

On 03/24/2012 10:15 AM, Shawn Davis wrote:
Sorry for the noob question but how do I configure and build qemu-kvm and libvirt so that they are all installed in the correct places? Is there a specific flag I need to use or do I need to install them from a specific directory? It looks like the files and being put all over the place. Some are in /etc and some are in /usr/local/etc. If I can get everything to install in the correct spots I should be good I would hope.
What arguments are you passing to ./configure? If you build from libvirt.git and are on a Fedora-based system, then using ./autogen.sh --system will set up the preferred arguments to configure (these include --prefix=/usr --libdir=$prefix/$lib --sysconfdir=/etc --localstatedir=/var, where $lib is either lib or lib64). I'm not quite sure what default directories a debian-based install prefers; patches are welcome to ./autogen.sh to account for any differences to match debian-preferred layout. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

-----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Monday, March 26, 2012 9:18 AM To: Shawn Davis Cc: 'Alex Jia'; libvirt-users@redhat.com Subject: Re: [libvirt-users] qemu-monitor-command On 03/24/2012 10:15 AM, Shawn Davis wrote:
Sorry for the noob question but how do I configure and build qemu-kvm and libvirt so that they are all installed in the correct places? Is there a specific flag I need to use or do I need to install them from a specific directory? It looks like the files and being put all over the place. Some are in /etc and some are in /usr/local/etc. If I can get everything to install in the correct spots I should be good I would
hope. What arguments are you passing to ./configure? If you build from libvirt.git and are on a Fedora-based system, then using ./autogen.sh --system will set up the preferred arguments to configure (these include --prefix=/usr --libdir=$prefix/$lib --sysconfdir=/etc --localstatedir=/var, where $lib is either lib or lib64). I'm not quite sure what default directories a debian-based install prefers; patches are welcome to ./autogen.sh to account for any differences to match debian-preferred layout. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org I reinstalled my Ubuntu 11.10 Desktop OS again and I will run you through exactly what I had done prior to your last reply: QEMU 1. I downloaded qemu-kvm from here: http://sourceforge.net/projects/kvm/files/qemu-kvm/1.0/ 2. I extracted it to my home folder called testa 3. sudo apt-get install zlib1g-dev libglib2.0-dev as I know those are needed dependencies on this system 4. ./configure --prefix=/usr 5. make, then sudo make install 6. I looked and qemu-system-x86_64 is located in /usr/bin 7. From /usr/bin the command qemu-kvm-x86_64 --version gives me "QEMU emulator version 1.0" 8. I run sudo ./qemu-system-x86_64 which says could not access KVM kernel module, failed to init KVM, no accelerator found. 9. I run sudo /sbin/modprobe kvm-intel 10. I run sudo ./qemu-system-x86_64 again which now brings up "VNC server running on "127.0.0.1:5900' I cntl-c out of that. Libvirt 11. I downloaded libvirt-0.9.10.tar.gz from libvirt.org/sources/ and extract it to my home folder. 12. sudo apt-get install libxml2.dev gnutls-bin gnutls-dev libdevmapper-dev libdevmapper python-dev libnl1 libnl-dev libyajl-dev as I know those dependencies are needed. 13. ./configure --prefix=/usr 14. make, then sudo make install 15. which virsh gives me: /usr/bin/virsh 16. which libvirtd give me: /usr/sbin/libvirtd 17. I run sudo virsh version and get "Failed to reconnect to the hypervisor, no valid connection, failed to connect socket to /var/run/libvirt/libvirt-sock: no such file or directory. 18. I look in /var/run/libvirt and there is no libvirt-sock in there. 19. libvirtd --version returns libvirtd (libvirt) 0.9.10 20. sudo libvirtd start or restart returns libvirtd: unrecognized service. 21. sudo ./libvirtd -d 22. I again run sudo virsh version which returns: Copiled again library: libvir 0.9.10 Using library: libvir 0.9.10 Using API: QEMU 0.9.10 Running hypervisor: QEMU 1.0.0 Virt-Install 23. I run sudo apt-get virtinst HERE IS WHERE I RUN INTO SOME PROBLEMS: 24. virtinst starts installing and I eventually get this: Configuration file /etc/logrotate.d/libvirtd File on system created by you or by a script. File also in package provided by package maintainer What would you like to do about it? Your options are: Y : install the package maintainer's version N : keep your currently-installed version 25. I also get the same message for /etc/libvirt/libvird.conf, /etc/libvirt/lxc.conf, /etc/libvirt/nwfiler/clean-traffic.xml, /etc/libvirt/nwfilter/no-arp-spoofing.xml, /etc/libvirt/nwfilter/no-ip-spoofing.xml, /etc/libvirt/nwfilter/no-mac-spoofing.xml, /etc/libvirt/qemu/networks/default.xml, and /etc/libvirt/qemu.conf. 26. The first time I got to this point, I chose the N: keep your currently-installed version on all of those. 27. Then when I tried to do sudo virsh version, I got: virsh: /usr/lib/libvirt.so.0: version 'LIBVIRT_PRIVATE_0.9.2' not found (required by virsh) 28. I tried to restart libvirtd and is returned the same error msg. 29. This time I went through all of the steps and when I got to my step 24, I chose Y : install the package maintainer's version. 30. I got the same LIBVIRT_PRIVATE.... msg again when trying to run sudo virsh version. 31. I ran sudo ./libvirtd -d from the /usr/sbin location and received the same LIBVIRT_PRIVATE error message. So it looks like I can get QEMU and LIBVIRT installed from source okay but when I try to install virtinst in order to create my vm, I run into problems. Thoughts? Thanks!

I figured it out. The apt-get virtinst was downloading the old libvirt-bin which was fouling everything up. I am going to try and build the virtinst from source. I will let you guys know if that works. -----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Monday, March 26, 2012 9:18 AM To: Shawn Davis Cc: 'Alex Jia'; libvirt-users@redhat.com Subject: Re: [libvirt-users] qemu-monitor-command On 03/24/2012 10:15 AM, Shawn Davis wrote:
Sorry for the noob question but how do I configure and build qemu-kvm and libvirt so that they are all installed in the correct places? Is there a specific flag I need to use or do I need to install them from a specific directory? It looks like the files and being put all over the place. Some are in /etc and some are in /usr/local/etc. If I can get everything to install in the correct spots I should be good I would
hope. What arguments are you passing to ./configure? If you build from libvirt.git and are on a Fedora-based system, then using ./autogen.sh --system will set up the preferred arguments to configure (these include --prefix=/usr --libdir=$prefix/$lib --sysconfdir=/etc --localstatedir=/var, where $lib is either lib or lib64). I'm not quite sure what default directories a debian-based install prefers; patches are welcome to ./autogen.sh to account for any differences to match debian-preferred layout. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

-----Original Message----- From: Shawn Davis [mailto:sdavis17@hawk.iit.edu] Sent: Monday, March 26, 2012 12:56 PM To: 'Eric Blake' Cc: 'Alex Jia'; 'libvirt-users@redhat.com' Subject: RE: [libvirt-users] qemu-monitor-command -----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Monday, March 26, 2012 9:18 AM To: Shawn Davis Cc: 'Alex Jia'; libvirt-users@redhat.com Subject: Re: [libvirt-users] qemu-monitor-command On 03/24/2012 10:15 AM, Shawn Davis wrote:
Sorry for the noob question but how do I configure and build qemu-kvm and libvirt so that they are all installed in the correct places? Is there a specific flag I need to use or do I need to install them from a specific directory? It looks like the files and being put all over the place. Some are in /etc and some are in /usr/local/etc. If I can get everything to install in the correct spots I should be good I would
hope. What arguments are you passing to ./configure? If you build from libvirt.git and are on a Fedora-based system, then using ./autogen.sh --system will set up the preferred arguments to configure (these include --prefix=/usr --libdir=$prefix/$lib --sysconfdir=/etc --localstatedir=/var, where $lib is either lib or lib64). I'm not quite sure what default directories a debian-based install prefers; patches are welcome to ./autogen.sh to account for any differences to match debian-preferred layout. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org I reinstalled my Ubuntu 11.10 Desktop OS again and I will run you through exactly what I had done prior to your last reply: QEMU 1. I downloaded qemu-kvm from here: http://sourceforge.net/projects/kvm/files/qemu-kvm/1.0/ 2. I extracted it to my home folder called testa 3. sudo apt-get install zlib1g-dev libglib2.0-dev as I know those are needed dependencies on this system 4. ./configure --prefix=/usr 5. make, then sudo make install 6. I looked and qemu-system-x86_64 is located in /usr/bin 7. From /usr/bin the command qemu-kvm-x86_64 --version gives me "QEMU emulator version 1.0" 8. I run sudo ./qemu-system-x86_64 which says could not access KVM kernel module, failed to init KVM, no accelerator found. 9. I run sudo /sbin/modprobe kvm-intel 10. I run sudo ./qemu-system-x86_64 again which now brings up "VNC server running on "127.0.0.1:5900' I cntl-c out of that. Libvirt 11. I downloaded libvirt-0.9.10.tar.gz from libvirt.org/sources/ and extract it to my home folder. 12. sudo apt-get install libxml2.dev gnutls-bin gnutls-dev libdevmapper-dev libdevmapper python-dev libnl1 libnl-dev libyajl-dev as I know those dependencies are needed. 13. ./configure --prefix=/usr 14. make, then sudo make install 15. which virsh gives me: /usr/bin/virsh 16. which libvirtd give me: /usr/sbin/libvirtd 17. I run sudo virsh version and get "Failed to reconnect to the hypervisor, no valid connection, failed to connect socket to /var/run/libvirt/libvirt-sock: no such file or directory. 18. I look in /var/run/libvirt and there is no libvirt-sock in there. 19. libvirtd --version returns libvirtd (libvirt) 0.9.10 20. sudo libvirtd start or restart returns libvirtd: unrecognized service. 21. sudo ./libvirtd -d 22. I again run sudo virsh version which returns: Copiled again library: libvir 0.9.10 Using library: libvir 0.9.10 Using API: QEMU 0.9.10 Running hypervisor: QEMU 1.0.0 Virt-Install 23. I run sudo apt-get virtinst HERE IS WHERE I RUN INTO SOME PROBLEMS: 24. virtinst starts installing and I eventually get this: Configuration file /etc/logrotate.d/libvirtd File on system created by you or by a script. File also in package provided by package maintainer What would you like to do about it? Your options are: Y : install the package maintainer's version N : keep your currently-installed version 25. I also get the same message for /etc/libvirt/libvird.conf, /etc/libvirt/lxc.conf, /etc/libvirt/nwfiler/clean-traffic.xml, /etc/libvirt/nwfilter/no-arp-spoofing.xml, /etc/libvirt/nwfilter/no-ip-spoofing.xml, /etc/libvirt/nwfilter/no-mac-spoofing.xml, /etc/libvirt/qemu/networks/default.xml, and /etc/libvirt/qemu.conf. 26. The first time I got to this point, I chose the N: keep your currently-installed version on all of those. 27. Then when I tried to do sudo virsh version, I got: virsh: /usr/lib/libvirt.so.0: version 'LIBVIRT_PRIVATE_0.9.2' not found (required by virsh) 28. I tried to restart libvirtd and is returned the same error msg. 29. This time I went through all of the steps and when I got to my step 24, I chose Y : install the package maintainer's version. 30. I got the same LIBVIRT_PRIVATE.... msg again when trying to run sudo virsh version. 31. I ran sudo ./libvirtd -d from the /usr/sbin location and received the same LIBVIRT_PRIVATE error message. So it looks like I can get QEMU and LIBVIRT installed from source okay but when I try to install virtinst in order to create my vm, I run into problems. Thoughts? Thanks! I got everything working and was able use the qemu-monitor-command with pmemsave now that I have the latest versions of qemu and libvirt. Thanks for all of the help! One last question on this. When I reboot, I get errors and virsh doesn't see the hypervisor anymore and I am unable to start libvirtd again. While I have everything running now, what can I do to ensure libvirtd will start on reboot? Initially to start it I have to run sudo ./libvirtd -d from the /usr/sbin location. That doesn't work on reboot though for some reason. I noticed some people have libvirtd in their init.d folder but mine doesn't get put there with the installation I am doing.
participants (4)
-
Alex Jia
-
Eric Blake
-
Michal Privoznik
-
Shawn Davis