admin 发表于 2018-11-29 15:16:37

ERROR Failed to connect socket to '/var/run/libvirt/libvirt-sock'

virshlist
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory


解决办法:
# yum install -y avahi
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package avahi.x86_64 0:0.6.31-15.el7_2.1 will be installed
--> Processing Dependency: avahi-libs = 0.6.31-15.el7_2.1 for package: avahi-0.6.31-15.el7_2.1.x86_64
--> Running transaction check
---> Package avahi-libs.x86_64 0:0.6.31-15.el7 will be updated
--> Processing Dependency: avahi-libs = 0.6.31-15.el7 for package: avahi-autoipd-0.6.31-15.el7.x86_64
---> Package avahi-libs.x86_64 0:0.6.31-15.el7_2.1 will be an update
--> Running transaction check
---> Package avahi-autoipd.x86_64 0:0.6.31-15.el7 will be updated
---> Package avahi-autoipd.x86_64 0:0.6.31-15.el7_2.1 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================================================
Package                                       Arch                                 Version                                           Repository                               Size
======================================================================================================================================================================================
Installing:
avahi                                       x86_64                                 0.6.31-15.el7_2.1                                 updates                                 263 k
Updating for dependencies:
avahi-autoipd                                 x86_64                                 0.6.31-15.el7_2.1                                 updates                                  39 k
avahi-libs                                    x86_64                                 0.6.31-15.el7_2.1                                 updates                                  61 k
Transaction Summary
======================================================================================================================================================================================
Install1 Package
Upgrade             ( 2 Dependent packages)
Total download size: 363 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): avahi-0.6.31-15.el7_2.1.x86_64.rpm                                                                                                                      | 263 kB00:00:00   
(2/3): avahi-libs-0.6.31-15.el7_2.1.x86_64.rpm                                                                                                               |61 kB00:00:00   
(3/3): avahi-autoipd-0.6.31-15.el7_2.1.x86_64.rpm                                                                                                            |39 kB00:00:00   
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                 5.4 MB/s | 363 kB00:00:00   
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating   : avahi-libs-0.6.31-15.el7_2.1.x86_64                                                                                                                              1/5
Installing : avahi-0.6.31-15.el7_2.1.x86_64                                                                                                                                     2/5
Updating   : avahi-autoipd-0.6.31-15.el7_2.1.x86_64                                                                                                                           3/5
Cleanup    : avahi-autoipd-0.6.31-15.el7.x86_64                                                                                                                                 4/5
Cleanup    : avahi-libs-0.6.31-15.el7.x86_64                                                                                                                                    5/5
Verifying: avahi-0.6.31-15.el7_2.1.x86_64                                                                                                                                     1/5
Verifying: avahi-autoipd-0.6.31-15.el7_2.1.x86_64                                                                                                                           2/5
Verifying: avahi-libs-0.6.31-15.el7_2.1.x86_64                                                                                                                              3/5
Verifying: avahi-autoipd-0.6.31-15.el7.x86_64                                                                                                                                 4/5
Verifying: avahi-libs-0.6.31-15.el7.x86_64                                                                                                                                    5/5
Installed:
avahi.x86_64 0:0.6.31-15.el7_2.1                                                                                                                                                   
Dependency Updated:
avahi-autoipd.x86_64 0:0.6.31-15.el7_2.1                                                    avahi-libs.x86_64 0:0.6.31-15.el7_2.1                                                   
Complete!

# systemctl restart libvirtd.service

admin 发表于 2018-11-29 15:17:24

error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory



文件有可能存在,但是找不到(我的就是这样 明明有这个文件,还说找不到,ln -s // 也不行)





我是这样处理的,1我去换成ustc的源

sudo vi /etc/apt/sources.list



deb http://debian.ustc.edu.cn/debian stable main non-free contrib
deb-src http://debian.ustc.edu.cn/debian stable main non-free contrib
deb http://debian.ustc.edu.cn/debian proposed-updates main contrib non-free
deb-src http://debian.ustc.edu.cn/debian proposed-updates main contrib non-free
deb http://debian.ustc.edu.cn/debian-security stable/updates main



deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial main main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse


(其他的源请自查)



2安装kvm

sudo apt-get install kvm



3卸载virt-manager .再安装一遍(可能是以前安装的少了什么东西)

sudo apt-get autoremove virt-manager

sudo apt-get install virt-manager



4去 /var/run/libvirt给 libvirt-socklibvirt-sock-ro virtlockd-sock 仨文件加权限 (据说 只加libvirt-sock 就行)
sudo chmod -R 777 libvirt-sock
sudo chmod -R 777 libvirt-sock-ro
sudo chmod -R 777 virtlockd-sock



5重启服务

service libvirtd restart



6 启动 virt-manager



来源:CSDN
原文:https://blog.csdn.net/timo1160139211/article/details/72848023
版权声明:本文为博主原创文章,转载请附上博文链接!

admin 发表于 2018-11-29 15:23:24

# systemctl start libvirtd.service
实际上就是没有启动libvirtd的服务,好尴尬。
页: [1]
查看完整版本: ERROR Failed to connect socket to '/var/run/libvirt/libvirt-sock'