Discussion:
[libvirt-users] qemu-monitor-command
Shawn Davis
2012-03-20 13:30:01 UTC
Permalink
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
Michal Privoznik
2012-03-20 14:36:10 UTC
Permalink
Post by Shawn Davis
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
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
Eric Blake
2012-03-20 15:08:33 UTC
Permalink
Post by Shawn Davis
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.
Post by Shawn Davis
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Shawn Davis
2012-03-20 17:18:12 UTC
Permalink
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:***@redhat.com]
Sent: Tuesday, March 20, 2012 10:09 AM
To: Shawn Davis
Cc: libvirt-***@redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command
Post by Shawn Davis
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.
Post by Shawn Davis
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Shawn Davis
2012-03-21 03:43:33 UTC
Permalink
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:***@redhat.com]
Sent: Tuesday, March 20, 2012 10:09 AM
To: Shawn Davis
Cc: libvirt-***@redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command
Post by Shawn Davis
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.
Post by Shawn Davis
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Michal Privoznik
2012-03-21 08:20:57 UTC
Permalink
Post by Shawn Davis
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.
Post by Shawn Davis
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
Shawn Davis
2012-03-21 14:49:24 UTC
Permalink
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:***@redhat.com]
Sent: Wednesday, March 21, 2012 3:21 AM
To: Shawn Davis
Cc: libvirt-***@redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command
Post by Shawn Davis
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'
Post by Shawn Davis
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.
Post by Shawn Davis
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
Eric Blake
2012-03-21 14:55:39 UTC
Permalink
Post by Shawn Davis
Hi Michal,
Thanks for testing that for me.
{"val":0, "size":536870912, "filename":"/tmp/testimage.dump"}}'
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.
Post by Shawn Davis
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Shawn Davis
2012-03-21 17:45:34 UTC
Permalink
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:***@redhat.com]
Sent: Wednesday, March 21, 2012 9:56 AM
To: Shawn Davis
Cc: 'Michal Privoznik'; libvirt-***@redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command
Post by Shawn Davis
Hi Michal,
Thanks for testing that for me.
{"val":0, "size":536870912, "filename":"/tmp/testimage.dump"}}'
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.
Post by Shawn Davis
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Eric Blake
2012-03-21 18:48:27 UTC
Permalink
[please don't top-post on technical lists]
Post by Shawn Davis
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
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Shawn Davis
2012-03-21 20:58:04 UTC
Permalink
Post by Eric Blake
[please don't top-post on technical lists]
Post by Shawn Davis
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
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.
--
Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not finding the
following:

***@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
Eric Blake
2012-03-21 21:03:47 UTC
Permalink
Post by Shawn Davis
Post by Eric Blake
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.
--
Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not finding the
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?
Post by Shawn Davis
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).
Post by Shawn Davis
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Shawn Davis
2012-03-21 21:40:13 UTC
Permalink
Post by Eric Blake
Post by Shawn Davis
Post by Eric Blake
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.
--
Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not finding the
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?
Post by Shawn Davis
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).
Post by Shawn Davis
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
Post by Shawn Davis
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).
--
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:

***@testaT4:~$ virsh list
Id Name State
----------------------------------------------------

***@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

***@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
***@testaT4:~$

Thanks again for helping me out!
Alex Jia
2012-03-22 02:51:57 UTC
Permalink
Post by Eric Blake
Post by Shawn Davis
Post by Eric Blake
Older libvirt had a bug where it wouldn't parse qemu 1.0
version (the
Post by Shawn Davis
Post by Eric Blake
change from 3 digits to 2 confused the older libvirt). If
you're going
Post by Shawn Davis
Post by Eric Blake
to go with self-built qemu, you might also want to try self-built
libvirt 0.9.10.
--
+1-919-301-3266 <tel:%2B1-919-301-3266>
Post by Shawn Davis
Post by Eric Blake
Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not
finding the
Post by Shawn Davis
virsh: /usr/lib/libvirt-qemu.so.0: version `LIBVIRT_QEMU_0.9.4'
not found
Post by Shawn Davis
(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?
Post by Shawn Davis
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).
Post by Shawn Davis
I assume I
had to get them from source. Anyways, please let me know how I
can get
Post by Shawn Davis
virsh to see that I have 0.9.10. Once I get this working and
can run that
Post by Shawn Davis
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).
--
+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
Id Name State
----------------------------------------------------
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
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
Post by Eric Blake
error: failed to connect to the hypervisor
Thanks again for helping me out!
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
Shawn Davis
2012-03-24 16:15:36 UTC
Permalink
From: Alex Jia [mailto:***@redhat.com]
Sent: Wednesday, March 21, 2012 9:52 PM
To: Shawn Davis
Cc: Eric Blake; libvirt-***@redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command
Post by Shawn Davis
Post by Eric Blake
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.
--
Libvirt virtualization library http://libvirt.org
I installed libvirt 0.9.10 from source and now virsh is not finding the
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?
Post by Shawn Davis
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).
Post by Shawn Davis
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 ***@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:

***@testaT4:~$ virsh list
Id Name State
----------------------------------------------------

***@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

***@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
***@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
Eric Blake
2012-03-26 14:18:12 UTC
Permalink
Post by Shawn Davis
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Shawn Davis
2012-03-26 17:55:30 UTC
Permalink
-----Original Message-----
From: Eric Blake [mailto:***@redhat.com]
Sent: Monday, March 26, 2012 9:18 AM
To: Shawn Davis
Cc: 'Alex Jia'; libvirt-***@redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command
Post by Shawn Davis
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 ***@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.
Shawn Davis
2012-03-26 20:58:20 UTC
Permalink
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:***@redhat.com]
Sent: Monday, March 26, 2012 9:18 AM
To: Shawn Davis
Cc: 'Alex Jia'; libvirt-***@redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command
Post by Shawn Davis
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 ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Shawn Davis
2012-03-27 19:38:31 UTC
Permalink
-----Original Message-----
From: Shawn Davis [mailto:***@hawk.iit.edu]
Sent: Monday, March 26, 2012 12:56 PM
To: 'Eric Blake'
Cc: 'Alex Jia'; 'libvirt-***@redhat.com'
Subject: RE: [libvirt-users] qemu-monitor-command



-----Original Message-----
From: Eric Blake [mailto:***@redhat.com]
Sent: Monday, March 26, 2012 9:18 AM
To: Shawn Davis
Cc: 'Alex Jia'; libvirt-***@redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command
Post by Shawn Davis
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 ***@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.
Loading...