Compiling avahi-daemon bundle

Hi guys, sorry for the daft question (I have just started learning the process of compiling things!).

I am trying to create an avahi-daemon rpm and then later hoping to have created a bundle for some items I would like to run on Clear Linux.

However I am having a complete and utter nightmare trying to use autospec to make an avahi rpm. It keeps throwing up all sorts of errors! first its QtCore and qt-mt not found, then its another error etc.

Is there an already pre-compiled avahi bundle kicking around in clear linux that I am not able to find?

It might be best to request this be included at Issues · clearlinux/distribution · GitHub.

You are likely not the only one that would benefit from this being part of the OS :wink:

Thanks @pceiley

I’ll raise the request. However for my own personal learning. I keep getting the following error on all my builds:

Summary
    configure: error: Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO, set DISTRO to none if your distribution is not supported.
    error: Bad exit status from /var/tmp/rpm-tmp.Y7ZCUn (%build)
        Bad exit status from /var/tmp/rpm-tmp.Y7ZCUn (%build)
    RPM build errors:
    Child return code was: 1
    EXCEPTION: Command failed. See logs for output.
     # bash --login -c /usr/bin/rpmbuild -bb --target x86_64 --nodeps  /builddir/build/SPECS/avahi-0.7.spec 
    Traceback (most recent call last):
      File "/usr/lib/python3.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.7/site-packages/mockbuild/util.py", line 531, in do
        raise exception.Error("Command failed. See logs for output.\n # %s" % (command,), child.returncode)
    mockbuild.exception.Error: Command failed. See logs for output.
     # bash --login -c /usr/bin/rpmbuild -bb --target x86_64 --nodeps  /builddir/build/SPECS/avahi-0.7.spec 
    LEAVE do --> EXCEPTION RAISED

EDIT:
Request posted: avahi-daemon bundle in clear linux · Issue #714 · clearlinux/distribution · GitHub

If I had to guess I’d say you need add --with-distro=none? to the arguments passed to configure using the appropriate file. Check the autospec docs at GitHub - clearlinux/autospec: RPM packaging automation tool for the exact filename to use.

edit: it looks like you need to create a file called ‘configure’.

Yep that seems to have done it, didn’t realise you had to create the file! :blush:

Still having a heap of other errors, but mainly the Bad exit status from /var/tmp/rpm-tmp.Y7ZCUn (%build) is causing me a headache on all the builds!

In the related GitHub issue, I’ve made a comment on how to built the package.

Sadly, I don’t know how to use autospec even after reading all documentations. Hope this is still helpful to you @nickcj

@doct0rHu thats awesome, thanks for spending your time writing that! I will give it a go :slight_smile:

@nickcj did you manage to get avahi-daemon to work?
I get the following error (got it through journalctl -xe):
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: systemd-devel Info Page
░░
░░ An ExecStart= process belonging to unit avahi-daemon.service has exited.
░░
░░ The process’ exit code is ‘exited’ and its exit status is 255.
Oct 30 22:27:07 hostname systemd[1]: avahi-daemon.service: Failed with result ‘exit-code’.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: systemd-devel Info Page
░░
░░ The unit avahi-daemon.service has entered the ‘failed’ state with result ‘exit-code’.
Oct 30 22:27:07 hostname systemd[1]: Failed to start Avahi mDNS/DNS-SD Stack.
░░ Subject: A start job for unit avahi-daemon.service has failed
░░ Defined-By: systemd
░░ Support: systemd-devel Info Page
░░
░░ A start job for unit avahi-daemon.service has finished with a failure.
░░
░░ The job identifier is 2445 and the job result is failed.

To be more specific, I get the error below.
I don’t know what could be wrong in the configuration files.
Thanks for any help.

Found user 'avahi' (UID 350) and group 'avahi' (GID 350).
Successfully dropped root privileges.
avahi-daemon 0.8 starting up.
WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
dbus_bus_request_name(): Connection ":1.76" is not allowed to own the service "org.freedesktop.Avahi" due to security policies in the configuration file
WARNING: Failed to contact D-Bus daemon.
avahi-daemon 0.8 exiting.

I was able to make avahi-daemon start by creating the following directories:

  • /run/avahi-daemon/socket
  • /var/lib/avahi

And adding the following content for D-Bus, in the file /etc/dbus-1/system-local.conf:

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
  <busconfig>
    <policy context="default">
      <allow own="org.freedesktop.Avahi"/>
  </policy>
</busconfig>

Now, the problem is that I get the following error:

Failed to read /usr/share/defaults/etc/avahi/services.

This directory is however readable by avahi-daemon. As well as the files in there.

Going further into my investigation…
I noticed that if you remove the following line in /usr/share/defaults/etc/avahi/avahi-daemon.conf, avahi starts without errors:

allow-interfaces=lo

Thanks

http://www.linuxfromscratch.org/blfs/view/systemd/basicnet/avahi.html

This might be helpful, especially the part of “groupadd” and “useradd”

Thanks for the complementary information.
At the end, I finally managed to make avahi completely work.
In fact, it is a shame, but almost no proper documentation is available.

The last thing I made to have the *.service files to be read was to create the directory /var/lib/avahi/services and add my *.service files their.

I made a complete reply here.

One question is still pending from my side: how to properly override the file /usr/share/defaults/etc/avahi/avahi-daemon.conf
How should I do that?

sudo cp -prv /usr/share/defaults/etc/avahi /etc
sudoedit /etc/avahi/avahi-daemon.conf
1 Like

I really appreciate your help.
However, as a former USA president would say: Sounds good, doesn’t work.

What you propose seems totally logic. However, the configuration is not read from the /etc directory.

What could I do wrong?

In fact, the simplest way I found was to override the ExecStart section in the avahi-daemon service configuration.
sudo systemctl edit avahi-daemon

with the following content:

[Unit]
After=network-online.target

[Service]
ExecStart=
ExecStart=/usr/bin/avahi-daemon -s -f /etc/avahi/avahi-daemon.conf

Probably avahi is not correctly patched.

Yeah typically you are supposed to be able to override /usr/share/defaults/etc/$1 with /etc/$1.That is how it mostly works with CL, anyway.

However it’s not always the same. Sometimes a drop-in is required, sometimes it needs to be in a directory named after the pkg under /etc, and sometimes directly under /etc, e.i. /etc/avahi-daemon.conf. Sometimes it’s hard to say which but it usually depends on where the package would typically expect to find or install the config to on any other distro.

Usually if there are multiple different types of config files they would live in their own directory, but if it is a single ini type file it would fall directly under /etc. If multiple ini type files are required it will typically fall under a drop-in, something like /etc/avahi.d/ or /etc/avahi-daemon.conf.d/ etc etc.

Sometimes man $bundle_name will give you the answer, and sometimes there isn’t one, and you just have to edit the service, as you have done.

But then, do I have to report it as a bug?

Opening an issue, especially one which shares your work-around, may in the very least help others faced with a similar issue.