public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Gylstorff Quirin <quirin.gylstorff@siemens.com>
To: isar-users@googlegroups.com, Uladzimir Bely <ubely@ilbers.de>
Cc: felix.moessbauer@siemens.com, jan.kiszka@siemens.com,
	ADLER MICHAEL Z003XM1Z <michael.adler@siemens.com>
Subject: Re: [RFC] image-postproc-extension: Configurable systemd first boot
Date: Fri, 4 Aug 2023 13:07:41 +0200	[thread overview]
Message-ID: <2466d455-d5e0-780c-dc2b-ee28a2594df8@siemens.com> (raw)
In-Reply-To: <20221129104654.217984-1-Quirin.Gylstorff@siemens.com>



On 11/29/22 11:46, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> The Default implementation will not trigger the first boot condition.
> 
> In case of a writable root file system systemd will enable all
> units in /usr/lib/systemd/system with the vendor preset enable.
> This will also enable units in /usr/lib/systemd/system which are
> disable during the installation like ssh.socket.
> 
> This will not happen in a Debian installation as first boot is
> the installation boot as defined by:
> "For normal operating system installations, where a custom image
> is created for a specific machine, /etc/machine-id should be
> populated during installation."
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>   meta/classes/image-postproc-extension.bbclass | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/classes/image-postproc-extension.bbclass b/meta/classes/image-postproc-extension.bbclass
> index 4a901cb..7e3b8e0 100644
> --- a/meta/classes/image-postproc-extension.bbclass
> +++ b/meta/classes/image-postproc-extension.bbclass
> @@ -53,15 +53,14 @@ image_postprocess_mark() {
>           --build-id "${BUILD_ID}" --variant "${DESCRIPTION}" --version "${PV}"
>   }
>   
> +ENABLE_SYSTEMD_FIRST_BOOT ??= "0"
>   ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
>   image_postprocess_machine_id() {
> -    # systemd(1) takes care of recreating the machine-id on first boot
> -    # for systemd < v247, set to empty string, else set to uninitialized
> -    # (required if initramfs with ro root is used)
>       SYSTEMD_VERSION=$( sudo chroot ${IMAGE_ROOTFS} dpkg-query --showformat='${source:Upstream-Version}' --show systemd || echo "0" )
> -    MACHINE_ID="uninitialized"
> -    if dpkg --compare-versions "$SYSTEMD_VERSION" "lt" "247"; then
> -        MACHINE_ID=""
> +    MACHINE_ID=""
> +    if [ "${ENABLE_SYSTEMD_FIRST_BOOT}" = "1" ] && \
> +        dpkg --compare-versions "$SYSTEMD_VERSION" "gt" "247"; then
> +        MACHINE_ID="uninitialized"
>       fi
>       echo "$MACHINE_ID" | sudo tee '${IMAGE_ROOTFS}/etc/machine-id'
>       sudo rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'

Ping
Quirin

  reply	other threads:[~2023-08-04 11:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29  9:50 Systemd first boot with rw rootfs Gylstorff Quirin
2022-11-29 10:46 ` [RFC] image-postproc-extension: Configurable systemd first boot Quirin Gylstorff
2023-08-04 11:07   ` Gylstorff Quirin [this message]
2023-08-04 11:33     ` Michael Adler

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=2466d455-d5e0-780c-dc2b-ee28a2594df8@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=michael.adler@siemens.com \
    --cc=ubely@ilbers.de \
    /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