Ubuntu下用libvirt安装KVM虚拟机时找不到/bin/qemu-kvm问题解决

启动虚拟机的时候老出现:error: Cannot check QEMU binary /bin/qemu-kvm: No such file or directory

我用的是以下xml配置文件

<domain type='kvm'>
    <name>rheltest</name>
    <uuid>32b95fab-6d78-4e28-beca-2c3988ff8cfe</uuid>
    <memory unit='KiB'>1048576</memory>
    <currentMemory unit='KiB'>1048576</currentMemory>
    <vcpu placement='static'>1</vcpu>
    <os>
        <type arch='x86_64' machine='pc-1.2'>hvm</type>
        <boot dev='cdrom'/>
        <boot dev='hd'/>
    </os>
    <features>
        <acpi/>
        <apic/>
        <pae/>
    </features>
    <clock offset='utc'/>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>restart</on_crash>
    <devices>
        <emulator>/bin/qemu-kvm</emulator>
        <disk type='file' device='disk'>
            <driver name='qemu' type='qcow2'/>
            <source file='/home/lisp/code/auto-rhel/virt/rheltest'/>
            <target dev='hda' bus='ide'/>
            <address type='drive' controller='0' buss='0' target='0' unit='0'/>
        </disk>
        <disk type='file' device='cdrom'>
            <driver name='qemu' type='raw'/>
            <source file='/home/lisp/os.iso/rhelcustom.iso'/>
            <target dev='hdc' bus='ide'/>
        <readonly/>
        </disk>
        <controller type='usb' index='0'>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
        </controller>
        <controller type='ide' index='0'>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
        </controller>
        <interface type='bridge'>
            <mac address='52:54:00:78:f9:59'/>
            <source bridge='virbr0'/>
            <model type='virtio'/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        </interface>
        <input type='mouse' bus='ps2'/>
        <graphics type='vnc' port='-1' autoprot='yes'/>
        <memballoon model='virtio'>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
        </memballoon>
    </devices>
</domain>

在没有找到/bin/qemu-kvm这个文件,后来才知道,对Ubuntu的应该对应是/usr/bin/qemu这个文件,把上面xml配置文件对应的那行改为如下就行了

<emulator>/usr/bin/qemu</emulator>

相关阅读:

相关推荐