Bug 785269

Summary: Make avahi failure on startup non-fatal
Product: Red Hat Enterprise Linux 6 Reporter: Dave Allan <dallan>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: urgent    
Version: 6.2CC: acathrow, dyuan, eblake, jwest, msvoboda, mzhan, rwu, sgrubb, slukasik, whuang, ydu
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.10-1.el6 Doc Type: Bug Fix
Doc Text:
Previously, if the libvirt package was built with avahi support, libvirt required the avahi package to be installed on the system as a prerequisite for its own installation. If the avahi package could not be installed on the system due to security concerns, installation of libvirt failed. This update modifies the libvirt.spec file to require only the avahi-libs package. The libvirt package is now successfully installed and libvirtd starts as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:47:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 770957    
Bug Blocks: 584498, 790779, 830201, 846801, 846802    

Description Dave Allan 2012-01-27 20:16:27 UTC
Currently if libvirt is set to advertise itself over avahi and avahi is not installed, libvirt fails to start.  That failure should be made non-fatal and the dependency on avahi removed.

Comment 1 Eric Blake 2012-01-27 20:27:00 UTC
Another alternative: rewrite the spec file so that libvirtd.conf is installed with mdns_adv = 0 if avahi is not present, and only use its current default of mdns_adv = 1 if avahi is present, without a hard requires on avahi.  With that approach, mdns_adv=1 and no avahi should still be fatal, but it should no longer be an out-of-the-box failure, and should allow setups where avahi is not desired.  But I'm not sure how to make spec files do conditional modification of the installed libvirtd.conf based on whether another package is installed.

Comment 2 Dave Allan 2012-01-27 22:04:31 UTC
There is a report that this behavior is fixed upstream already, see the end of the thread at:

https://www.redhat.com/archives/libvir-list/2012-January/msg00574.html

Comment 3 Eric Blake 2012-01-27 22:18:18 UTC
That thread was a proposed patch that did not get applied:

https://www.redhat.com/archives/libvir-list/2012-January/msg00606.html

Comment 10 Laine Stump 2012-02-07 10:23:05 UTC
I just tried starting up libvirtd with avahi-daemon stopped, and there was no error (both F16 and RHEL6), so I think there is no problem with the avahi client code that's built into libvirt.

However, iut is true that we require avahi to be *installed*, which is undesirable for security reasons in many cases. Just removing the "Requires: avahi" from the spec fixes that - support will still be built into libvirtd, but it will not be required at install/runtime.

Comment 11 Laine Stump 2012-02-07 10:27:46 UTC
I just sent a patch upstream to remove the Requires: avahi from the specfile.

https://www.redhat.com/archives/libvir-list/2012-February/msg00341.html

Comment 12 Laine Stump 2012-02-07 19:26:56 UTC
Actually, what was needed was to require "avahi-libs" rather than the full avahi package. I just pushed the following patch upstream:

commit 60f190735c29f0b753ddc08591662b037ba95728
Author: Laine Stump <laine>
Date:   Tue Feb 7 04:54:59 2012 -0500

    build: don't require avahi during install
    
    See: https://bugzilla.redhat.com/show_bug.cgi?id=785269
    
    The specfile requires avahi during install if libvirt was built with
    avahi support, but there are many situations where it is undesirable
    to install avahi due to security concerns. This patch requires only
    the avahi-libs package, which is needed by libvirt to call the
    function that tries to attach to the avahi daemon, but will instead
    silently fail because the avahi-daemon is in the main avahi package,
    and that package isn't installed.

diff --git a/libvirt.spec.in b/libvirt.spec.in
index f279d6d..62b0ed4 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -273,7 +273,7 @@ Requires: module-init-tools
 # for /sbin/ip & /sbin/tc
 Requires: iproute
 %if %{with_avahi}
-Requires: avahi
+Requires: avahi-libs
 %endif
 %endif
 %if %{with_network}

Comment 18 yanbing du 2012-02-15 06:03:21 UTC
Test with libvirt-0.9.10-1.el6, bug VERIFIED.
Steps:
1. Make sure avahi, avahi-libs and libvirt related packages do NOT install.
# rpm -qa|grep libvirt

# rpm -qa|grep avahi
avahi-glib-0.6.25-11.el6.x86_64
avahi-autoipd-0.6.25-11.el6.x86_64
2.Then download the libvirt rpm packages and install them, that will get a dependency error and only require avahi-libs installed.
# ls
libvirt-0.9.10-1.el6.x86_64.rpm            libvirt-lock-sanlock-0.9.10-1.el6.x86_64.rpm
libvirt-client-0.9.10-1.el6.x86_64.rpm     libvirt-python-0.9.10-1.el6.x86_64.rpm
libvirt-debuginfo-0.9.10-1.el6.x86_64.rpm
# rpm -ivh libvirt-*
error: Failed dependencies:
	avahi-libs is needed by libvirt-0.9.10-1.el6.x86_64
	libavahi-client.so.3()(64bit) is needed by libvirt-0.9.10-1.el6.x86_64
	libavahi-common.so.3()(64bit) is needed by libvirt-0.9.10-1.el6.x86_64
	libavahi-client.so.3()(64bit) is needed by libvirt-client-0.9.10-1.el6.x86_64
	libavahi-common.so.3()(64bit) is needed by libvirt-client-0.9.10-1.el6.x86_64
	libavahi-client.so.3()(64bit) is needed by libvirt-python-0.9.10-1.el6.x86_64
	libavahi-common.so.3()(64bit) is needed by libvirt-python-0.9.10-1.el6.x86_64
3. The install avahi-libs and try to install libvirt packages again
# yum install avahi-libs
 rpm -ivh libvirt-*
Preparing...                ########################################### [100%]
   1:libvirt-client         ########################################### [ 20%]
   2:libvirt                ########################################### [ 40%]
   3:libvirt-lock-sanlock   ########################################### [ 60%]
   4:libvirt-python         ########################################### [ 80%]
   5:libvirt-debuginfo      ########################################### [100%]
# service libvirtd start
Starting libvirtd daemon:                                  [  OK  ]

After avahi-libs installed, libvirt packages can install successfully and libvirtd can start normally.

Comment 20 Miroslav Svoboda 2012-02-27 15:33:38 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, if the libvirt package was built with avahi support, libvirt required the avahi package to be installed on the system as a prerequisite for its own installation. If the avahi package could not be installed on the system due to security concerns, installation of libvirt failed. This update modifies the libvirt.spec file to require only the avahi-libs package. The libvirt package is now successfully installed and libvirtd starts as expected.

Comment 22 errata-xmlrpc 2012-06-20 06:47:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0748.html