[oe-commits] [openembedded-core] 52/76: systemd.bbclass: don't block on service restart

git at git.openembedded.org git at git.openembedded.org
Wed Nov 30 15:49:37 UTC 2016


rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 6ad6a0084a73088fc2a27ab9958e5c46d6e094fc
Author: Mark Asselstine <mark.asselstine at windriver.com>
AuthorDate: Thu Nov 24 23:17:14 2016 -0500

    systemd.bbclass: don't block on service restart
    
    The current class works fine when a recipe uses SYSTEMD_AUTO_ENABLE
    'enable' and has no on device pkg_postinst(), ie when the postinst is
    run as part of rootfs creation.  However, when there is a component of
    pkg_postinst() that is run on device the 'systemctl restart' is run as
    part of the run_postinsts.service at boot. This results in the boot
    spinning indefinitely with:
    
    [ *** ] A start job is running for Run pending postinsts (7s / no limit)
    
    The issue could potentially be that the packages service has an
    'After' clause which comes later in the boot, beyond
    run_postinsts.service, creating a chicken before the egg
    scenario. Even service files without an 'After' clause cause this
    situation however. Despite this not being the cause of the issue this
    fix will prevent this scenario from happenning.
    
    Using strace we are able to find that during boot, when
    run_postinsts.service is running attempting to start or restart any
    service will result in the call get stuck on poll(). Since the
    run_postinsts.service does not monitor the outcome of the call to
    restart we can work around this by using '--no-block'.
    
    Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/systemd.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 7e51ed6..99a08a0 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -36,7 +36,7 @@ if type systemctl >/dev/null 2>/dev/null; then
 	systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
 
 	if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
-		systemctl restart ${SYSTEMD_SERVICE}
+		systemctl --no-block restart ${SYSTEMD_SERVICE}
 	fi
 fi
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list