From: Li Zhijian <lizhijian@cn.fujitsu.com>
To: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>
Subject: [PATCH v2] systemd.bbclass: only restart the service when it is active at systemd_postinst
Date: Tue, 05 Nov 2013 18:14:26 +0800 [thread overview]
Message-ID: <5278C502.1080100@cn.fujitsu.com> (raw)
From: Li Zhijian <lizhijian@cn.fujitsu.com>
If systemd_postinst is installed as a delayed package scriptlet (installed to /etc/rpm-postints/${PN})
which would be executed at the first time of OS startup. And then this script would block when it is
trying to call systemctl to restart service.
It seems that it is not a good timing to restart service at run-postinsts.
I test serval services which has supported systemd(uuidd/avahi-daemon), all of them
will block the startup.
Steps to reproduce:
1) Installed systemd_postinst as a delayed package scriptlet
i.e. Append Following lines to meta/recipes-core/busybox/busybox.inc
pkg_postinst_${PN}-syslog () {
if [ "x$D" != "x" ] ; then
exit 1
fi
}
2) build a rootfs
$ bitbake core-image-minimal
3) startup this rootfs
OS would block at /etc/rpm-postinsts/busybox-syslog, like follows
[ ***] A start job is running ro Run pending postinsts
This patch can fix the block problem, and make the service is consistent with the original status
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
meta/classes/systemd.bbclass | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 3700b2e..1feac06 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -32,7 +32,8 @@ fi
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
+ if [ -z "$D" ] && systemctl is-active ${SYSTEMD_SERVICE} &>/dev/null; then
+ # if service is active, restart it
systemctl restart ${SYSTEMD_SERVICE}
fi
fi
--
1.7.1
next reply other threads:[~2013-11-05 10:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 10:14 Li Zhijian [this message]
2013-11-19 2:26 ` [PATCH v2] systemd.bbclass: only restart the service when it is active at systemd_postinst Li Zhijian
2014-01-22 17:56 ` Burton, Ross
2014-01-22 18:06 ` Burton, Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5278C502.1080100@cn.fujitsu.com \
--to=lizhijian@cn.fujitsu.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox