[yocto] Systemd recipe breaks resolvconf

Martin Townsend mtownsend1973 at gmail.com
Sat Mar 4 05:33:39 PST 2017


Hi,

I've just tracked down a problem with resolvconf not working on my
board and it was due to the systemd recipe creating the resolv.conf
link and patching etc.conf. Here's the snippet (I've taken it from
krogoth but it is still there in morty).

if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true',
'false', d)}; then
    # if resolved is disabled, it won't handle the link of resolv.conf, so
    # set it up ourselves
    ln -s ../run/resolv.conf ${D}${sysconfdir}/resolv.conf
    echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/resolv.conf'
>>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
    echo 'f /run/resolv.conf 0644 root root'
>>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
fi

As systemd's resolved is not enabled by default the above is
happening.  The problem is that it breaks resolvconf which setsup
/etc/resolv.conf to link to /etc/resolvconf/run/resolv.conf and
doesn't seem to work when it's not.

I've put an ugly hack in a systemd append that undoes the changes
above and resolvconf works fine.

Not sure what the best way to fix this, the if statement above should
say is if ! resolved && image doesn't contain resolvconf but I don't
think you can do this in do_install.  A DISTRO_FEATURE of resolvconf
could be added to state that you are going to manage the DNS resolver
configuration.  The other option is to remove the above if statement.
Should systemd be setting up /etc/resolv.conf if resolved is not used?
If you not going to use resolved then you are probably going to use
something else. Or is this because systemd stops resolv.conf from
being created? but wouldn't that only happen if you disable SysV Init
altogether?

I can create a bug report if you think this is a genuine problem.

Cheers,
Martin.



More information about the yocto mailing list