Xen + Virt-Manager: Unable to connect to 'localhost:8000': Connection refused

Bug #915954 reported by Ramin.Honary
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
libvirt
New
Medium
Unassigned
libvirt (Ubuntu)
Fix Released
Medium
Stefan Bader
virt-manager (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

The error message dialog contains this text:

Unable to open a connection to the Xen hypervisor/daemon.

Verify that:
 - A Xen host kernel was booted
 - The Xen service has been started

unable to connect to 'localhost:8000': Connection refused

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1146, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1130, in _try_open
    flags)
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: unable to connect to 'localhost:8000': Connection refused

------------------------------------------------------------
I have just used Aptitude to install Xen-4.1 and the Libvirt package. There are two bugs here:
Bug #1. I must modify /etc/grub.d by hand:
    mv 10_linux 20_linux
    mv 20_linux_xen 10_linux_xn
    update-grbu2
    reboot
This should have been done by Apt-get, I had to do it by hand. Once this is done, I can verify the hypervisor is running with the command:
    xl info

Bug #2. Virt-manager does not work "out of the box". I cannot use Virsh, Virt-manager, or even Virt-install. Executing Virt-install returns this error:
    ERROR unable to connect to 'localhost:8000': Connection refused

Can anyone please suggest to me a way to solve this issue?

In any case, the fact that Ubuntu's Apt-get installs a Xen/Virt-manager configuration that does not function properly without tweaking, I believe, is definitely a bug.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: virt-manager 0.9.0-1ubuntu3
ProcVersionSignature: Ubuntu 3.0.0-14.23-generic-pae 3.0.9
Uname: Linux 3.0.0-14-generic-pae i686
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Fri Jan 13 20:10:40 2012
ExecutablePath: /usr/share/virt-manager/virt-manager.py
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_US:en
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: virt-manager
UpgradeStatus: Upgraded to oneiric on 2011-10-14 (90 days ago)

Revision history for this message
Ramin.Honary (ramin-honary) wrote :
summary: - Unable to connect to 'localhost:8000': Connection refused
+ Xen + Virt-Manager: Unable to connect to 'localhost:8000': Connection
+ refused
Revision history for this message
Ramin.Honary (ramin-honary) wrote :

I have found a workaround:

In the /etc/xen/xend-config.sexp file, find and uncommont the lines:
    (xend-unix-server no)
    (xend-unix-path /var/lib/xend/xend-socket)
and change the "(xend-unix-server no)" line to "yes":
    (xend-unix-server yes)

Then reboot.

I request Ubuntu package maintainers add some kind of installation task to the "libvirt" or "virt-manager" package that automatically modifies the "/etc/xen/xend-config.sexp" file so long as the file has not been modified since the time it was installed.

Revision history for this message
Ramin.Honary (ramin-honary) wrote :

Another problem I have discovered with the package installation:

When I try to create a virtual machine instance, I get the error:
Unable to complete install: 'POST operation failed: xend_post: error from xen daemon: (xend.err "Error creating domain: device model '/usr/lib/xen/bin/qemu-dm' not found")'

It appears the "/usr/lib/xen" symbolic link is called "/usr/lib/xen/xen-default". I must manually create a symbolic link to the current version of Xen on my system.

This should be done when I install "virt-manager" or "libvirt" with apt-get, that or the "virt-manager" and "virsh" programs must be configured to point to the correct location in "/usr/lib".

Revision history for this message
Stefan Bader (smb) wrote :

Problem from comment #3 should be solved by changes for bug #914788.

Revision history for this message
marko (markoschuetz) wrote :

Where you get

(xend.err "Error creating domain: device model '/usr/lib/xen/bin/qemu-dm' not found")'

I get

(xend.err "Error creating domain: device model '/usr/lib64/xen/bin/qemu-dm' not found")'

This is on an x86_64 laptop.

What seems the proper way to fix this?

Revision history for this message
Ramin.Honary (ramin-honary) wrote :

If you have the same problem I had, that should fix it. You may want to do this command first:
    find /usr/lib64 -name qemu-dm

And see if this output appears:
    /usr/lib64/xen-default/bin/qemu-dm

If so, the then for /usr/lib64, it is probably the same problem. To fix it, execute this command as root:
    ln -s /usr/lib64/xen-default /usr/lib64/xen

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in virt-manager (Ubuntu):
status: New → Confirmed
Revision history for this message
Thiago Martins (martinx) wrote :

Guys,

This problem still persist with Ubuntu 14.04 (devel branch).

Unable to use Xen using Virt-Manager... An error appear:

---
Unable to connect to libvirt.

unable to connect to 'localhost:8000': Connection refused

Verify that the 'libvirtd' daemon is running
on the remote host.
---

While at the console, I can run `virsh list --all` without any problems (also "xm info" works).

Any clue?!

I already did the following steps:

1- Xen flavor enabled @ Grub;

2- "(xend-unix-server yes)" at "/etc/xen/xend-config.sxp" (socket path okay too);

3- ln -s /usr/lib/xen-4.3 /usr/lib/xen;

But, the problem persist... Virt-Manager doesn't connect (out-of-the-box) at Xen on Ubuntu, I have a old 64 bits CPU which supports only PVM and I would like to use it... :-/

Best,
Thiago

Revision history for this message
Thiago Martins (martinx) wrote :

After enabling:

(xend-http-server yes)
(xend-port 8000)

The problem disappeared but another appeared, which is:

---
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/lib/python2.7/dist-packages/libvirt.py", line 105, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: internal error: failed to parse Xend response return code
---

Tips?!

Tks!
Thiago

Revision history for this message
Stefan Bader (smb) wrote :

When using the xm toolstack with Xen with libvirt, only the xend-unix-server needs to be set to yes (not the http one). With 14.04 there has been some bad versions of libvirt, which caused problems. Make sure you are on libvirt 1.2.1.

Revision history for this message
Sydney Meyer (syd-meyer) wrote :

Hi there,

potential patch to the issue posted from Jim Fehlig on libvirt list.

Will be included in the next release.

http://lists.alioth.debian.org/pipermail/pkg-libvirt-maintainers/2014-January/004923.html
https://bugzilla.redhat.com/show_bug.cgi?id=1055165

Cheers,

S.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 915954] Re: Xen + Virt-Manager: Unable to connect to 'localhost:8000': Connection refused

Thanks. I see it is in upstream git as commit
37564b471da7e9080284149f8350241afd448515 . We can certainly cherrypick
that.

 affects: libvirt
 status: triaged
 importance: medium

Changed in libvirt (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Stefan Bader (smb) wrote :

I am on it

Changed in virt-manager (Ubuntu):
status: Confirmed → Invalid
Changed in libvirt (Ubuntu):
assignee: nobody → Stefan Bader (smb)
Revision history for this message
Stefan Bader (smb) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libvirt - 1.2.1-0ubuntu5

---------------
libvirt (1.2.1-0ubuntu5) trusty; urgency=low

  * cherry-pick "xen: fix parsing xend http response" from upstream
    git to fix connecting to xex in xm/xend mode (LP: #915954)
 -- Stefan Bader <email address hidden> Thu, 30 Jan 2014 10:05:31 +0000

Changed in libvirt (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.