[OE-core] [PATCH 2/2] connman: correct the systemd boot in read only rootfs

Patrick Ohly patrick.ohly at intel.com
Fri Nov 24 12:03:19 UTC 2017


On Mon, 2017-06-12 at 18:10 +0300, Maxin B. John wrote:
> connman fails to start in systemd based read-only images while
> creating links:
> 
> Jun 08 12:53:56 qemux86-64 systemd[1]: Starting Create Volatile Files
> and Directories...
> Jun 08 12:53:56 qemux86-64 systemd-tmpfiles[366]:
> [[0;1;31msymlink(/var/run/connman/resolv.conf, /etc/resolv.conf)
> failed:
> Read-only file system[[0m
> 
> Fix this failure and make connman co-exist with systemd-resolved.
> 
> Signed-off-by: Maxin B. John <maxin.john at intel.com>
> ---
>  meta/recipes-connectivity/connman/connman.inc      | 15 ++++++++++-
>  ...vice-stop-systemd-resolved-when-we-use-co.patch | 29
> ++++++++++++++++++++++
>  meta/recipes-connectivity/connman/connman_1.34.bb  |  1 +
>  3 files changed, 44 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-connectivity/connman/connman/0001-
> connman.service-stop-systemd-resolved-when-we-use-co.patch
> 
> diff --git a/meta/recipes-connectivity/connman/connman.inc
> b/meta/recipes-connectivity/connman/connman.inc
> index cc2d469..ab18f2f 100644
> --- a/meta/recipes-connectivity/connman/connman.inc
> +++ b/meta/recipes-connectivity/connman/connman.inc
> @@ -13,7 +13,7 @@ LICENSE  = "GPLv2"
>  LIC_FILES_CHKSUM =
> "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
>                      file://src/main.c;beginline=1;endline=20;md5=486
> a279a6ab0c8d152bcda3a5b5edc36"
>  
> -inherit autotools pkgconfig systemd update-rc.d bluetooth
> +inherit autotools pkgconfig systemd update-rc.d bluetooth update-
> alternatives
>  
>  DEPENDS  = "dbus glib-2.0 ppp readline"
>  
> @@ -69,6 +69,11 @@ SYSTEMD_SERVICE_${PN} = "connman.service"
>  SYSTEMD_SERVICE_${PN}-vpn = "connman-vpn.service"
>  SYSTEMD_SERVICE_${PN}-wait-online = "connman-wait-online.service"
>  
> +ALTERNATIVE_PRIORITY = "100"
> +ALTERNATIVE_${PN} ="resolv-conf"
> +ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-
> conf.connman"
> +ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
> +
>  do_install_append() {
>  	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true',
> 'false',d)}; then
>  		install -d ${D}${sysconfdir}/init.d
> @@ -89,6 +94,14 @@ do_install_append() {
>  	# Automake 1.12 won't install empty directories, but we need
> the
>  	# plugins directory to be present for ownership
>  	mkdir -p ${D}${libdir}/connman/plugins
> +
> +    # For read-only filesystem, do not create links during bootup
> +    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','fals
> e',d)}; then
> +        if ${@bb.utils.contains('IMAGE_FEATURES','re
> ad-only-rootfs','true','false',d)}; then
> +            echo "d    /var/run/connman    - - - -" >
> ${D}${sysconfdir}/tmpfiles.d/connman_resolvconf.conf
> +        fi
> +        ln -sf ../run/connman/resolv.conf ${D}${sysconfdir}/resolv-
> conf.connman
> +    fi
>  }

This check for 'IMAGE_FEATURES' is bogus: that's a per-image recipe
variable, which can't be assumed to be set consistently for all images
in the base configuration and therefore the connman recipe can't depend
 on it. The effect is that the tmpfiles.d entry doesn't get created
when setting IMAGE_FEATURES only for some images.

It still works for me (refkit, based on OE-core Rocko at the moment).
Something has created /var/run/connman (perhaps connman itself?) and
the resolv.conf inside it, so /etc/resolv.conf -> /etc/resolv-
conf.connman -> ../run/connman/resolv.conf = /run/connman/resolv.conf
exists.

But the bogus lines should be removed nonetheless, because it causes
the connman recipe to depend on IMAGE_FEATURES.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.





More information about the Openembedded-core mailing list