From 190df56f4e8568a2d532605a709831967fafd125 Mon Sep 17 00:00:00 2001 From: Mike Engel Date: Fri, 16 Jan 2026 13:04:51 +0100 Subject: [PATCH] recovery-initramfs: add retry when searching SWU package file This commit adds a retry to the swu_package_path function of the recovery-initramfs-init script. It has been seen that with some USB memory stick a retry is necessary to mount the external storage device containing the SWU package. If the SWU package file is found before the max retries is reached the loop will be exited and the SWU installation will start. If max retry is reached and the SWU package wasn't found it finishes with an error. Signed-off-by: Mike Engel https://onedigi.atlassian.net/browse/DEL-9908 --- .../recovery-initramfs-init | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init index 51798585e..a0c7c3d69 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init @@ -364,19 +364,29 @@ swu_package_path() { # Check whether the package is local and get the absolute path. if echo "${1}" | grep -qs '^file://'; then local pkg_name="$(basename ${1})" + local success=false + local retries=1 + local max_retries=10 - for i in ${UPDATE_MOUNT_DIR} $(echo ${USB_MOUNT_DIR}/*); do - echo $i | grep -qs "${USB_MOUNT_DIR}/\*" && continue - if [ -f "${i}/${pkg_name}" ]; then - swu_abspath="${i}/${pkg_name}" - break + while [ $success = false ] && [ $retries -le $max_retries ]; do + for i in ${UPDATE_MOUNT_DIR} $(echo ${USB_MOUNT_DIR}/*); do + echo $i | grep -qs "${USB_MOUNT_DIR}/\*" && continue + if [ -f "${i}/${pkg_name}" ]; then + swu_abspath="${i}/${pkg_name}" + break + fi + done + + if [ -n "${swu_abspath}" ]; then + echo "${swu_abspath}" + success=true + else + sleep 1 + retries=$(( retries + 1 )) fi done - - if [ -n "${swu_abspath}" ]; then - echo "${swu_abspath}" - else - quit_with_error "Unable to find update package '${pkg_name}'" + if [ -z "${swu_abspath}" ]; then + quit_with_error "Unable to find update package '${pkg_name}' after ${max_retries} retries" fi else echo "${1}" @@ -513,9 +523,6 @@ echo > /dev/mdev.seq echo > /dev/mdev.log mdev -d -# Give some time for the devices to settle down so mdev can mount all of them -sleep 2 - # Run all shell scripts in postinstall folder run-parts /etc/*-postinsts