Message ID | 4uin2k6ynf84.97MRrskICJEyh6us27RQxw2@16F0H.trk.elasticemail.com |
---|---|
State | Superseded, archived |
Headers | show |
Series | In expand last partition wait for udev have finished | expand |
On Mon, 2022-12-12 at 20:23 +0000, roberto.foglietta@gmail.com wrote: > From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com> > > 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 Hi Roberto, thanks for this patch. I thought about something like that as well. If that reliably works, I vote to simply add this line instead of - again - re-writing this component. Felix > + > 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 > > > https://16F0H.trk.elasticemail.com/tracking/unsubscribe?d=uQeFOzkk8plXVVZ2VnEcpnRSdsZJXyyuanyoKUe_hgUtRGm67z-BYxoD4dUduarMjrGtkXTgZjMZXUuF072gCX_KXuQap6OFDQDgYq9jqpv90 >
On 13.12.22 03:01, Moessbauer, Felix wrote: > On Mon, 2022-12-12 at 20:23 +0000, roberto.foglietta@gmail.com wrote: >> From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com> >> >> 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 > > Hi Roberto, > > thanks for this patch. > I thought about something like that as well. > If that reliably works, I vote to simply add this line instead of - > again - re-writing this component. > > Felix Hi Felix, hi Roberto, udev is started via systemd-udevd and this service might not be up yet when the script runs. Adding this line would only work reliably if we add Requires=systemd-udevd and After=systemd-udevd to the expand-on-first-boot.service But adding this dependency might obviously increase the boot time. Best, Tobias >> + >> 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 >> >> >> https://16F0H.trk.elasticemail.com/tracking/unsubscribe?d=uQeFOzkk8plXVVZ2VnEcpnRSdsZJXyyuanyoKUe_hgUtRGm67z-BYxoD4dUduarMjrGtkXTgZjMZXUuF072gCX_KXuQap6OFDQDgYq9jqpv90 >> >
On Tue, 13 Dec 2022 at 09:44, Schaffner, Tobias <tobias.schaffner@siemens.com> wrote: > > Hi Felix, hi Roberto, > > udev is started via systemd-udevd and this service might not be up > yet when the script runs. > > Adding this line would only work reliably if we add > Requires=systemd-udevd and After=systemd-udevd to the > expand-on-first-boot.service > > But adding this dependency might obviously increase the boot time. > Hi Tobias, I do not think that adding that dependency will increase the boot time in general case but just changing the order of the operations. However, in those hardware which the devices recognition is slow, then the boot will slow down but probably are also those cases in which the resize will fail. In fast hardware, I think that udevd is just started before that script otherwise udevadm would have failed and the script as well due to set -e. This because the systemd paralyse the activities. At the moment, I am trying these changes on a virtual machine and it is enough fast that the script with udevadm settle do not fail nor slow down the boot in a noticeable way. I sent the patch v2 with this dependency. Also here in attachment. Thanks, R-
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)