
On 06/19/2012 03:20 AM, Zhihua Che wrote:
First, I'm sorry I forgot to mention that I installed my qemu-system-x86_64 in a non-default path, that is, NOT in /usr/bin, /usr/local/bin etc. In this case, if I started up libvirtd with sudo, qemuCapsInitGuest failed to add hvm guest os type to driver->capabilities because it can't find qemu-system-x86_64 by searching environmental variable PATH!.
But, the most confusing thing happened here. I've added the qemu-system-x86_64 in PATH by editing the /etc/bash.bashrc. Why can't it still find the qemu?. I found in qemuCapsInitGuest->virFindFileInPath(info->binary) that the call to getenv("PATH") didn't return the path I added myself!
Remember, 'sudo' sanitizes PATH. Just because you added the directory to _your_ PATH, under your uid, does not mean that the sanitized PATH used by sudo and user root is the same, unless you take explicit actions to set PATH as part of your sudo environment setup. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org