* [PATCH v2] systemd.bbclass: only restart the service when it is active at systemd_postinst
@ 2013-11-05 10:14 Li Zhijian
2013-11-19 2:26 ` Li Zhijian
0 siblings, 1 reply; 4+ messages in thread
From: Li Zhijian @ 2013-11-05 10:14 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] systemd.bbclass: only restart the service when it is active at systemd_postinst
2013-11-05 10:14 [PATCH v2] systemd.bbclass: only restart the service when it is active at systemd_postinst Li Zhijian
@ 2013-11-19 2:26 ` Li Zhijian
2014-01-22 17:56 ` Burton, Ross
0 siblings, 1 reply; 4+ messages in thread
From: Li Zhijian @ 2013-11-19 2:26 UTC (permalink / raw)
To: 'Patches and discussions about the oe-core layer'
ping...
--
Best regards.
Li Zhijian
|-----Original Message-----
|From: openembedded-core-bounces@lists.openembedded.org
|[mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
|Li Zhijian
|Sent: Tuesday, November 05, 2013 6:14 PM
|To: Patches and discussions about the oe-core layer
|Subject: [OE-core] [PATCH v2] systemd.bbclass: only restart the service
|when it is active at systemd_postinst
|
|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
|
|
|
|
|_______________________________________________
|Openembedded-core mailing list
|Openembedded-core@lists.openembedded.org
|http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] systemd.bbclass: only restart the service when it is active at systemd_postinst
2013-11-19 2:26 ` Li Zhijian
@ 2014-01-22 17:56 ` Burton, Ross
2014-01-22 18:06 ` Burton, Ross
0 siblings, 1 reply; 4+ messages in thread
From: Burton, Ross @ 2014-01-22 17:56 UTC (permalink / raw)
To: Li Zhijian; +Cc: Patches and discussions about the oe-core layer
Whoops, this fell out of my inbox. Whilst the is-active check now
means that the service is restarted on upgrades, if the package is
being installed it's now not started if AUTO_ENABLE is set to true.
I think the logic should be "$D unset and (auto enable or is-active)"
Ross
On 19 November 2013 02:26, Li Zhijian <lizhijian@cn.fujitsu.com> wrote:
> ping...
>
> --
> Best regards.
> Li Zhijian
>
> |-----Original Message-----
> |From: openembedded-core-bounces@lists.openembedded.org
> |[mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> |Li Zhijian
> |Sent: Tuesday, November 05, 2013 6:14 PM
> |To: Patches and discussions about the oe-core layer
> |Subject: [OE-core] [PATCH v2] systemd.bbclass: only restart the service
> |when it is active at systemd_postinst
> |
> |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
> |
> |
> |
> |
> |_______________________________________________
> |Openembedded-core mailing list
> |Openembedded-core@lists.openembedded.org
> |http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] systemd.bbclass: only restart the service when it is active at systemd_postinst
2014-01-22 17:56 ` Burton, Ross
@ 2014-01-22 18:06 ` Burton, Ross
0 siblings, 0 replies; 4+ messages in thread
From: Burton, Ross @ 2014-01-22 18:06 UTC (permalink / raw)
To: Li Zhijian; +Cc: Patches and discussions about the oe-core layer
On 22 January 2014 17:56, Burton, Ross <ross.burton@intel.com> wrote:
> Whoops, this fell out of my inbox. Whilst the is-active check now
> means that the service is restarted on upgrades, if the package is
> being installed it's now not started if AUTO_ENABLE is set to true.
>
> I think the logic should be "$D unset and (auto enable or is-active)"
Also, before doing systemctl reload, systemd needs to be told to
re-load the services with systemctl --system daemon-reload (thanks
Koen for pointing this out).
Ross
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-22 18:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-05 10:14 [PATCH v2] systemd.bbclass: only restart the service when it is active at systemd_postinst Li Zhijian
2013-11-19 2:26 ` Li Zhijian
2014-01-22 17:56 ` Burton, Ross
2014-01-22 18:06 ` Burton, Ross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.