qemu:///sessions fail, when libvirtd hasn't been started properly before

Bug #1074418 reported by H.-R. Oberhage
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Fix Released
High
Unassigned
Quantal
Fix Released
High
Unassigned

Bug Description

Impact:
clients using qemu:///session fail to contact the server, that makes e.g gnome-boxes fail to work correctly

Test case:
- run "virsh -c qemu:///session"

it hits this in quantal "error: failed to connect to the hypervisor", with the fix it should work

Regression potential:
Limited, that commit is only setting some extra environment variables

-----

Starting with 12.10 the libvirt communications mechanism uses the "XDG_RUNTIME_DIR" environment variable to determine the directory to put in its pipe(s) and controlling files - this normally being "/run/user/$USER/libvirt".

Now when you run a qemu user(!) session (qemu:///session) and a 'libvirtd'-process owned by the user hasn't already be spawned - e.g. manually - libvirt0 will spawn one itself. When manually spawned from a terminal window, "XDG_RUNTIME_DIR" is properly set up to "/run/user/$USER" and everything works well with libvirtd. When libvirt0 spawns the libvirtd, it will use $HOME/.cache/libvirt, the previous (up to and including 12.04) location for this, because this seems to be its fallback-default.

Thus when you start such a session with "virsh -c qemu:///session" or vitual-manager, respectively, it will fail, saying

error: Failed to connect socket to '/run/user/$USER/libvirt/libvirt-sock': No such file or directory
error: failed to connect to the hypervisor

in the former case.

Either "XDG_RUNTIME_DIR" is not properly set when libvirt spawns libvirtd, or it is not respected. My assumption is the former, as "XDG_RUNTIME_DIR" seems to be set by some 'pam'-module, that probably isn't used when libvirt exececutes libvirtd.

As a workaround one can set "XDG_RUNTIME_DIR=.cache" in the environment calling "virsh" or "virtual-manager", the everything uses the old/former settings and works.

The problem seems to be to tell libvirt about the proper "XDG_RUNTIME_DIR" contents or make it the new default.

The way it is now, qemu-user-sessions will just fail when started by virsh or virt-manager.

By the way, you can test it even with a 'live'-system (USB/DVD) by just adding the libvirt-bin and/or virt-manager packages, thus it is not dependent on the version of the packages installed on the actual system.

Nevertheless as I can't see if that information is attached otherwise, here are the system data you require:
Description: Ubuntu 12.10
Release: 12.10
libvirt0:
  Installed: 0.9.13-0ubuntu12
  Candidate: 0.9.13-0ubuntu12
  Version table:
 *** 0.9.13-0ubuntu12 0
        500 http://de.archive.ubuntu.com/ubuntu/ quantal/main i386 Packages
        100 /var/lib/dpkg/status

Best regards.

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: libvirt0 0.9.13-0ubuntu12
ProcVersionSignature: Ubuntu 3.5.0-17.28-generic 3.5.5
Uname: Linux 3.5.0-17-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 2.6.1-0ubuntu6
Architecture: i386
Date: Fri Nov 2 17:13:51 2012
InstallationDate: Installed on 2011-03-05 (608 days ago)
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007.1)
MarkForUpload: True
SourcePackage: libvirt
UpgradeStatus: Upgraded to quantal on 2012-10-26 (6 days ago)

Revision history for this message
H.-R. Oberhage (oberhage) wrote :
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in libvirt (Ubuntu):
status: New → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, the issue should be fixed with 1.0 in raring, the commit fixing it seems to be http://libvirt.org/git/?p=libvirt.git;a=patch;h=efe6c8021146d046846ead5b5efc9828d97c1ceb ... I'm looking at backporting it to quantal

Changed in libvirt (Ubuntu):
status: Confirmed → Fix Released
importance: Undecided → High
Changed in libvirt (Ubuntu Quantal):
importance: Undecided → High
status: New → In Progress
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello H.-R., or anyone else affected,

Accepted libvirt into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/libvirt/0.9.13-0ubuntu12.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in libvirt (Ubuntu Quantal):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
H.-R. Oberhage (oberhage) wrote :

Hello Brian,

I did test your patch in a i386 environment with version 0.9.13-0ubuntu12.1 of libvirt0, libvirt-bin, libvirt-dev, libvirt-doc, and python-libvirt - it ran fine! Thank you very much! [I didn't install 'libvirt0-dbg'.]

Thanks for the quick reaction-time, too!

Best wishes.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Scott Kitterman (kitterman) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

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

This bug was fixed in the package libvirt - 0.9.13-0ubuntu12.1

---------------
libvirt (0.9.13-0ubuntu12.1) quantal-proposed; urgency=low

  * git_set_xdg_env.patch: correctly define the xdg environment,
    otherwise the clients can fail to locate the service (lp: #1074418)
 -- Sebastien Bacher <email address hidden> Wed, 28 Nov 2012 15:06:10 +0100

Changed in libvirt (Ubuntu Quantal):
status: Fix Committed → 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.