From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7308563077608243200 X-Forwarded-Encrypted: i=2; AJvYcCWcvqDcOBb/81b6pCZWIuKWd3JXg9RLMgr31BkXM+iVtEqoN2WIF+H+7QxUcKlkyA+e5Ip+nr6Kiu9z+6hn0/f3WQXlkv0TB4AybGI= X-Received: by 2002:a50:cd51:0:b0:56b:b278:d57b with SMTP id d17-20020a50cd51000000b0056bb278d57bmr1104102edj.16.1711518368348; Tue, 26 Mar 2024 22:46:08 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6402:f0c:b0:56c:1b11:31c8 with SMTP id i12-20020a0564020f0c00b0056c1b1131c8ls1258582eda.1.-pod-prod-04-eu; Tue, 26 Mar 2024 22:46:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXBQsdVBTwkpGLFD8hJaC1OmTWTGLtPHL2foIZempJt97juZkYRJe1tn7wG2TxaxECtUxIAAa+zPTAVLtHsaalDoLTDIzNDfzMVc8Q= X-Google-Smtp-Source: AGHT+IFBBYwDs5ShTtDCotZAKCO8MpWtZ/E8oXd4f69e5/HueWiEdy09N0gCf5p/CpL7szDh6VPS X-Received: by 2002:a50:9b54:0:b0:56a:2ca3:ea4e with SMTP id a20-20020a509b54000000b0056a2ca3ea4emr1185150edj.18.1711518365643; Tue, 26 Mar 2024 22:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711518365; cv=none; d=google.com; s=arc-20160816; b=CgELgY7XMAg4HE7UB3IJDBcRruIBRvt5AWJ73Pz/aZO5ZTx2a6q1DsmediqZ87JZhf tBUf3WZ8dBwxVBqiMy1BMsO2kmi5liz8ao6mgdKr2KsRcshvihTDTNdt0ZRQfLt8zG2r H0TRgo8R16X7LgreIMt8+x+VvAcujRfS972wee0vrkn0S50JnaLmFfdakwKh6ateX+XW HPVG7s7wvshs9SyOxSz6rHoWoKH/wz0SE9m7r0PXzwjZWCAew9TIa0f2k4IQZd6k/tX9 2Vg/ggRG2xI4i1fSDHzwTgGgyNvSNkPrfbVMFDjls6fqEU3UaOIPKz4KOi6g/meWrn+O 6PCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id; bh=B07YC4Te5m/4mF3UUNZ8pZZmGXlDjGhb9vMBt5UEk8w=; fh=76bf+O/vM1btxiyC5C+dMdttGHKK38yNCdHHKbvknpg=; b=VRHcBIYJcAwvvwaRW/N5liag7d/mGHSPUmU5OfxrB0bVLXNLuGLWqdbLpk6O88HMtk cJOrerxytDqVJQBWkOnvNTMPEXfXeJKHBV/v9nC6OFBQhcrmrvPBd2OqcJS8HtmfSV0Y zX6d0CAEXxO9grdkAVCnSWQPPa0BT7/vIQuhr0QY2c848+UJT8CK03kS73lRwEOZFSms FG6fMGetmkdebHZvt8WgzcHzZCLSSUVsHQmK1jlm/Pia2qGz9/yXjNej7KiMUoMAdhiP JczG+8mRrLjWx0yw22aQitt3b00pcu8UCMP3K5/8vEDj9FJZv+xmhTZt0PHixx74sWSZ dUlg==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id n1-20020a509341000000b0056c3969d5f8si56352eda.2.2024.03.26.22.46.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2024 22:46:05 -0700 (PDT) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from [127.0.0.1] (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 42R5k287021277 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Mar 2024 06:46:04 +0100 Message-ID: Subject: Re: [RFC 1/1] delay creation of initrd until end of rootfs install From: Uladzimir Bely To: Gylstorff Quirin , "isar-users@googlegroups.com" Cc: Jan Kiszka , "Moessbauer, Felix (T CED OES-DE)" Date: Wed, 27 Mar 2024 08:46:02 +0300 In-Reply-To: References: <20231204023650.1912972-1-felix.moessbauer@siemens.com> <596d1dad-1b26-4357-b970-ba30230a34eb@siemens.com> <8ccae41f0016f01665a40ada6ab6051f1b7415dc.camel@siemens.com> <05f60d25763050571b5cfe9f2add1da4b02bbdba.camel@siemens.com> <1f0b8127-95e1-4150-8acd-2cd11e4fcfe3@siemens.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (by Flathub.org) MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: B1P3Lc7Ys3Ef On Mon, 2024-03-25 at 17:22 +0100, Gylstorff Quirin wrote: >=20 >=20 > On 1/18/24 6:06 PM, 'Jan Kiszka' via isar-users wrote: > > On 18.01.24 17:44, Moessbauer, Felix (T CED OES-DE) wrote: > > > On Fri, 2023-12-08 at 10:46 +0000, 'MOESSBAUER, Felix' via isar- > > > users > > > wrote: > > > > On Wed, 2023-12-06 at 09:04 +0900, Jan Kiszka wrote: > > > > > On 04.12.23 10:36, Felix Moessbauer wrote: > > > > > > This patch solves major performance issues around the > > > > > > initramfs > > > > > > creation by ensuring that the initrd is only created once. > > > > > > This > > > > > > is > > > > > > implemented by stubbing the update-initramfs call during > > > > > > the > > > > > > package > > > > > > installing. After all apt operations are completed, we > > > > > > manually > > > > > > trigger the initrd creation. In case a custom initramfs is > > > > > > used, > > > > > > the > > > > > > creation is completely skipped in the image rootfs, as this > > > > > > would > > > > > > anyways not be used. > > > > > >=20 > > > > > > Before that, each package install that made a initrd > > > > > > relevant > > > > > > change > > > > > > triggered the update of the initrd. As we have multiple apt > > > > > > calls > > > > > > during > > > > > > the build, this step was sometimes executed multiple times. > > > > > > In > > > > > > addition, > > > > > > the apt install step is emulated, further slowing down the > > > > > > initrd > > > > > > generation. On some layers on non native architecutes, this > > > > > > summed > > > > > > up to > > > > > > over 10 minutes of initrd generation time. > > > > > >=20 > > > > > > Signed-off-by: Felix Moessbauer > > > > > > > > > > > > --- > > > > > > =C2=A0=C2=A0meta/classes/image.bbclass=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 |=C2=A0 4 +++ > > > > > > =C2=A0=C2=A0meta/classes/rootfs.bbclass=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 | 32 > > > > > > +++++++++++++++++++ > > > > > > =C2=A0=C2=A0.../isar-bootstrap/isar-bootstrap.inc=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 2 ++ > > > > > > =C2=A0=C2=A03 files changed, 38 insertions(+) > > > > > >=20 > > > > > > diff --git a/meta/classes/image.bbclass > > > > > > b/meta/classes/image.bbclass > > > > > > index 73f1d52c..39addc59 100644 > > > > > > --- a/meta/classes/image.bbclass > > > > > > +++ b/meta/classes/image.bbclass > > > > > > @@ -72,6 +72,8 @@ inherit essential > > > > > > =C2=A0=20 > > > > > > =C2=A0=C2=A0ROOTFSDIR =3D "${IMAGE_ROOTFS}" > > > > > > =C2=A0=C2=A0ROOTFS_FEATURES +=3D "clean-package-cache clean-pyc= ache > > > > > > generate- > > > > > > manifest export-dpkg-status clean-log-files clean-debconf- > > > > > > cache" > > > > > > +# when using a custom initrd, do not generate one as part > > > > > > of the > > > > > > image rootfs > > > > > > +ROOTFS_FEATURES +=3D "${@ '' if d.getVar('INITRD_IMAGE') =3D= =3D > > > > > > '' > > > > > > else > > > > > > 'no-generate-initrd'}" > > > > > > =C2=A0=C2=A0ROOTFS_PACKAGES +=3D "${IMAGE_PREINSTALL} > > > > > > ${@isar_multiarch_packages('IMAGE_INSTALL', d)}" > > > > > > =C2=A0=C2=A0ROOTFS_MANIFEST_DEPLOY_DIR ?=3D "${DEPLOY_DIR_IMAGE= }" > > > > > > =C2=A0=C2=A0ROOTFS_DPKGSTATUS_DEPLOY_DIR ?=3D "${DEPLOY_DIR_IMA= GE}" > > > > > > @@ -488,6 +490,8 @@ do_rootfs_quality_check() { > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 args=3D"${ROOTFS_QA_FIND_ARGS}" > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # rootfs_finalize chroot-setup.s= h > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 args=3D"${args} ! -path > > > > > > ${ROOTFSDIR}/var/lib/dpkg/diversions" > > > > > > +=C2=A0=C2=A0=C2=A0 # initramfs is generated outside of the ima= ge rootfs > > > > > > +=C2=A0=C2=A0=C2=A0 args=3D"${args} ! -path ${ROOTFSDIR}/boot/i= nitrd.img*" > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for cmd in ${ROOTFS_POSTPROCESS_= COMMAND}; do > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case "${= cmd}" in > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 image_postprocess_mark) > > > > > > diff --git a/meta/classes/rootfs.bbclass > > > > > > b/meta/classes/rootfs.bbclass > > > > > > index 1b95115a..69e38dac 100644 > > > > > > --- a/meta/classes/rootfs.bbclass > > > > > > +++ b/meta/classes/rootfs.bbclass > > > > > > @@ -14,6 +14,7 @@ ROOTFS_BASE_DISTRO ?=3D "${BASE_DISTRO}" > > > > > > =C2=A0=C2=A0# 'generate-manifest' - generate a package manifest= of > > > > > > the > > > > > > rootfs > > > > > > into ${ROOTFS_MANIFEST_DEPLOY_DIR} > > > > > > =C2=A0=C2=A0# 'export-dpkg-status' - exports /var/lib/dpkg/stat= us > > > > > > file to > > > > > > ${ROOTFS_DPKGSTATUS_DEPLOY_DIR} > > > > > > =C2=A0=C2=A0# 'clean-log-files' - delete log files that are not= owned > > > > > > by > > > > > > packages > > > > > > +# 'no-generate-initrd' - do not generate debian default > > > > > > initrd > > > > > > =C2=A0=C2=A0ROOTFS_FEATURES ?=3D "" > > > > > > =C2=A0=20 > > > > > > =C2=A0=C2=A0ROOTFS_APT_ARGS=3D"install --yes -o > > > > > > Debug::pkgProblemResolver=3Dyes" > > > > > > @@ -117,6 +118,16 @@ rootfs_configure_apt() { > > > > > > =C2=A0=C2=A0EOSUDO > > > > > > =C2=A0=C2=A0} > > > > > > =C2=A0=20 > > > > > > +ROOTFS_CONFIGURE_COMMAND +=3D > > > > > > "rootfs_disable_initrd_generation" > > > > > > +rootfs_disable_initrd_generation[weight] =3D "1" > > > > > > +rootfs_disable_initrd_generation() { > > > > > > +=C2=A0=C2=A0=C2=A0 # fully disable initrd generation > > > > > > +=C2=A0=C2=A0=C2=A0 echo "replace update-initramfs with stub" > > > > > > +=C2=A0=C2=A0=C2=A0 sudo mv "${ROOTFSDIR}/usr/sbin/update-initr= amfs" \ > > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 "${ROOTFSDIR}/usr/sbin/update-initramfs.isar" > > > > > > +=C2=A0=C2=A0=C2=A0 sudo chroot "${ROOTFSDIR}" ln -s "/usr/bin/= true" > > > > > > "/usr/sbin/update-initramfs" > > > > > > +} > > > > > > + > > > > > > =C2=A0=20 > > > > > > =C2=A0=C2=A0ROOTFS_INSTALL_COMMAND +=3D "rootfs_install_pkgs_up= date" > > > > > > =C2=A0=C2=A0rootfs_install_pkgs_update[weight] =3D "5" > > > > > > @@ -310,6 +321,27 @@ rootfs_cleanup_isar_apt() { > > > > > > =C2=A0=C2=A0EOSUDO > > > > > > =C2=A0=C2=A0} > > > > > > =C2=A0=20 > > > > > > +ROOTFS_POSTPROCESS_COMMAND +=3D > > > > > > "rootfs_restore_initrd_tooling" > > > > > > +rootfs_generate_initrd[weight] =3D "1" > > > > > > +rootfs_restore_initrd_tooling() { > > > > > > +=C2=A0=C2=A0=C2=A0 if [ -e "${ROOTFSDIR}/usr/sbin/update-initr= amfs.isar" > > > > > > ]; > > > > > > then > > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sudo mv -f "${ROOTF= SDIR}/usr/sbin/update- > > > > > > initramfs.isar" > > > > > > \ > > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 "${ROOTFSDIR}/usr/sbin/update-initramfs" > > > > > > +=C2=A0=C2=A0=C2=A0 fi > > > > > > +} > > > > > > + > > > > > > +ROOTFS_POSTPROCESS_COMMAND +=3D > > > > > > "${@bb.utils.contains('ROOTFS_FEATURES', 'no-generate- > > > > > > initrd', > > > > > > '', > > > > > > 'rootfs_generate_initrd', d)}" > > > > > > +rootfs_generate_initrd[weight] =3D "10" > > > > > > +rootfs_generate_initrd() { > > > > > > +=C2=A0=C2=A0=C2=A0 if [ -n "$(sudo find '${ROOTFSDIR}/boot' -t= ype f -name > > > > > > 'vmlinu[xz]*')" ]; then > > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sudo -E chroot "${R= OOTFSDIR}" sh -c '\ > > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 export kernel_version=3D$(basename > > > > > > /boot/vmlinu[xz]* | > > > > > > cut -d'-' -f2-); \ > > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 update-initramfs -u -v -k "$kernel_version";' > > > > > > +=C2=A0=C2=A0=C2=A0 else > > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 echo "no kernel in = this rootfs, do not generate > > > > > > initrd" > > > > > > +=C2=A0=C2=A0=C2=A0 fi > > > > > > +} > > > > > > + > > > > > > =C2=A0=C2=A0do_rootfs_postprocess[vardeps] =3D > > > > > > "${ROOTFS_POSTPROCESS_COMMAND}" > > > > > > =C2=A0=C2=A0do_rootfs_postprocess[network] =3D "${TASK_USE_SUDO= }" > > > > > > =C2=A0=C2=A0python do_rootfs_postprocess() { > > > > > > diff --git a/meta/recipes-core/isar-bootstrap/isar- > > > > > > bootstrap.inc > > > > > > b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > > > > > > index 3477c2fb..4c6011bc 100644 > > > > > > --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > > > > > > +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > > > > > > @@ -24,6 +24,8 @@ DISTRO_BOOTSTRAP_KEYFILES =3D "" > > > > > > =C2=A0=C2=A0THIRD_PARTY_APT_KEYFILES =3D "" > > > > > > =C2=A0=C2=A0DEPLOY_ISAR_BOOTSTRAP ?=3D "" > > > > > > =C2=A0=C2=A0DISTRO_BOOTSTRAP_BASE_PACKAGES =3D "locales" > > > > > > +# install early, so we can stub the update-initramfs > > > > > > script > > > > > > before > > > > > > rootfs install > > > > > > +DISTRO_BOOTSTRAP_BASE_PACKAGES:append =3D ",initramfs-tools" > > > > > > =C2=A0=C2=A0DISTRO_BOOTSTRAP_BASE_PACKAGES:append:gnupg =3D ",g= nupg" > > > > > > =C2=A0=C2=A0DISTRO_BOOTSTRAP_BASE_PACKAGES:append:https-support= =3D > > > > > > ",ca- > > > > > > certificates" > > > > > > =C2=A0=C2=A0DISTRO_VARS_PREFIX ?=3D "${@'HOST_' if > > > > > > d.getVar('BOOTSTRAP_FOR_HOST') =3D=3D '1' else ''}" > > > > >=20 > > > > > The idea is quite nice for us in Isar, though I'd also > > > > > eventually > > > > > like > > > > > to improve Debian itself in this regard. The building blocks > > > > > are > > > > > there > > > > > in upstream but they do not fully work. > > > >=20 > > > > Yes, definitely. I reported this on the debian-kernel ML as > > > > well: > > > > https://lists.debian.org/debian-kernel/2023/12/msg00097.html > > > >=20 > > > > Anyways, are there more objections against this patch? > > >=20 > > > Any news on this? This is on the ML for quite some time without > > > objections. If required, I can send a rebased version. > > >=20 > >=20 > > I assume this is held back now by the current -rc cycle. Likely an > > improvement after 0.10. > >=20 > > Jan > >=20 >=20 > As 0.10 was released,=C2=A0 can we merge this? >=20 > Quirin Hello all. I run it in CI and delaying initrd creation seems to cause errors for some targets: build/tmp/work/debian-bullseye-armhf/isar-image-base-imx6- sabrelite/1.0-r0/temp/log.do_image_fit: ``` FATAL ERROR: Couldn't open "/home/builder/isar-image-base-imx6- sabrelite/deploy/isar-image-base-debian-bullseye-imx6-sabrelite- initrd.img": No such file or directory /usr/bin/mkimage: Can't open /home/builder/isar-image-base-imx6- sabrelite/deploy/isar-image-base-debian-bullseye-imx6- sabrelite.fit.tmp: No such file or directory ``` There were more patchsets applied for this run, but I think that others are not related.