[OE-core] [PATCH] systemd: Make sure that resolv.conf points to writable area in R/O rootfs.

Kristian Amlie kristian.amlie at northern.tech
Fri Jan 26 13:06:48 UTC 2018


I'll be the first one to admit that I don't fully understand everything
about the systemd resolver. So there may be a cleaner way to do this,
but the submitted patch at least solved the problem for us. I'm open to
suggestions if there's a better way.

-- 
Kristian

On 26/01/18 14:06, Kristian Amlie wrote:
> Normally we want systemd to populate it at runtime, but when we have a
> read-only root filesystem we can't, so do it during the build.
> 
> Signed-off-by: Kristian Amlie <kristian.amlie at northern.tech>
> Signed-off-by: Marcin Pasinski <marcin.pasinski at mender.io>
> ---
>  meta/recipes-core/systemd/systemd_234.bb | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/meta/recipes-core/systemd/systemd_234.bb b/meta/recipes-core/systemd/systemd_234.bb
> index 4132cdf..7d61a53 100644
> --- a/meta/recipes-core/systemd/systemd_234.bb
> +++ b/meta/recipes-core/systemd/systemd_234.bb
> @@ -273,6 +273,9 @@ do_install() {
>  	else
>  		sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
>  		ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
> +		if ${@bb.utils.contains('IMAGE_FEATURES', 'read-only-rootfs', 'true', 'false', d)}; then
> +			ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv.conf
> +		fi
>  	fi
>  	install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
>  
> @@ -471,6 +474,12 @@ CONFFILES_${PN} = "${sysconfdir}/machine-id \
>                  ${sysconfdir}/systemd/system.conf \
>                  ${sysconfdir}/systemd/user.conf"
>  
> +FILES_MAYBE_RESOLV_CONF = "${@bb.utils.contains('PACKAGECONFIG', 'resolved', \
> +                               bb.utils.contains('IMAGE_FEATURES', 'read-only-rootfs', \
> +                                   '${sysconfdir}/resolv.conf', \
> +                                   '', d), \
> +                               '', d)}"
> +
>  FILES_${PN} = " ${base_bindir}/* \
>                  ${datadir}/dbus-1/services \
>                  ${datadir}/dbus-1/system-services \
> @@ -487,6 +496,7 @@ FILES_${PN} = " ${base_bindir}/* \
>                  ${sysconfdir}/xdg/ \
>                  ${sysconfdir}/init.d/README \
>                  ${sysconfdir}/resolv-conf.systemd \
> +                ${FILES_MAYBE_RESOLV_CONF} \
>                  ${rootlibexecdir}/systemd/* \
>                  ${systemd_unitdir}/* \
>                  ${base_libdir}/security/*.so \
> 




More information about the Openembedded-core mailing list