public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "MOESSBAUER, Felix" <felix.moessbauer@siemens.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>,
	"Hombourger, Cedric" <cedric.hombourger@siemens.com>
Subject: Re: [PATCH] debianize: handle .triggers and .service files
Date: Tue, 14 Nov 2023 20:22:25 +0000	[thread overview]
Message-ID: <1ce9e25b59ca7f0c10ace67ed41a58aea59c2395.camel@siemens.com> (raw)
In-Reply-To: <20231114195427.345320-1-cedric.hombourger@siemens.com>

On Tue, 2023-11-14 at 20:54 +0100, 'Cedric Hombourger' via isar-users
wrote:
> Some packages need to update/rebuild the initramfs and this is
> particularly
> slow on Debian systems (which are not using more modern technologies
> such
> as dracut or mkosi). Instead of having each package call update-
> initramfs,
> use a trigger instead to have dpkg defer that call to the very end of
> the
> transaction. Many packages also failed to rebuild the initramfs when
> the
> package gets removed. Demonstrate use with initramfs-fsck-hook-ext4.

Hi Cedric,

thanks for bringing this up. Especially on non x86 builds the update-
initramfs can take really long due to the emulation.

I also played around with disabling the initrd update during image
building of images with a custom initramfs (where the one from the
rootfs is anyways not used). However the issue is, that the config
change needs to be made in /etc/initramfs-tools/update-initramfs.conf,
which is shipped by initramfs-tools (no conf.d style supported). By
that, we would need to add this package to the default set of packages
which I also dislike.

What I don't understand is how the initrd trigger should help. The
/usr/sbin/update-initramfs internally already detects the invocation
via dpkg and dispatches to the trigger, so manually adding this is nice
syntax wise, but does not make a difference in performance.

Ideally, we don't update the initrd at all during package install, but
just generate it at do_rootfs_postprocess.

Felix

> 
> Other packages ship systemd units and usually do this using
> do_install()
> and a postinst script. Such recipes also fail to handle the removal
> of
> such packages. By naming the unit ${PN}.service and putting it under
> debian/, debhelper will generate the necessary maintainer scripts
> (preinst, postinst, prerm, postrm).
> 
> Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
> ---
>  meta/classes/debianize.bbclass                            | 8
> ++++++++
>  ...d-on-first-boot_1.4.bb => expand-on-first-boot_1.5.bb} | 6 +-----
>  meta/recipes-support/expand-on-first-boot/files/postinst  | 3 ---
>  .../files/{postinst => initramfs-fsck-hook-ext4.triggers} | 5 ++---
>  ...k-hook-ext4_0.1.bb => initramfs-fsck-hook-ext4_0.2.bb} | 2 +-
>  5 files changed, 12 insertions(+), 12 deletions(-)
>  rename meta/recipes-support/expand-on-first-boot/{expand-on-first-
> boot_1.4.bb => expand-on-first-boot_1.5.bb} (78%)
>  delete mode 100644 meta/recipes-support/expand-on-first-
> boot/files/postinst
>  rename meta/recipes-support/initramfs-fsck-hook/files/{postinst =>
> initramfs-fsck-hook-ext4.triggers} (51%)
>  rename meta/recipes-support/initramfs-fsck-hook/{initramfs-fsck-
> hook-ext4_0.1.bb => initramfs-fsck-hook-ext4_0.2.bb} (88%)
> 
> diff --git a/meta/classes/debianize.bbclass
> b/meta/classes/debianize.bbclass
> index df7c5b50..25ae2023 100644
> --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -138,4 +138,12 @@ deb_debianize() {
>                         fi
>                 done
>         done
> +
> +       # handle PN.service and PN.triggers files for use with
> debhelper
> +       for f in service triggers
> +       do
> +               if [ -f ${WORKDIR}/${PN}.${f} ]; then
> +                       install -v -m 644 ${WORKDIR}/${PN}.${f}
> ${S}/debian/
> +               fi
> +       done
>  }
> diff --git a/meta/recipes-support/expand-on-first-boot/expand-on-
> first-boot_1.4.bb b/meta/recipes-support/expand-on-first-boot/expand-
> on-first-boot_1.5.bb
> similarity index 78%
> rename from meta/recipes-support/expand-on-first-boot/expand-on-
> first-boot_1.4.bb
> rename to meta/recipes-support/expand-on-first-boot/expand-on-first-
> boot_1.5.bb
> index 0996000c..1b5b066b 100644
> --- a/meta/recipes-support/expand-on-first-boot/expand-on-first-
> boot_1.4.bb
> +++ b/meta/recipes-support/expand-on-first-boot/expand-on-first-
> boot_1.5.bb
> @@ -14,13 +14,9 @@ DEBIAN_DEPENDS = "systemd, sed, grep, coreutils,
> mount, e2fsprogs, fdisk (>=2.29
>  
>  SRC_URI = " \
>      file://expand-on-first-boot.service \
> -    file://expand-last-partition.sh \
> -    file://postinst"
> +    file://expand-last-partition.sh"
>  
>  do_install() {
> -    install -d -m 755 ${D}/lib/systemd/system
> -    install -m 644 ${WORKDIR}/expand-on-first-boot.service
> ${D}/lib/systemd/system/
> -
>      install -d -m 755 ${D}/usr/share/expand-on-first-boot
>      install -m 755 ${WORKDIR}/expand-last-partition.sh
> ${D}/usr/share/expand-on-first-boot/
>  }
> diff --git a/meta/recipes-support/expand-on-first-boot/files/postinst
> b/meta/recipes-support/expand-on-first-boot/files/postinst
> deleted file mode 100644
> index a190b01a..00000000
> --- a/meta/recipes-support/expand-on-first-boot/files/postinst
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#!/bin/sh
> -
> -systemctl enable expand-on-first-boot.service
> diff --git a/meta/recipes-support/initramfs-fsck-hook/files/postinst
> b/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-
> ext4.triggers
> similarity index 51%
> rename from meta/recipes-support/initramfs-fsck-hook/files/postinst
> rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-
> fsck-hook-ext4.triggers
> index 07bc3d94..db45dfdc 100644
> --- a/meta/recipes-support/initramfs-fsck-hook/files/postinst
> +++ b/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-
> hook-ext4.triggers
> @@ -1,6 +1,5 @@
> -#!/bin/sh
>  # This software is a part of ISAR.
> -# Copyright (C) Siemens AG, 2019
> +# Copyright (C) Siemens AG, 2023
>  #
>  # SPDX-License-Identifier: MIT
> -update-initramfs -u
> +activate-await update-initramfs
> diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-
> hook-ext4_0.1.bb b/meta/recipes-support/initramfs-fsck-
> hook/initramfs-fsck-hook-ext4_0.2.bb
> similarity index 88%
> rename from meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-
> hook-ext4_0.1.bb
> rename to meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-
> hook-ext4_0.2.bb
> index 0be52a3b..9860dbc8 100644
> --- a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-
> ext4_0.1.bb
> +++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-
> ext4_0.2.bb
> @@ -7,7 +7,7 @@
>  DESCRIPTION = "Recipe to add fsck hook to the initramfs"
>  
>  inherit dpkg-raw
> -SRC_URI = "file://postinst \
> +SRC_URI = "file://initramfs-fsck-hook-ext4.triggers \
>             file://initramfs.fsck.ext4.hook \
>            "
>  
> -- 
> 2.39.2
> 


  reply	other threads:[~2023-11-14 20:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 19:54 Cedric Hombourger
2023-11-14 20:22 ` MOESSBAUER, Felix [this message]
2023-11-15  8:36   ` Jan Kiszka
2023-11-15  8:43     ` MOESSBAUER, Felix
2023-11-15  8:57       ` cedric.hombourger
2023-11-15  9:03         ` MOESSBAUER, Felix
2023-11-16 12:38       ` Jan Kiszka
2024-03-07  7:23 ` Uladzimir Bely
2024-03-26 20:15 ` Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ce9e25b59ca7f0c10ace67ed41a58aea59c2395.camel@siemens.com \
    --to=felix.moessbauer@siemens.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox