All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rootfs.py: mask run-postinsts systemd service when unneeded
@ 2021-03-22  7:07 Awais Belal
  2021-03-22  8:31 ` [OE-core] " Alexander Kanavin
  0 siblings, 1 reply; 4+ messages in thread
From: Awais Belal @ 2021-03-22  7:07 UTC (permalink / raw
  To: openembedded-core

The service is unnecessarily run even when it is unneeded.
This was handled correctly for sysV systems however the
service still runs on the systemd systems as it is not
disabled/masked when not needed.

Signed-off-by: Awais Belal <awais_belal@mentor.com>
---
 meta/lib/oe/rootfs.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 249c685dcf..a29d1f6742 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -257,6 +257,10 @@ class Rootfs(object, metaclass=ABCMeta):
                 self._exec_shell_cmd(["update-rc.d", "-f", "-r",
                                       self.d.getVar('IMAGE_ROOTFS'),
                                       "run-postinsts", "remove"])
+            if os.path.exists(self.d.expand("${IMAGE_ROOTFS}${systemd_unitdir}/system/run-postinsts.service")):
+                self._exec_shell_cmd(["systemctl",
+                                        "--root", self.d.getVar('IMAGE_ROOTFS'),
+                                        "mask", "run-postinsts"])
 
         image_rorfs = bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs",
                                         True, False, self.d)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [OE-core] [PATCH] rootfs.py: mask run-postinsts systemd service when unneeded
  2021-03-22  7:07 [PATCH] rootfs.py: mask run-postinsts systemd service when unneeded Awais Belal
@ 2021-03-22  8:31 ` Alexander Kanavin
  2021-03-22 11:41   ` Awais Belal
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Kanavin @ 2021-03-22  8:31 UTC (permalink / raw
  To: Awais Belal; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]

Why isn’t this seen in the tests? Can you add a test that shows the issue
please? (Fails without the patch, passes with)

Alex

On Mon 22. Mar 2021 at 10.07, Awais Belal <Awais_Belal@mentor.com> wrote:

> The service is unnecessarily run even when it is unneeded.
> This was handled correctly for sysV systems however the
> service still runs on the systemd systems as it is not
> disabled/masked when not needed.
>
> Signed-off-by: Awais Belal <awais_belal@mentor.com>
> ---
>  meta/lib/oe/rootfs.py | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
> index 249c685dcf..a29d1f6742 100644
> --- a/meta/lib/oe/rootfs.py
> +++ b/meta/lib/oe/rootfs.py
> @@ -257,6 +257,10 @@ class Rootfs(object, metaclass=ABCMeta):
>                  self._exec_shell_cmd(["update-rc.d", "-f", "-r",
>                                        self.d.getVar('IMAGE_ROOTFS'),
>                                        "run-postinsts", "remove"])
> +            if
> os.path.exists(self.d.expand("${IMAGE_ROOTFS}${systemd_unitdir}/system/run-postinsts.service")):
> +                self._exec_shell_cmd(["systemctl",
> +                                        "--root",
> self.d.getVar('IMAGE_ROOTFS'),
> +                                        "mask", "run-postinsts"])
>
>          image_rorfs = bb.utils.contains("IMAGE_FEATURES",
> "read-only-rootfs",
>                                          True, False, self.d)
> --
> 2.17.1
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 2288 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rootfs.py: mask run-postinsts systemd service when unneeded
  2021-03-22  8:31 ` [OE-core] " Alexander Kanavin
@ 2021-03-22 11:41   ` Awais Belal
  2021-03-22 14:06     ` [OE-core] " Alexander Kanavin
  0 siblings, 1 reply; 4+ messages in thread
From: Awais Belal @ 2021-03-22 11:41 UTC (permalink / raw
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

Hi Alex,

> 
> Why isn’t this seen in the tests? Can you add a test that shows the issue
> please? (Fails without the patch, passes with)

I'm not very well versed with the oe test infrastructure, I'd be happy to create a test for this scenario if you can point me to the material that I need to go through in order to be able to create a test for this. However, if you want me to summarize this tends to fix the issue where the systemd run-postinsts.service is run at the target even when not needed (no pending postinsts are found during build).

I do need to send a v2 for this as there's a slight issue in the patch.

[-- Attachment #2: Type: text/html, Size: 662 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] [PATCH] rootfs.py: mask run-postinsts systemd service when unneeded
  2021-03-22 11:41   ` Awais Belal
@ 2021-03-22 14:06     ` Alexander Kanavin
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Kanavin @ 2021-03-22 14:06 UTC (permalink / raw
  To: Awais Belal; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

Right, I guess I was missing the context where the patch is applied: "if
delayed_postinst is None" inside uninstall_unneeded(). Perhaps you could
expand the commit message a bit, and say specifically what is the scenario
when this is executed ("not needed" is somewhat vague).

Then no separate test is necessary.

Alex

On Mon, 22 Mar 2021 at 14:41, Awais Belal <Awais_Belal@mentor.com> wrote:

> Hi Alex,
>
> Why isn’t this seen in the tests? Can you add a test that shows the issue
> please? (Fails without the patch, passes with)
>
> I'm not very well versed with the oe test infrastructure, I'd be happy to
> create a test for this scenario if you can point me to the material that I
> need to go through in order to be able to create a test for this. However,
> if you want me to summarize this tends to fix the issue where the systemd
> run-postinsts.service is run at the target even when not needed (no pending
> postinsts are found during build).
>
> I do need to send a v2 for this as there's a slight issue in the patch.
> 
>
>

[-- Attachment #2: Type: text/html, Size: 1428 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-22 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-22  7:07 [PATCH] rootfs.py: mask run-postinsts systemd service when unneeded Awais Belal
2021-03-22  8:31 ` [OE-core] " Alexander Kanavin
2021-03-22 11:41   ` Awais Belal
2021-03-22 14:06     ` [OE-core] " Alexander Kanavin

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.