故障描述:一个客户安装完CentOS7后,然后在CentOS上安装KVM环境,结果在启动libvirtd服务的时候启动不了
[[email protected] ~]# yum install qemu-kvm qemu-kvm-tools virt-manager libvirt virt-install -y 查看cpu指令是否支持cpu虚拟化: [[email protected] ~]# egrep ‘(vmx|svm)‘ /proc/cpuinfo flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb pln pts dtherm tpr_shadow vnmi ept vpid fsgsbase tsc_adjust smep flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb pln pts dtherm tpr_shadow vnmi ept vpid fsgsbase tsc_adjust smep flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb pln pts dtherm tpr_shadow vnmi ept vpid fsgsbase tsc_adjust smep flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb pln pts dtherm tpr_shadow vnmi ept vpid fsgsbase tsc_adjust smep
查看kvm模块是否被加载
[[email protected] ~]# lsmod | grep kvm kvm_intel 148081 0 kvm 461126 1 kvm_intel [[email protected] ~]# systemctl enable libvirtd.service [[email protected] ~]# systemctl start libvirtd.service
启动libvirtd服务,发现出现报错
[[email protected] ~]# systemctl status -l libvirtd.service libvirtd.service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled) Active: deactivating (final-sigterm) (Result: timeout) Docs: man:libvirtd(8) http://libvirt.org Main PID: 3219 CGroup: /system.slice/libvirtd.service ├─2713 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper └─2714 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper 2月 22 15:33:56 kvm01 systemd[1]: Stopping Virtualization daemon... 2月 22 15:33:56 kvm01 systemd[1]: Starting Virtualization daemon... 2月 22 15:33:57 kvm01 libvirtd[3219]: libvirt version: 2.0.0, package: 10.el7_3.4 (CentOS BuildSystem <http://bugs.centos.org>, 2017-01-17-23:37:48, c1bm.rdu2.centos.org) 2月 22 15:33:57 kvm01 libvirtd[3219]: hostname: kvm01 2月 22 15:33:57 kvm01 libvirtd[3219]: Failed to notify systemd 2月 22 15:33:58 kvm01 dnsmasq[2713]: read /etc/hosts - 4 addresses 2月 22 15:33:58 kvm01 dnsmasq[2713]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses 2月 22 15:33:58 kvm01 dnsmasq-dhcp[2713]: read /var/lib/libvirt/dnsmasq/default.hostsfile 2月 22 15:35:26 kvm01 systemd[1]: libvirtd.service operation timed out. Terminating.
解决方法:
网上google和baidu了很多资料,都没能解决此问题,在日志中也没能找到特别的蛛丝马迹,最后通过安装最新版本的CentOS7.3,重新配置完整后问题,问题解决。有时候人在陷入死胡同的时候,可以换一种思考方式,或许就能够解决问题。
[[email protected] ~]# systemctl status libvirtd.service ● libvirtd.service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2017-02-23 23:22:15 CST; 18min ago Docs: man:libvirtd(8) http://libvirt.org Main PID: 4189 (libvirtd) CGroup: /system.slice/libvirtd.service ├─2452 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper ├─2453 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper └─4189 /usr/sbin/libvirtd Feb 23 23:22:14 kvm01.saltstack.com systemd[1]: Starting Virtualization daemon... Feb 23 23:22:15 kvm01.saltstack.com systemd[1]: Started Virtualization daemon. Feb 23 23:22:15 kvm01.saltstack.com dnsmasq[2452]: read /etc/hosts - 2 addresses Feb 23 23:22:15 kvm01.saltstack.com dnsmasq[2452]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Feb 23 23:22:15 kvm01.saltstack.com dnsmasq-dhcp[2452]: read /var/lib/libvirt/dnsmasq/default.hostsfile
时间: 2024-10-15 12:53:52