In expand last partition wait for udev have finished

Message ID CAJGKYO7Na2WK+h-XFAO=zJcX2reJqpUD1rLUkGOSDLDX9ibMdg@mail.gmail.com
State Superseded, archived
Headers show
Series In expand last partition wait for udev have finished | expand

Commit Message

Roberto A. Foglietta Dec. 12, 2022, 8:33 p.m. UTC
Hi all,

 this patch add a simple command at the beginning of the expand last
partition script

 udevadm settle

 this command connects with the running udev and waits until it has
finished its work.

 Why is this simple line supposed to solve the problem? My opinion -
an opinion because I do not have such hardware to test this patch - is
that some hardware is too slow dealing with some devices to let udev
complete his job before this script runs. This supposes that the udev
is running at that time. So you might need an extra check about it or
udev could even started at that time but later. Obviously, without
udev or something equivalent to populate /dev any operations with
devices is unfeasible.

 It has been sent with git send-email by elastic mail as usual and it
went into moderation, as usual.

 Best regards, R-

Patch

From 357f8d178a571ff9cdd8e8e6aa43a321d5ee888a Mon Sep 17 00:00:00 2001
From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Date: Mon, 12 Dec 2022 21:14:26 +0100
Subject: [PATCH] In expand last partition wait for udev have finished

bugfix, expand last partition, wait for udev completion

On some hardware the udev did not created the links to the disk partitions
while this script is working thus it fails. This patch fixes that cases.

Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
 .../expand-on-first-boot/files/expand-last-partition.sh         | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
index acfef8a..68e6698 100755
--- a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
+++ b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
@@ -9,6 +9,8 @@ 
 
 set -e
 
+udevadm settle
+
 ROOT_DEV="$(findmnt / -o source -n)"
 ROOT_DEV_NAME=${ROOT_DEV##*/}
 ROOT_DEV_SLAVE=$(find /sys/block/"${ROOT_DEV_NAME}"/slaves -mindepth 1 -print -quit 2>/dev/null || true)
-- 
2.34.1