libvirt錯誤總結

virsh start vm1368544020451:

 error: Failed to start domain vm1368544020451

error: internal error process exited while connecting to monitor: kvm: -drive file=/dev/sp1368155439693/v1368544020461,if=none,id=drive-virtio-disk0,format=qcow2: could not open disk image /dev/sp1368155439693/v1368544020461: Invalid argument

鏡像格式錯誤,用qemu-img info 檢查鏡像和xml配置文件中指定的type是否一致。


error: Failed to start domain vm0

error: internal error process exited while connecting to monitor: Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
No accelerator found!

上面的提示信息就是因爲QEMU在初始化階段因爲無法找到kvm內核模塊。

sudo modprobe kvm   #載入指定的模塊

重啓電腦,進入bios界面,設置advance選項裏面的virtualization標籤爲Enabled

通過命令 lsmod | grep kvm    #顯示已載入的模塊

 虛擬機遷移:

# virsh migrate --live 1 qemu+tcp://192.168.0.121 --p2p --tunnelled --unsafe 

error: operation failed: Failed to connect to remote libvirt URI qemu+tcp://192.168.0.121(在URI後面加上/system,‘system’相當於root用戶的訪問權限)

#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled

 error: Unsafe migration: Migration may lead to data corruption if disks use cache != none(加上--unsafe參數)

#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled --unsafe 

error: Timed out during operation: cannot acquire state change lock (啓動虛擬機有時也會遇此錯誤),需要重啓libvirtd進程

virsh:

error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused(libvirtd 進程沒有啓動,libvirtd是一個監聽客戶端請求的進程)

$ virsh -c qemu:///system list
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
error: failed to connect to the hypervisor

(當前用戶沒有權限,修改/etc/libvirt/libvirtd.conf,unix_sock_rw_perms = 0777,使所有用戶都有權限讀寫)

啓動libvirtd進程出錯:

 /usr/local/sbin/libvirtd -d -l --config /usr/local/etc/libvirt/libvirtd.conf (編譯安裝的啓動方式)

error:/usr/local/sbin/libvirtd: initialization failed

try to install libpcap-devel RPM and rebuild libvirt  http://comments.gmane.org/gmane.comp.emulators.libvirt/58218

apt-get install libpcap-dev

上面的方法好像都沒有效果,但是嘗試了http://wiki.libvirt.org/page/The_daemon_cannot_be_started說的,把配置文件裏的

listen_tls = 0註釋取消(更奇怪的問題,在我的客戶端鏈接不對)

啓動虛擬機:Connection reset by peer

virsh start vm1355991767186
error: Failed to start domain vm1355991767186
error: Unable to read from monitor: Connection reset by peer

 還有可能是這樣提示:

error: internal error process exited while connecting to monitor: Failed to allocate 16332619776 B: Cannot allocate memory

這個問題可能是因爲爲VM分配的內存過大(甚至超過的物理主機的內存大小)

Unable to load library 'virt': libvirt.so: cannot open shared object file: No such file or directory

linux 環境:
     ln -s /usr/lib/libvirt.so.0   /usr/lib/libvirt.so
windows 環境
     將libvirt-0.dll改名爲virt.dll
  

# virsh undefine vm1354695894990
error: Refusing to undefine while domain managed save image exists

http://www.redhat.com/archives/libvir-list/2011-July/msg01219.html

 managedsave

解決辦法:virsh undefine $domain  --managed-save
 
在centos下面Define虛擬機時,確實沒有/usr/bin/kvm,加軟鏈接
error: Failed to define domain from xxx.xml
error: Cannot find QEMU binary /usr/bin/kvm: No such file or directory

解決辦法:ln -s /usr/libexec/qemu-kvm /usr/bin/kvm

更多參考:
 
發佈了46 篇原創文章 · 獲贊 5 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章