首页 文章

启动带有TAP接口的KVM VM时,为什么会出现权限错误?

提问于
浏览
2

第一篇文章,感谢社区 . 如果它更适合其他论坛,请道歉

我正在运行Ubuntu 12.04 LTS Server作为我的主机 .

/ etc / libvirt#kvm --version

QEMU仿真器版本1.0(qemu-kvm-1.0),版权所有(c)2003-2008 Fabrice Bellard

我构建了一个运行Ubuntu 13.10的虚拟机 . 当我进入XML为静态IP配置以太网tap0接口时,我遇到了麻烦 . 我已经搜过网并尝试了几件事,但无济于事 .

这是我得到的错误 .
错误下面是我的配置和我的日志 .
在那之下是我尝试过的事情清单,并没有取得成功......

-# virsh start phabVM error: Failed to start domain phabVM error: internal error Process exited while reading console log output: char device redirected to /dev/pts/1 kvm: -netdev tap,ifname=tap0,id=hostnet0: could not open /dev/net/tun: Operation not permitted kvm: -netdev tap,ifname=tap0,id=hostnet0: Device 'tap' could not be initialized


VM XML

# domain type='kvm'>
    # name>phabVM
    # uuid>26a54ab3-7c67-507b-f066-09015dd19942
    # memory>4194304
    # currentMemory>4194304
    # vcpu>1
    # os>
    # type arch='x86_64' machine='pc-1.0'>hvm
    # boot dev='hd'/>
    # /os>
    # features>
    # acpi/>
    # apic/>
    # pae/>
    # /features>
    # clock offset='utc'/>
    # on_poweroff>preserve
    # on_reboot>restart
    # on_crash>restart
    # devices>
    # emulator>/usr/bin/kvm
    # disk type='file' device='disk'>
    # driver name='qemu' type='raw'/>
    # source file='/home/inevirt/images/PhabVM.img'/>
    # target dev='sda' bus='sata'/>
    # address type='drive' controller='0' bus='0' unit='0'/>
    # /disk>
    # disk type='block' device='cdrom'>
    # driver name='qemu' type='raw'/>
    # target dev='hdc' bus='ide'/>
    # readonly/>
    # address type='drive' controller='0' bus='1' unit='0'/>
    # /disk>
    # controller type='ide' index='0'>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    # /controller>
    # controller type='sata' index='0'>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    # /controller>
    # interface type='ethernet'>
    # mac address='52:54:00:6d:ab:17'/>
    # target dev='tap0'/>
    # model type='virtio'/>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    # /interface>
    # serial type='pty'>
    # target port='0'/>
    # /serial>
    # console type='pty'>
    # target type='serial' port='0'/>
    # /console>
    # input type='mouse' bus='ps2'/>
    # graphics type='vnc' port='-1' autoport='yes'/>
    # sound model='ich6'>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    # /sound>
    # video>
    # model type='cirrus' vram='9216' heads='1'/>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    # /video>
    # memballoon model='virtio'>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    # /memballoon>
    # /devices>
    #/domain

LOG

2013-11-21 17:38:59.075+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin        QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc-1.0 -enable-kvm -m 4096 -smp 1,sockets=1,cores=1,threads=1 -name PhabVM -uuid 26a54ab3-7c67-507b-f066-09015dd19942 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/PhabVM.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device ahci,id=ahci0,bus=pci.0,addr=0x5 -drive file=/home/inevirt/images/PhabVM.img,if=none,id=drive-sata0-0-0,format=raw -device ide-drive,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1 -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 -netdev tap,ifname=tap0,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:6d:ab:17,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:0 -vga cirrus -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/1
kvm: -netdev tap,ifname=tap0,id=hostnet0: could not open /dev/net/tun: Operation not permitted
kvm: -netdev tap,ifname=tap0,id=hostnet0: Device 'tap' could not be initialized
2013-11-21 17:38:59.205+0000: shutting down
2013-11-21 17:40:57.554+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc-1.0 -enable-kvm -m 4096 -smp 1,sockets=1,cores=1,threads=1 -name PhabVM -uuid 26a54ab3-7c67-507b-f066-09015dd19942 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/PhabVM.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device ahci,id=ahci0,bus=pci.0,addr=0x5 -drive file=/home/inevirt/images/PhabVM.img,if=none,id=drive-sata0-0-0,format=raw -device ide-drive,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1 -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 -netdev tap,ifname=tap0,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:6d:ab:17,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:0 -vga cirrus -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/1
kvm: -netdev tap,ifname=tap0,id=hostnet0: could not open /dev/net/tun: Operation not permitted
kvm: -netdev tap,ifname=tap0,id=hostnet0: Device 'tap' could not be initialized
2013-11-21 17:40:57.686+0000: shutting down

我尝试过的东西(来自互联网研究)没有奏效 .

添加用户到组kvm
配置libvirtd.conf并取消注释listen_tls和listen_tcp
通过将root设置为user / group来配置qemu.conf以运行VM并取消注释
clear_emulator_capabilities = 0
禁用apparmor
确保kvm二进制文件设置为kvm组

1 回答

相关问题