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 ...
随机推荐
- 如何在静态方法或非Spring Bean中注入Spring Bean
在项目中有时需要根据需要在自己new一个对象,或者在某些util方法或属性中获取Spring Bean对象,从而完成某些工作,但是由于自己new的对象和util方法并不是受Spring所 ...
- Vue 入门之组件化开发
Vue 入门之组件化开发 组件其实就是一个拥有样式.动画.js 逻辑.HTML 结构的综合块.前端组件化确实让大的前端团队更高效的开发前端项目.而作为前端比较流行的框架之一,Vue 的组件和也做的非常 ...
- maven实战读书笔记(一)
环境变量设置 MAVEN_HOME:G:\maven-3.2\apache-maven-3.2.5 Path: G:\maven-3.2\apache-maven-3.2.5\bin 其实正确的设置应 ...
- Redux和React-Redux的实现(三):中间件的原理和applyMiddleware、Thunk的实现
现在我们的Redux和React-Redux已经基本实现了,在Redux中,触发一个action,reducer立即就能算出相应的state,如果我要过一会才让reducer计算state呢怎么办?也 ...
- YQCB冲刺周第六天
站立会议如上图 任务看板: 今天的任务为依旧为将用户记录的数据添加到数据库中,以及金额球的设置. 遇到的问题为金额球在jsp页面的显示.
- Chapter 1 概述
软件分为通用软件和应用软件,具有复杂.不可见和不断变化的特点:从出现到现在共经历了四个重要的发展阶段,但现在的软件发展依然存在着许多问题. 软件工程是采用工程的概念.原理.技术和方法来开发与维护软件, ...
- vs2013 CodeLens
那东西叫 CodeLens 只有VS2013 旗舰版 (update 2及以上) 才可以用,高级版 专业版都没有.如何打开CodeLens呢?在VS菜单栏 >> 工具 >> ...
- Leetcode题库——13.罗马数字转整数
@author: ZZQ @software: PyCharm @file: Luoma2Int.py @time: 2018/9/16 17:06 要求: 罗马数字转数字 字符 数值 I 1 V 5 ...
- grunt入门讲解3:实例讲解使用 Gruntfile 配置任务
这个Gruntfile 实例使用到了5个 Grunt 插件: grunt-contrib-uglify grunt-contrib-qunitgrunt-contrib-concatgrun ...
- css中对position的几种定位方式的最佳诠释
关于元素的position定位的理解,牛客网的hardy给出了一个比较好的理解: 在html中网页可以看成一个立体的空间,一个完整的页面是由很多个页面堆积形成的,如上图所示 CSS中Positio ...