From: Henning Schild <henning.schild@siemens.com>
To: Tobias Schaffner <tobias.schaffner@siemens.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
isar-users <isar-users@googlegroups.com>,
Christian Storm <christian.storm@siemens.com>
Subject: Re: [PATCH] expand-on-first-boot: Add support for devicemapper
Date: Fri, 22 Apr 2022 09:21:05 +0200 [thread overview]
Message-ID: <20220422092105.66a6e680@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <32399d99-19e3-57b2-07c8-3f172302433b@siemens.com>
Am Fri, 22 Apr 2022 08:28:22 +0200
schrieb Tobias Schaffner <tobias.schaffner@siemens.com>:
> Switching to systemd-repart would also fix a rare race condition.
> Expand-on-first-boot can cause systemd to not be able to mount its
> mount units if it makes the kernel reload the partition table in a
> bad moment.
I do not think we will be able to replace expand-on-first-boot entirely
with systemd-repart. Having distros which do not support that yet and
potentially having images without systemd even.
So if there is such a race a fix for it would be highly appreciated.
Could be a matter of unit dependencies.
In fact i will look into adding a test for expansion to CI.
Can be done with qemu-img resize or maybe a wic spacer and installing
"expand-on-first-boot".
Henning
> Tobias
>
> On 4/21/22 21:05, Henning Schild wrote:
> > Am Thu, 21 Apr 2022 19:43:47 +0200
> > schrieb Henning Schild <henning.schild@siemens.com>:
> >
> >> I learned yesterday about systemd-repart
> >> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.freedesktop.org%2Fsoftware%2Fsystemd%2Fman%2Fsystemd-repart.service.html&data=05%7C01%7Ctobias.schaffner%40siemens.com%7C045ffc25cea442b91a7808da23c9e432%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637861648059484524%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qlzBS8YjhJBvZE7LnofOlT6uE76Nrsu45xZ25E9ocj4%3D&reserved=0
> >>
> >
> > This currently needs >= bookworm to even start playing with systemd
> > >= 250.1-2
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.debian.org%2Fcgi-bin%2Fbugreport.cgi%3Fbug%3D976959&data=05%7C01%7Ctobias.schaffner%40siemens.com%7C045ffc25cea442b91a7808da23c9e432%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637861648059484524%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Zlq1hF7%2BbE5FS3gayX6jhaVzykvJNrwc1lhITORUZ%2BU%3D&reserved=0
> >
> > So maybe a little too early for isar, but still something we could
> > look into.
> >
> > systemd-growfs is also available in older versions, but that just
> > deals with the filesystem, not with the partition table.
> >
> > Henning
> >
> >> We should look at this and how mkosi puts/uses it for debian.
> >>
> >> Not a review, just a generic remark that there might be more
> >> powerful and ready to use tools out there. At some point i will
> >> play with this and see if it can replace expand-on-first-boot, i
> >> bet we will soon hear the first btrfs stories ... and maybe luks.
> >>
> >> I know people do that with isar and their own funny scripting which
> >> can not be found upstream.
> >>
> >> Am Thu, 21 Apr 2022 19:10:44 +0200
> >> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> >>
> >>> From: Jan Kiszka <jan.kiszka@siemens.com>
> >>>
> >>> When the rootfs is inside a devicemapper volume, e.g. dm-verity,
> >>> the script so far fails to identify the boot device. This adds at
> >>> least basic support for that case (single level, single slave).
> >>> Once there is a good example for more complex setups, this could
> >>> be taken into account as well.
> >>>
> >>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> >>> ---
> >>> .../expand-on-first-boot/files/expand-last-partition.sh | 7
> >>> ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git
> >>> a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
> >>> b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
> >>> index 7175dfd3..bb371e9f 100755 ---
> >>> a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
> >>> +++
> >>> b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
> >>> @@ -10,8 +10,13 @@ set -e ROOT_DEV="$(findmnt / -o source -n)"
> >>> -BOOT_DEV="$(echo "${ROOT_DEV}" | sed 's/p\?[0-9]*$//')"
> >>> +ROOT_DEV_NAME=${ROOT_DEV##*/}
> >>> +ROOT_DEV_SLAVE=$(ls -d /sys/block/${ROOT_DEV_NAME}/slaves/*
> >>> 2>/dev/null | head -1) +if [ -n ${ROOT_DEV_SLAVE} ]; then
> >>> + ROOT_DEV=/dev/${ROOT_DEV_SLAVE##*/}
> >>> +fi
> >>>
> >>> +BOOT_DEV="$(echo "${ROOT_DEV}" | sed 's/p\?[0-9]*$//')"
> >>
> >> Please add a wks and switch at least one CI target. In case wic can
> >> not generate that dm-verity ... NACK, or provide the wic plugin as
> >> well.
> >>
> >> Henning
> >>
> >>> if [ "${ROOT_DEV}" = "${BOOT_DEV}" ]; then
> >>> echo "Boot device equals root device - no partitioning
> >>> found" >&2 exit 1
> >>
> >
next prev parent reply other threads:[~2022-04-22 7:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 17:10 Jan Kiszka
2022-04-21 17:43 ` Henning Schild
2022-04-21 18:49 ` Jan Kiszka
2022-04-21 19:05 ` Henning Schild
2022-04-22 6:28 ` Tobias Schaffner
2022-04-22 7:21 ` Henning Schild [this message]
2022-04-22 9:08 ` Jan Kiszka
2022-05-14 14:05 ` Anton Mikanovich
2022-05-19 11:51 ` Moessbauer, Felix
2022-05-19 12:23 ` Henning Schild
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=20220422092105.66a6e680@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=christian.storm@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=tobias.schaffner@siemens.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