* [PATCH] systemd.bbclass: don't block on service restart
@ 2016-11-25 4:17 Mark Asselstine
2016-11-26 20:59 ` Andreas Oberritter
2016-11-29 17:33 ` Khem Raj
0 siblings, 2 replies; 3+ messages in thread
From: Mark Asselstine @ 2016-11-25 4:17 UTC (permalink / raw)
To: openembedded-core
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@windriver.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
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] systemd.bbclass: don't block on service restart
2016-11-25 4:17 [PATCH] systemd.bbclass: don't block on service restart Mark Asselstine
@ 2016-11-26 20:59 ` Andreas Oberritter
2016-11-29 17:33 ` Khem Raj
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Oberritter @ 2016-11-26 20:59 UTC (permalink / raw)
To: Mark Asselstine, openembedded-core
On 25.11.2016 05:17, Mark Asselstine wrote:
> 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@windriver.com>
I was going to submit the exact same patch soon. It also helps to
complete system updates if a service fails to restart properly.
Acked-by: Andreas Oberritter <obi@opendreambox.org>
> ---
> 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
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] systemd.bbclass: don't block on service restart
2016-11-25 4:17 [PATCH] systemd.bbclass: don't block on service restart Mark Asselstine
2016-11-26 20:59 ` Andreas Oberritter
@ 2016-11-29 17:33 ` Khem Raj
1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2016-11-29 17:33 UTC (permalink / raw)
To: Mark Asselstine; +Cc: openembedded-core
> On Nov 24, 2016, at 8:17 PM, Mark Asselstine <mark.asselstine@windriver.com> wrote:
>
> 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)
yeah usually it would be nice if there was some sort of timeout on failed
restarts
>
> 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@windriver.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
> }
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-29 17:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-25 4:17 [PATCH] systemd.bbclass: don't block on service restart Mark Asselstine
2016-11-26 20:59 ` Andreas Oberritter
2016-11-29 17:33 ` Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox