summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-03-28 13:03:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-03-30 22:22:19 +0000
commit7c916d8f1bfd6b8036311d534a08b2f71464a3cd (patch)
treeac88bce63c27c7f53f50440e7ea02bd26c134ca2
parent4e6a20efa9dc7bbb516fa56b560289a307d2ca40 (diff)
downloadpoky-7c916d8f1bfd6b8036311d534a08b2f71464a3cd.tar.gz
run-postinsts: Add workaround for locking deadlock issue
When run-postinsts is installed, a service is added for system which can run while the package is still being installed. This calls "opkg configure" and if package management is still running, it can deadlock and error. To work around this, call fcntl-lock on the opkg lock file and if the lock was held, it would wait to obtain it. This wait gives the package management time to finish the install before the configure can then take the lock and run. Note the dependency in SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS otherwise we'd see sstate selftest failures. Also ensure that if the configure fails, the scripts returns an error. This applies to opkg and dpkg. (From OE-Core rev: 96d37df074dc1fe1578c1406235dff7e328b62b7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/conf/layer.conf1
-rwxr-xr-xmeta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts11
-rw-r--r--meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb2
3 files changed, 12 insertions, 2 deletions
diff --git a/meta/conf/layer.conf b/meta/conf/layer.conf
index 62f86f361a..efbf2610f9 100644
--- a/meta/conf/layer.conf
+++ b/meta/conf/layer.conf
@@ -87,6 +87,7 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \
87 sato-icon-theme->gtk+3 \ 87 sato-icon-theme->gtk+3 \
88 adwaita-icon-theme->gdk-pixbuf \ 88 adwaita-icon-theme->gdk-pixbuf \
89 adwaita-icon-theme->gtk+3 \ 89 adwaita-icon-theme->gtk+3 \
90 run-postinsts->util-linux \
90" 91"
91 92
92# Avoid adding bison-native to the sysroot without a specific 93# Avoid adding bison-native to the sysroot without a specific
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
index 95dccb9cae..1f3e692029 100755
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -81,11 +81,18 @@ remove_rcsd_link=1
81if $pm_installed; then 81if $pm_installed; then
82 case $pm in 82 case $pm in
83 "ipk") 83 "ipk")
84 eval opkg configure $append_log 84 if ! `fcntl-lock --wait 30 /run/opkg.lock true`; then
85 eval echo "Unable to obtain the opkg lock, deadlock?" $append_log
86 fi
87 if ! eval "opkg configure $append_log"; then
88 exit 1
89 fi
85 ;; 90 ;;
86 91
87 "deb") 92 "deb")
88 eval dpkg --configure -a $append_log 93 if ! eval "eval dpkg --configure -a $append_log"; then
94 exit 1
95 fi
89 ;; 96 ;;
90 esac 97 esac
91else 98else
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb b/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
index 72ba8c0227..e977942de8 100644
--- a/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
@@ -12,6 +12,8 @@ S = "${WORKDIR}"
12 12
13inherit allarch systemd update-rc.d 13inherit allarch systemd update-rc.d
14 14
15RDEPENDS:${PN} = "util-linux-fcntl-lock"
16
15INITSCRIPT_NAME = "run-postinsts" 17INITSCRIPT_NAME = "run-postinsts"
16INITSCRIPT_PARAMS = "start 99 S ." 18INITSCRIPT_PARAMS = "start 99 S ."
17 19