今天在把QEMU-KVM上的一個虛擬機Shutdown後總是無法啟動,使用virt-manager管理工具啟動時總是導致該工具意外終止,如果是使用virsh命令行管理工具啟動時總是報錯:
[root@db1 ~]# virsh start oneracvm
error: Failed to start domain oneracvm
error: Timed out during operation: cannot acquire state change lock
查了一下發現這是ibvirt在RHEL5上的Bug,需要把libvirt的後天進程libvirtd --daemon重啟一下:
關閉,直接KILL即可:
[root@db1 run]# kill -9 `ps -ef|grep 'libvirtd --daemon'|grep -v grep |awk '{print $2}'`
這時候你還不能直接起來,否則會出錯:
[root@db1 run]# libvirtd --daemon
libvirtd: error: Unable to obtain pidfile. Check /var/log/messages or run without --daemon for more info.
因為,它的啟動記錄文件還存在,需要先刪除:
[root@db1 run]# rm /var/run/libvirtd.pid
rm: remove regular file `libvirtd.pid'? y
這時候你就可以起來了:
[root@db1 run]# libvirtd --daemon
此時就可以啟動虛擬機了:
[root@db1 ~]# virsh start oneracvm
Domain oneracvm started