LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 10-15-2013, 02:44 AM   #1
funboy
Member
 
Registered: Jul 2011
Posts: 49

Rep: Reputation: Disabled
KVM does not connect to and throw errors


Hello,

I am facing problems while I'm trying to install virtual machine. When I first run the virt-manager, I am able to install new virtual machine but when I try to start it the virt-manager show an error "Unable to connect to libvirt." and "Verify that the 'libvirtd' daemon is running."
The details are:

Code:
Unable to connect to libvirt.

Verify that the 'libvirtd' daemon is running.

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1027, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1009, in _try_open
    flags)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
Note, I was trying to fix this and I re-installed all required packages on my Slackware distribution but the result is the same.
 
Old 10-15-2013, 03:38 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Did you check if its running?

/etc/rc.d/rc.libvirt start # should start it

Else checkout this page http://docs.slackware.com/howtos:gen...in:kvm_libvirt
 
Old 10-15-2013, 09:11 AM   #3
funboy
Member
 
Registered: Jul 2011
Posts: 49

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by zhjim View Post
Did you check if its running?

/etc/rc.d/rc.libvirt start # should start it

Else checkout this page http://docs.slackware.com/howtos:gen...in:kvm_libvirt
Hi zhjim,

Yes the /etc/rc.d/rc.libvirt is running. I think here is something wrong - when I restart the deamon I saw that there is no such process but the /etc/rc.d/rc.libvirt shows there is running process

Code:
bash-4.2# /etc/rc.d/rc.libvirt stop 
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
Waiting machineserror: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused

error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
Stopping libvirtd...
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused

/etc/rc.d/rc.libvirt: line 101: kill: (2814) - No such process

bash-4.2# /etc/rc.d/rc.libvirt start
libvirt is already running...
bash-4.2# 
bash-4.2# 
bash-4.2# ps -ef | grep libvirt
root     20709  4541  0 17:09 pts/0    00:00:00 grep libvirt
bash-4.2#
But this is only when I restart the deamon if I run it when the system is rebooted the status is OK and there is such process indeed.
 
Old 10-15-2013, 09:34 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
The output of ps -ef only shows your grep command so I'd say the daemon is not running and rc.libvirt statement about the service running is false.

Okay lets check if the socket is there
ls /var/run/libvirt -lh

If there make sure you are allowed to access it. For this edit /etc/libvirt/libvirtd.conf. The link I gave you has some more details for this. Might be enough if you add root to the libvirt group. Check /etc/group for the correct name of the group. After adding your self to the group don't forget to logout and back in again. Else the groups don't take effect.

You might also try to start libvirtd by hand. Not sure where its installed. Either use tab completion or the find command to get the path.
 
Old 10-16-2013, 12:14 PM   #5
funboy
Member
 
Registered: Jul 2011
Posts: 49

Original Poster
Rep: Reputation: Disabled
Hmm strange,
Code:
bash-4.2# ls /var/run/libvirt -lh
total 28K
srwxrwx--- 1 root root    0 Oct 16 11:13 libvirt-sock
srwxrwxrwx 1 root root    0 Oct 16 11:13 libvirt-sock-ro
-rw-r--r-- 1 root root    4 Oct 16 11:13 libvirtd.pid
drwxr-xr-x 2 root root 4.0K Oct 14 19:18 lockd
drwxr-xr-x 2 root root 4.0K Oct 14 19:18 lxc
drwxr-xr-x 2 root root 4.0K Oct 16 11:13 network
drwxr-xr-x 2 root root 4.0K Oct 16 19:54 qemu
drwxr-xr-x 2 root root 4.0K Oct 14 19:18 uml
drwxr-xr-x 2 root root 4.0K Jul  2 12:49 uml-guest
bash-4.2#
I changed libvirt-sock and libvirt-sock-ro to be root:root they were root:users.
Also from the /etc/group
Code:
bash-4.2# grep libvirt /etc/group 
libvirtd:x:1006:root,funboy
bash-4.2#
Here the group is uncomented config file:
Code:
bash-4.2# grep -v ^# /etc/libvirt/libvirtd.conf
listen_tls = 0
unix_sock_group = "users"
unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770"
unix_sock_dir = "/var/run/libvirt"
auth_unix_ro = "none"
auth_unix_rw = "none"
ca_file = "/etc/ssl/certs/cacert.org.pem"
bash-4.2#
But I think the key is that the scrip reports both that the process is running and not running ?!
This come from when I execute /etc/rc.d/rc.libvirt stop - says no such process
but /etc/rc.d/rc.libvirt start - already running
 
Old 10-17-2013, 02:00 AM   #6
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Im a bit puzzled here. As the socket exists and the permissions at least for root are good there should be no problem connecting. And the default permission for the group users is okay. But this has do be evaluated later I'd say when we have access going. The config file just sets up some sane permission for the two sockets and also disables policy kit with the two lines of auth_unix_ro = "none" auth_unix_rw = "none". At least according to the link.

Did you try any other libvirt binary besides virtmanager? Maybe virsh? I just want to rule out that there are any other hurdles we are tripping.

Can you setup any logging for libvirt? Maybe over the configuration file that may show us why access to the socket is denied. Same goes for virtmanager or any other tool that access the libvirt socket.

Maybe the first thing to achieve here is that the daemon is started all good on reboot and then go from there. So you can rule out one piece after another.
 
Old 10-18-2013, 03:52 AM   #7
funboy
Member
 
Registered: Jul 2011
Posts: 49

Original Poster
Rep: Reputation: Disabled
I rebooted my machine again : (

But now the settings are different - the socets are root:users
Code:
bash-4.2# virt-install 
ERROR    Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
bash-4.2# ls -la /var/run/libvirt/libvirt-sock
srwxrwx--- 1 root users 0 Oct 18 11:25 /var/run/libvirt/libvirt-sock
bash-4.2# ls -la /var/run/libvirt/
total 36
drwxr-xr-x  8 root root  4096 Oct 18 11:25 .
drwxr-xr-x 20 root root  4096 Oct 18 11:21 ..
srwxrwx---  1 root users    0 Oct 18 11:25 libvirt-sock
srwxrwxrwx  1 root users    0 Oct 18 11:25 libvirt-sock-ro
-rw-r--r--  1 root root     4 Oct 18 11:25 libvirtd.pid
drwxr-xr-x  2 root root  4096 Oct 14 19:18 lockd
drwxr-xr-x  2 root root  4096 Oct 14 19:18 lxc
drwxr-xr-x  2 root root  4096 Oct 18 11:25 network
drwxr-xr-x  2 root root  4096 Oct 18 11:32 qemu
drwxr-xr-x  2 root root  4096 Oct 14 19:18 uml
drwxr-xr-x  2 root root  4096 Jul  2 12:49 uml-guest
bash-4.2#
But before trying to install new VM with the virt-manager I installed a VM with virt-install !!! : )
But unfortunately the strange behavior of the daemon still persist.
 
  


Reply

Tags
kvm, slackware



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] "No KVM, No qemu-kvm" Available error while trying to install KVM on CentOS 6.3 sriramdas Linux - Virtualization and Cloud 5 01-01-2013 10:46 AM
KVM Guest network unable to connect to Host in CentOS-6.3 mglaris Linux - Virtualization and Cloud 5 10-05-2012 05:01 AM
KVM Switch causes error: Connect-debounce failed, port 4 disabled scottgutman Linux - Hardware 2 02-02-2012 07:14 PM
Howto connect physical NIC's to a firewall guest only in qemu-kvm environment JaRuKat Linux - Networking 0 11-04-2011 06:54 PM
[Debian/Qemu/KVM] Why qemu --enable-kvm works but not kvm directly? gb2312 Linux - Virtualization and Cloud 2 03-21-2011 02:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 08:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration