[PATCH] isar-bootstrap: Run setup-chroot.sh after dpkg upgraded

1 view
Skip to first unread message

Uladzimir Bely

unread,
Oct 28, 2024, 3:32:44 AM10/28/24
to isar-...@googlegroups.com
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 <ub...@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

Uladzimir Bely

unread,
Nov 4, 2024, 8:53:06 AM11/4/24
to isar-...@googlegroups.com
Applied to next.

--
Best regards,
Uladzimir.



Reply all
Reply to author
Forward
0 new messages