diff mbox series

[kirkstone] run-postinsts: Set dependency for ldconfig to avoid boot issues

Message ID 20230503141246.2087-1-jermain.horsman@nedap.com
State New, archived
Headers show
Series [kirkstone] run-postinsts: Set dependency for ldconfig to avoid boot issues | expand

Commit Message

jhatnedap@gmail.com May 3, 2023, 2:12 p.m. UTC
From: Arturo Buzarra <arturo.buzarra@digi.com>

If a package with a postsints script requires ldconfig, the package class adds
a ldconfig postinst fragment to initialize it before. Systemd has its own
ldconfig.service to initialize it and sometimes if both services are running
at the same time in the first boot, the first one will work, but the second
one will fail with the following error:

    ldconfig[141]: /sbin/ldconfig: Renaming of /etc/ld.so.cache~ to /etc/ld.so.cache failed: No such file or directory

This commit adds a ordering dependency between them to make sure that only one
service is running at the same time.

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 4e9d812e127dc6743f52f4881e509e8e2e833afe)
Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com>
---
 .../run-postinsts/run-postinsts/run-postinsts.service           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Khem Raj May 4, 2023, 12:12 a.m. UTC | #1
On Wed, May 3, 2023 at 7:13 AM Jermain Horsman
<jermain.horsman@nedap.com> wrote:
>
> From: Arturo Buzarra <arturo.buzarra@digi.com>
>
> If a package with a postsints script requires ldconfig, the package class adds
> a ldconfig postinst fragment to initialize it before. Systemd has its own
> ldconfig.service to initialize it and sometimes if both services are running
> at the same time in the first boot, the first one will work, but the second
> one will fail with the following error:
>
>     ldconfig[141]: /sbin/ldconfig: Renaming of /etc/ld.so.cache~ to /etc/ld.so.cache failed: No such file or directory
>
> This commit adds a ordering dependency between them to make sure that only one
> service is running at the same time.
>
> Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> (cherry picked from commit 4e9d812e127dc6743f52f4881e509e8e2e833afe)
> Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com>
> ---
>  .../run-postinsts/run-postinsts/run-postinsts.service           | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
> index 7f72f3388a..b6b81d5c1a 100644
> --- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
> +++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
> @@ -1,7 +1,7 @@
>  [Unit]
>  Description=Run pending postinsts
>  DefaultDependencies=no
> -After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
> +After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount ldconfig.service

should it depend on ldconfig being in distro features ? it may not be
there on all systems.

>  Before=sysinit.target
>
>  [Service]
> --
> 2.39.2.windows.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#180828): https://lists.openembedded.org/g/openembedded-core/message/180828
> Mute This Topic: https://lists.openembedded.org/mt/98662451/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Jermain Horsman May 4, 2023, 8:33 a.m. UTC | #2
On Thu, May  4, 2023 at 02:12 AM, Khem Raj wrote:

>
> should it depend on ldconfig being in distro features ? it may not be
> there on all systems.
>

Do you mean we should add it conditionally based upon the value of distro features?
Or if it is required to have ldconfig included in distro features for this change?

If it is the latter, an After= dependency on a service that does not exist should not have any effect.
An After= only means the startup of this service is delayed until ldconfig has finished starting up.
If ldconfig.service does not exist, it can never be started and there is nothing to wait for,
meaning this service will start as soon as the other After= dependencies are met.
diff mbox series

Patch

diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
index 7f72f3388a..b6b81d5c1a 100644
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
@@ -1,7 +1,7 @@ 
 [Unit]
 Description=Run pending postinsts
 DefaultDependencies=no
-After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
+After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount ldconfig.service
 Before=sysinit.target
 
 [Service]