public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] isar-bootstrap: Run setup-chroot.sh after dpkg upgraded
@ 2024-10-28  7:32 Uladzimir Bely
  2024-11-04 13:53 ` Uladzimir Bely
  0 siblings, 1 reply; 2+ messages in thread
From: Uladzimir Bely @ 2024-10-28  7:32 UTC (permalink / raw)
  To: isar-users

By calling "chroot-setup.sh setup" right after debootstrap we do
dpkg-divert for `/usr/sbin/start-stop-daemon`. This replaces the
original script with a stub that is called during the build. At
the end of the build, in "rootfs_finalize" task for target image,
the original file is restored so package installation on a real
target should be full-functional.

But if `apt-get update` followed by debootstrap stage requires an
upgrade of "dpkg" package itself (e.g. if new version exists in
"<distro>-updates"), this may lead for diversion reset and original
script gets restored.

This results in following things:
 - "real" start-stop-daemon is called in all chroots during build;
 - start-stop-daemon is removed on target rootfs by "rootfs_finalize".

Currently, it happens only for rpi-bookworm targets where debootsrapped
"dpkg_1.21.22_arm64.deb" package is upgraded with a newer version
"dpkg_1.22.6~bpo12+rpt3_arm64.deb" at "apt-get update" stage.

With this change, we run "chroot-setup.sh" after explicite upgrade of
"dpkg". Thus we guarantee start-stop-daemon stub is used during build
and undirsion is done only at the end of the rootfs creation.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 92974eb5..e155aade 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -370,10 +370,6 @@ do_bootstrap() {
         sed -i '/en_US.UTF-8 UTF-8/s/^#//g' "${ROOTFSDIR}/etc/locale.gen"
         chroot "${ROOTFSDIR}" /usr/sbin/locale-gen
 
-        # setup chroot
-        install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh"
-        "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"
-
         # update APT
         mount -o bind,private /dev ${ROOTFSDIR}/dev
         mount -o bind,private /dev/pts "${ROOTFSDIR}/dev/pts"
@@ -394,6 +390,13 @@ do_bootstrap() {
 
         chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y \
                                 -o APT::Update::Error-Mode=any
+
+        chroot "${ROOTFSDIR}" /usr/bin/apt-get install -y dpkg
+
+        # setup chroot
+        install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh"
+        "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"
+
         chroot "${ROOTFSDIR}" /usr/bin/apt-get install -y -f
         chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \
                                 -o Debug::pkgProblemResolver=yes
-- 
2.45.2

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241028073231.14162-1-ubely%40ilbers.de.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] isar-bootstrap: Run setup-chroot.sh after dpkg upgraded
  2024-10-28  7:32 [PATCH] isar-bootstrap: Run setup-chroot.sh after dpkg upgraded Uladzimir Bely
@ 2024-11-04 13:53 ` Uladzimir Bely
  0 siblings, 0 replies; 2+ messages in thread
From: Uladzimir Bely @ 2024-11-04 13:53 UTC (permalink / raw)
  To: isar-users

On Mon, 2024-10-28 at 10:32 +0300, Uladzimir Bely wrote:
> By calling "chroot-setup.sh setup" right after debootstrap we do
> dpkg-divert for `/usr/sbin/start-stop-daemon`. This replaces the
> original script with a stub that is called during the build. At
> the end of the build, in "rootfs_finalize" task for target image,
> the original file is restored so package installation on a real
> target should be full-functional.
> 
> But if `apt-get update` followed by debootstrap stage requires an
> upgrade of "dpkg" package itself (e.g. if new version exists in
> "<distro>-updates"), this may lead for diversion reset and original
> script gets restored.
> 
> This results in following things:
>  - "real" start-stop-daemon is called in all chroots during build;
>  - start-stop-daemon is removed on target rootfs by
> "rootfs_finalize".
> 
> Currently, it happens only for rpi-bookworm targets where
> debootsrapped
> "dpkg_1.21.22_arm64.deb" package is upgraded with a newer version
> "dpkg_1.22.6~bpo12+rpt3_arm64.deb" at "apt-get update" stage.
> 
> With this change, we run "chroot-setup.sh" after explicite upgrade of
> "dpkg". Thus we guarantee start-stop-daemon stub is used during build
> and undirsion is done only at the end of the rootfs creation.
> 
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> index 92974eb5..e155aade 100644
> --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> @@ -370,10 +370,6 @@ do_bootstrap() {
>          sed -i '/en_US.UTF-8 UTF-8/s/^#//g'
> "${ROOTFSDIR}/etc/locale.gen"
>          chroot "${ROOTFSDIR}" /usr/sbin/locale-gen
>  
> -        # setup chroot
> -        install -v -m755 "${WORKDIR}/chroot-setup.sh"
> "${ROOTFSDIR}/chroot-setup.sh"
> -        "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"
> -
>          # update APT
>          mount -o bind,private /dev ${ROOTFSDIR}/dev
>          mount -o bind,private /dev/pts "${ROOTFSDIR}/dev/pts"
> @@ -394,6 +390,13 @@ do_bootstrap() {
>  
>          chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y \
>                                  -o APT::Update::Error-Mode=any
> +
> +        chroot "${ROOTFSDIR}" /usr/bin/apt-get install -y dpkg
> +
> +        # setup chroot
> +        install -v -m755 "${WORKDIR}/chroot-setup.sh"
> "${ROOTFSDIR}/chroot-setup.sh"
> +        "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"
> +
>          chroot "${ROOTFSDIR}" /usr/bin/apt-get install -y -f
>          chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \
>                                  -o Debug::pkgProblemResolver=yes
> -- 
> 2.45.2
> 

Applied to next.

-- 
Best regards,
Uladzimir.



-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/fddeea7aadf982fa07ea7e533163bb4eae12fd30.camel%40ilbers.de.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-04 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-28  7:32 [PATCH] isar-bootstrap: Run setup-chroot.sh after dpkg upgraded Uladzimir Bely
2024-11-04 13:53 ` Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox