From: "Andreas Oberritter" <obi@opendreambox.org>
To: "kai" <kai.kang@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH 1/1] systemd.bbclass: check whether systemctl works in post scripts
Date: Thu, 29 Oct 2020 10:48:04 +0100 [thread overview]
Message-ID: <20201029104804.4b6795ec@opendreambox.org> (raw)
In-Reply-To: <20201029092650.34868-2-kai.kang@windriver.com>
Hello Kai,
On Thu, 29 Oct 2020 17:26:50 +0800
"kai" <kai.kang@windriver.com> wrote:
> From: Kai Kang <kai.kang@windriver.com>
>
> When use a core image tarball as a docker image with 'docker import', it
> fails to install/remove package which calls systemctl in post scripts.
> Because it fais to run systemctl in a container:
>
> bash-5.0# systemctl
> System has not been booted with systemd as init system (PID 1). Can't operate.
> Failed to connect to bus: Host is down
>
> Replace 'type systemctl' with 'systemctl list-machines' in package post
> scripts to check whether systemctl work rather than existence.
>
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
> meta/classes/systemd.bbclass | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
> index 9e8a82c9f1..9938425e2d 100644
> --- a/meta/classes/systemd.bbclass
> +++ b/meta/classes/systemd.bbclass
> @@ -23,7 +23,7 @@ python __anonymous() {
> }
>
> systemd_postinst() {
> -if type systemctl >/dev/null 2>/dev/null; then
> +if systemctl list-machines >/dev/null 2>/dev/null; then
> OPTS=""
>
> if [ -n "$D" ]; then
Shouldn't this already have been run during image construction?
Doesn't this break our systemctl emulation (meta/recipes-core/systemd/systemd-systemctl/systemctl)?
> @@ -48,7 +48,7 @@ fi
> }
>
> systemd_prerm() {
> -if type systemctl >/dev/null 2>/dev/null; then
> +if systemctl list-machines >/dev/null 2>/dev/null; then
> if [ -z "$D" ]; then
> systemctl stop ${SYSTEMD_SERVICE_ESCAPED}
>
You're running the prerm hook inside a docker container?
Wouldn't it be more appropriate to remove the systemd DISTRO_FEATURE for a use-case like this?
Best regards,
Andreas
next prev parent reply other threads:[~2020-10-29 9:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 9:26 [PATCH 0/1] systemd.bbclass: check whether systemctl works in kai
2020-10-29 9:26 ` [PATCH 1/1] systemd.bbclass: check whether systemctl works in post scripts kai
2020-10-29 9:48 ` Andreas Oberritter [this message]
2020-10-30 5:44 ` 回复: " kai
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=20201029104804.4b6795ec@opendreambox.org \
--to=obi@opendreambox.org \
--cc=kai.kang@windriver.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