error: failed to connect to the hypervisor error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory 解决办法
服务器版本:CentOS Linux release 7.4
Linux lb 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
参考:https://www.cnblogs.com/yogurtwu/p/9988974.html
注:在翻了很多baidu和google相关文章后,逐步排查,根据手动执行libvirtd命令出现的报错信息才查到解决方法。一路坑。
对装有kvm虚拟机的服务器执行了安装libguestfs-tools后,发现出现了故障。
执行virsh list命令后会报以下错误:

virsh list
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
执行systemctl status libvirtd后报错:

● libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit) since Tue 2019-03-19 16:44:52 CST; 49min ago
Docs: man:libvirtd(8)
https://libvirt.org
Process: 21280 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=3)
Main PID: 21280 (code=exited, status=3)
Tasks: 2 (limit: 32768)
CGroup: /system.slice/libvirtd.service
├─1007 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
└─1008 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
Mar 19 16:44:52 develop systemd[1]: Failed to start Virtualization daemon.
Mar 19 16:44:52 develop systemd[1]: Unit libvirtd.service entered failed state.
Mar 19 16:44:52 develop systemd[1]: libvirtd.service failed.
Mar 19 16:44:52 develop systemd[1]: libvirtd.service holdoff time over, scheduling restart.
Mar 19 16:44:52 develop systemd[1]: Stopped Virtualization daemon.
Mar 19 16:44:52 develop systemd[1]: start request repeated too quickly for libvirtd.service
Mar 19 16:44:52 develop systemd[1]: Failed to start Virtualization daemon.
Mar 19 16:44:52 develop systemd[1]: Unit libvirtd.service entered failed state.
Mar 19 16:44:52 develop systemd[1]: libvirtd.service failed.
执行systemctl restart libvirtd后报错:

Job for libvirtd.service failed because start of the service was attempted too often. See "systemctl status libvirtd.service" and "journalctl -xe" for details.
To force a start use "systemctl reset-failed libvirtd.service" followed by "systemctl start libvirtd.service" again.
原因:
因为依赖安装了某些包(比如libguestfs-tools)后,跟着KVM相关的软件也跟着升级,但是CentOS7.4无法运行这个版本的libvirt,最简单粗暴的做法就是移除该模块,重启libvirtd。
解决办法:
mv /usr/lib64/libvirt/storage-backend/libvirt_storage_backend_rbd.so /usr/lib64/libvirt/storage-backend/libvirt_storage_backend_rbd.so-bak
systemctl restart libvirtd
再次执行virsh list,正常了:


error: failed to connect to the hypervisor error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory 解决办法的更多相关文章
- rpm: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory解决办法
不多说,直接上干货! 问题详情 [root@bigdatamaster app]# rpm -qa | grep gcc rpm: error : cannot open shared object ...
- iis服务器php环境 failed to open stream: No such file or directory解决办法
项目主机用的windows系统,iis服务器:远程连接桌面—>本地资源->映射D盘驱动器,将本地d盘修改后的文件放在远程主机项目目录里,访问报出failed to open stream: ...
- ././include/linux/kconfig.h:4:32: fatal error: generated/autoconf.h: No such file or directory 解决办法
我在编写内核驱动模块的时候报了一个非常奇怪的错误,如下图: 在目录下看了一下确实没有发现这个文件,感觉很奇怪,因为我记得之前编译模块是没有错误的,所以不可能是我代码写的有问题. 查阅了资料很多说要清除 ...
- command ' cl.exe' failed: No such file or directory解决办法
1.安装C ++编译器 https://pan.baidu.com/s/1D1-tM-mWO4TVLdTrh3k1GA 提取码:ym67 2.找到安装文件夹:Visual C++ Build T ...
- 解决:error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
在使用 deamon@deamon-H55M-S2:/usr/bin$ mysqladmin -u root -p shutdown 关闭MySQL之后试图通过: deamon@deamon-H55M ...
- mysql之ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'解决方法
LAMPP安装完成之后,mysql -u root -p连不上,报这个错误: ERROR 2002 (HY000): Can't connect to local MySQL server throu ...
- 【error】: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
错误描述如下: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) ...
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)-mysql.sock丢失解决方案
我们的LAMP是搭建在UBUNTU 12.04 LTS上的. LAMP是通过编译的方式进来安装的. 在一次处理意外挂机时由于未知的原因在重启后发现无法连接数据库了, 在打开网站时出现如下的的提示: E ...
- Running MYSQL 5.7 By Bash On Ubuntu On Windows:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
root@PC-RENGUOQIANG:/usr/sbin# /etc/init.d/mysql start * Starting MySQL database server mysqld [ OK ...
随机推荐
- HTML常用头部变量
简例:访问baidu的头部 GET /?tn=98827400_hao_pg HTTP/1.1 Host: www.baidu.com Connection: keep-alive Cache-Con ...
- 大华摄像头WEB页面集成
对于海康.大华的摄像头web页面内的集成方式,根据浏览器类型,通常是采用以下形式: IE内核:调用ocx控件 例如: <object width="100%" height= ...
- OO学习总结与体会
前言 经过了对于面向对象程序设计的一个月的学习,我初尝了JAVA以及面向对象程序的魅力.经历了三次难度逐渐加大的课后编程作业,我对于工程化面向对象编程以及调试有了深刻的认识与颇多感想.我写下本篇文章以 ...
- java语言复制数组的四种方法
JAVA语言的下面几种数组复制方法中,哪个效率最高? B.效率:System.arraycopy > clone > Arrays.copyOf > for循环 1.System.a ...
- java集合ArrayList
基于jdk_1.8.0 关于List,主要是有序的可重复的数据结构.jdk主要实现类有ArrayList(底层使用数组).LinkedList(底层使用双向链表) ArrayList: (一)继承关系 ...
- 第二章 Socket用法详解
构造Socket Socket构造方法如下: Socket() //Creates an unconnected socket, with the system-default type of Soc ...
- Few-Shot/One-Shot Learning
Few-Shot/One-Shot Learning指的是小样本学习,目的是克服机器学习中训练模型需要海量数据的问题,期望通过少量数据即可获得足够的知识. Matching Networks for ...
- 解决将easyui里的combobox里的输入框下拉列表变为空值
jQuery easyui官网上有一个方法是 :clear方法,这个方法说是能清除数据,但我测试了,结果它确实清楚了(但他清除的只是输入框显示的数据,没有清除所有的数据),在这里巧妙的用 它加载数据的 ...
- Ubuntu安装使用中的一些注意事项
在win7上安装VMware workstations10.0 ,在VMware workstations10.0上安装Ubuntu14.04 64位时,关于网络的连接注意: win7 网络连接里上的 ...
- [C/C++] C++ Primer学习笔记
记录下自己掌握不清楚的概念和用法... Day 1 endl:具有输出换行的效果,并刷新与设备相关联的缓冲区. 注:在调试程序过程中插入的输出语句都应刷新输出流,否则可能会造成程序崩溃,将会导致程序出 ...