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 解决办法

原文地址:https://www.cnblogs.com/hy007x/p/10560301.html

时间: 2024-12-28 18:14:56

error: failed to connect to the hypervisor error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory 解决办法的相关文章

fatal error C1083: Cannot open type library file: 'swpublished.tlb': No such file or directory 解决办法

在平台VC++2005 ,VC++2010 或是VC+2012 上使用 SolidWorks API SDK模板对Solidworks进行二次开发的时候 新建了一个项目在生成的时候总是得到下面的错误信息,现将解决办法分享出来! Error Information: Error 1 fatal error C1083: Can not open type library file: 'swpublished.tlb': No such file or directory c: \ users \

对于在vs下写C++程序遇到:>......\picture_2_3.cpp(4): fatal error C1083: 无法打开包括文件:“iostream.h”: No such file or directory 解决办法

1.在vs下C++数输入输出函数的头文件为: #include <iostream>     //注意这里没有.h作为头文件的标志. 引用输入输出时 std::cout<<image.size()<<'\t'<<image.type()<<'\n'; std::cout<<result.size()<<'\t'<<result.type()<<'\n'; 加上域名!!!!! 还有一点vs下不识别en

mysql start error ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysql.sock’ (2)

When I type mysql, it shows “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysql.sock’ (2)”. Then I try to start mysql service: $ service mysql start But then I get error “ No directory, logging in with HOME=

(MYSQL)ERROR 2002 (HY000): Can&#39;t connect to local MySQL server through socket &#39;/var/run/mysqld/mysqld.sock&#39; (2)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 方案1. 1.#ps -A|grep mysql 显示类似: 1829 ?        00:00:00 mysqld_safe   1876 ?        00:00:31 mysqld 2.#kill -9 1829 3.#kill -9 1876 4.#/etc/init.d/

ERROR 2002 (HY000): Can&#39;t connect to local MySQL server through socket &#39;/var/run/mysqld/mysqld.sock&#39;

今天mysql不知道犯啥病,root登录的时候一直报这个错误. 在国内网站找了找,没什么合适的 答案,在stackoverflow和ubuntu的一个社区上找到了答案,搞定了,但是没太看懂,记录一下,以后再翻. That said, Here is what I did/ found out: 1. You don't have to change the tmp directory in the my.cnf file. Even adding a second directory, chan

问题:Custom tool error: Failed to generate code for the service reference &#39;AppVot;结果:添加Service Reference, 无法为服务生成代码错误的解决办法

添加Service Reference, 无法为服务生成代码错误的解决办法 我的解决方案是Silverlight+WCF的应用,Done Cretiria定义了需要在做完Service端的代码后首先运行事先定义好的Unit Test,确保在客户端使用Service之前Service是可以正确的运行的.在我创建Unit Test之前,需要在测试项目中添加对WCF Service的引用,而这时却出现了错误. Custom tool error: Failed to generate code for

ERROR 2002 (HY000): Can&#39;t connect to local MySQL server through socket &#39;/var/run/mysqld/mysqld.sock&#39; (2)

First make a backup of your /var/lib/mysql/ directory just to be safe. sudo mkdir /home/<your username>/mysql/ cd /var/lib/mysql/ sudo cp * /home/<your username>/mysql/ -R Next purge MySQL (this will remove php5-mysql and phpmyadmin as well as

mysql之ERROR 2002 (HY000): Can&#39;t connect to local MySQL server through socket &#39;/var/run/mysqld/mysqld.sock&#39;解决方法

LAMPP安装完成之后,mysql -u root -p连不上,报这个错误: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' 在mysql的配置文件里,/opt/lampp/etc/my.cnf, 发现了这样的配置: [java] <SPAN style="FONT-SIZE: 24px"># The following

error: &#39;Can&#39;t connect to local MySQL server through socket &#39;/var/run/mysqld/mysqld.sock&#39; (2)&#39;

http://stackoverflow.com/questions/11990708/error-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysq 1. pkill -9 mysqld 2. rm -f /var/run/mysqld/mysqld.pid 3. chmod 777 '/var/run/mysqld/mysqld.sock done error: 'Can't connect to loc