文档首页 > > 故障案例> KVM虚拟化 故障案例>

libvirtd服务无法启动

libvirtd服务无法启动

分享
更新时间:2021/03/23 GMT+08:00

问题现象

启动libvirtd服务时,显示如下错误信息:

[root@bogon libvirt-4.5.0]# service libvirtd restart
Redirecting to /bin/systemctl restart libvirtd.service
[root@bogon libvirt-4.5.0]# virsh version
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
 
[root@bogon libvirt-4.5.0]# systemctl status libvirtd.service
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Mon 2019-08-12 19:18:53 HKT; 39s ago
     Docs: man:libvirtd(8)
           https://libvirt.org

问题原因

原因有很多,需要根据systemctl status libvirtd.service的返回查看根因。

此处根据报错怀疑是网络初始化失败引起的。

[root@bogon libvirt-4.5.0]# systemctl status libvirtd.service
● libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2019-08-12 19:18:53 HKT; 39s ago
Docs: man:libvirtd(8)
https://libvirt.org
Process: 86914 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 86914 (code=exited, status=0/SUCCESS)
Tasks: 2 (limit: 32768)
CGroup: /system.slice/libvirtd.service
├─11836 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
└─11837 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper

Aug 12 19:18:53 bogon systemd[1]: Started Virtualization daemon.
Aug 12 19:18:53 bogon libvirtd[86914]: 2019-08-12 11:18:53.095+0000: 86930: info : libvirt version: 4.5.0, package: 10.el7 (CentOS BuildSystem <http://bugs.centos.org>, 2018-11-03-08:45:3...ys.centos.org)
Aug 12 19:18:53 bogon libvirtd[86914]: 2019-08-12 11:18:53.095+0000: 86930: info : hostname: bogon
Aug 12 19:18:53 bogon libvirtd[86914]: 2019-08-12 11:18:53.095+0000: 86930: error : virNetworkObjAssignDefLocked:589 : operation failed: network 'default' already exists with uuid 7442d10...3-fc2e6122b69b
Aug 12 19:18:53 bogon dnsmasq[11836]: read /etc/hosts - 2 addresses
Aug 12 19:18:53 bogon dnsmasq[11836]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Aug 12 19:18:53 bogon dnsmasq-dhcp[11836]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Aug 12 19:18:53 bogon libvirtd[86914]: 2019-08-12 11:18:53.269+0000: 86930: error : netcfStateInitialize:95 : internal error: failed to initialize netcf
Aug 12 19:18:53 bogon libvirtd[86914]: 2019-08-12 11:18:53.269+0000: 86930: error : virStateInitialize:667 : Initialization of netcf state driver failed: internal error: failed to initialize netcf
Aug 12 19:18:53 bogon libvirtd[86914]: 2019-08-12 11:18:53.269+0000: 86930: error : daemonRunStateInit:806 : Driver state initialization failed
Hint: Some lines were ellipsized, use -l to show in full.

处理步骤

通过重启网络服务解决。

1
service network restart
Restarting network (via systemctl):                        [  OK  ]
1
service libvirtd restart
Redirecting to /bin/systemctl restart libvirtd.service
1
virsh version
Compiled against library: libvirt 4.5.0
Using library: libvirt 4.5.0
Using API: QEMU 4.5.0
Running hypervisor: QEMU 4.0.0
分享:

    相关文档

    相关产品