public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs
@ 2022-10-26  8:20 Henning Schild
  2022-10-26  8:21 ` [PATCH v7 1/2] expand-on-first-boot: fix runtime deps for debian stretch Henning Schild
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Henning Schild @ 2022-10-26  8:20 UTC (permalink / raw)
  To: isar-users; +Cc: Joe MacDonald, Tobias Schmidl, Jan Kiszka, Henning Schild

Diff to v6:
- fix shell script syntax error
- include a patch to actually make the package installable on stretch

Diff to v5:
- keep fallback path for debian stretch simply using old code and rdeps

Original Authors log:

Diff to v1:
- Rewording on patch message ("root partition" --> "last partition",
  added note to systemd-dependency and its impact)
- Added systemd-version dependency
- Removed runtime if case that allowed for non-systemd systems

Diff to v2:
- Version bump to v1.2
- Removed e2fsprogs as dependency

Diff to v3:
- Omit the explicit call to systemd-growfs if a fstab option has been
  found
- Be able to deal with both mounted and unmounted mountpoints

Diff to v4:
- Mount the last partition unconditionally to a tmp dir and let
  systemd-growfs operate there.

Henning Schild (1):
  expand-on-first-boot: fix runtime deps for debian stretch

Tobias Schmidl (1):
  expand-on-first-boot: Switch from resize2fs to systemd-growfs

 ...oot_1.1.bb => expand-on-first-boot_1.2.bb} |  5 +--
 .../files/expand-last-partition.sh            | 31 ++++++++++++++++---
 2 files changed, 29 insertions(+), 7 deletions(-)
 rename meta/recipes-support/expand-on-first-boot/{expand-on-first-boot_1.1.bb => expand-on-first-boot_1.2.bb} (82%)

-- 
2.37.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v7 1/2] expand-on-first-boot: fix runtime deps for debian stretch
  2022-10-26  8:20 [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
@ 2022-10-26  8:21 ` Henning Schild
  2022-10-26  8:21 ` [PATCH v7 2/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Henning Schild @ 2022-10-26  8:21 UTC (permalink / raw)
  To: isar-users; +Cc: Joe MacDonald, Tobias Schmidl, Jan Kiszka, Henning Schild

In debian stretch sfdisk was part of util-linux and not the new package
fdisk. Change the DEBIAN_DEPENDS to allow installation on stretch again.

Fixes: a298cccda57f ("expand-on-first-boot: List fdisk as explicit dependency")
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 .../expand-on-first-boot/expand-on-first-boot_1.1.bb            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
index 1703a648ca27..630e8d2cc510 100644
--- a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
+++ b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
@@ -9,7 +9,7 @@ inherit dpkg-raw
 
 DESCRIPTION = "This service grows the last partition to the full medium during first boot"
 
-DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk, util-linux"
+DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk (>=2.29.2-3) | util-linux (<2.29.2-3), util-linux"
 
 SRC_URI = " \
     file://expand-on-first-boot.service \
-- 
2.37.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v7 2/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs
  2022-10-26  8:20 [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
  2022-10-26  8:21 ` [PATCH v7 1/2] expand-on-first-boot: fix runtime deps for debian stretch Henning Schild
@ 2022-10-26  8:21 ` Henning Schild
  2022-12-13  8:33   ` Henning Schild
  2022-10-26  8:23 ` [PATCH v7 0/2] " Henning Schild
  2022-11-04 12:49 ` Anton Mikanovich
  3 siblings, 1 reply; 7+ messages in thread
From: Henning Schild @ 2022-10-26  8:21 UTC (permalink / raw)
  To: isar-users; +Cc: Joe MacDonald, Tobias Schmidl, Jan Kiszka, Henning Schild

From: Tobias Schmidl <tobiasschmidl@siemens.com>

We want to be more versatile in our approach of resizing the last
partition. Therefore we switch from resize2fs to systemd-growfs.

This allows for ext4, btrfs, xfs, and dm-crypt partitions to be resized.

Signed-off-by: Tobias Schmidl <tobiasschmidl@siemens.com>
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 ...oot_1.1.bb => expand-on-first-boot_1.2.bb} |  3 +-
 .../files/expand-last-partition.sh            | 31 ++++++++++++++++---
 2 files changed, 28 insertions(+), 6 deletions(-)
 rename meta/recipes-support/expand-on-first-boot/{expand-on-first-boot_1.1.bb => expand-on-first-boot_1.2.bb} (89%)

diff --git a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
similarity index 89%
rename from meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
rename to meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
index 630e8d2cc510..0996000c3ce0 100644
--- a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
+++ b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
@@ -1,13 +1,14 @@
 # Resize last partition to full medium size on fist boot
 #
 # This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2018
+# Copyright (c) Siemens AG, 2018-2022
 #
 # SPDX-License-Identifier: MIT
 
 inherit dpkg-raw
 
 DESCRIPTION = "This service grows the last partition to the full medium during first boot"
+MAINTAINER = "isar-users <isar-users@googlegroups.com>"
 
 DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk (>=2.29.2-3) | util-linux (<2.29.2-3), util-linux"
 
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 759ff8b61ccd..57055ccdcbd8 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
@@ -3,7 +3,7 @@
 # Resize last partition to full medium size
 #
 # This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2018
+# Copyright (c) Siemens AG, 2018-2022
 #
 # SPDX-License-Identifier: MIT
 
@@ -57,8 +57,29 @@ sfdisk -d "${BOOT_DEV}" 2>/dev/null | \
 # Inform the kernel about the partitioning change
 partx -u "${LAST_PART}"
 
-# Do not fail resize2fs if no mtab entry is found, e.g.,
-# when using systemd mount units.
-export EXT2FS_NO_MTAB_OK=1
+# this is for debian stretch or systemd < 236
+if [ ! -x /lib/systemd/systemd-growfs ]; then
+	# Do not fail resize2fs if no mtab entry is found, e.g.,
+	# when using systemd mount units.
+	export EXT2FS_NO_MTAB_OK=1
 
-resize2fs "${LAST_PART}"
+	resize2fs "${LAST_PART}"
+	exit 0
+fi
+
+if grep -q x-systemd.growfs /etc/fstab; then
+	echo "Found x-systemd.growfs option in /etc/fstab, won't call it explicitly." >&2
+	exit 0
+fi
+
+# mount $LAST_PART out of tree, so we won't conflict with other mounts
+MOUNT_POINT=$(mktemp -d -p /mnt "$(basename "$0").XXXXXXXXXX")
+if [ ! -d "${MOUNT_POINT}" ]; then
+	echo "Cannot create temporary mount point ${MOUNT_POINT}." >&2
+	exit 1
+fi
+
+mount "${LAST_PART}" "${MOUNT_POINT}"
+/lib/systemd/systemd-growfs "${MOUNT_POINT}"
+umount "${MOUNT_POINT}"
+rmdir "${MOUNT_POINT}"
-- 
2.37.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs
  2022-10-26  8:20 [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
  2022-10-26  8:21 ` [PATCH v7 1/2] expand-on-first-boot: fix runtime deps for debian stretch Henning Schild
  2022-10-26  8:21 ` [PATCH v7 2/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
@ 2022-10-26  8:23 ` Henning Schild
  2022-10-26  8:30   ` Anton Mikanovich
  2022-11-04 12:49 ` Anton Mikanovich
  3 siblings, 1 reply; 7+ messages in thread
From: Henning Schild @ 2022-10-26  8:23 UTC (permalink / raw)
  To: isar-users; +Cc: Joe MacDonald, Tobias Schmidl, Jan Kiszka

I ran a set of manual tests on that. stretch worked and did resize, on
bullseye i tried ext4 and btrfs, worked fine.

Henning

Am Wed, 26 Oct 2022 10:20:59 +0200
schrieb Henning Schild <henning.schild@siemens.com>:

> Diff to v6:
> - fix shell script syntax error
> - include a patch to actually make the package installable on stretch
> 
> Diff to v5:
> - keep fallback path for debian stretch simply using old code and
> rdeps
> 
> Original Authors log:
> 
> Diff to v1:
> - Rewording on patch message ("root partition" --> "last partition",
>   added note to systemd-dependency and its impact)
> - Added systemd-version dependency
> - Removed runtime if case that allowed for non-systemd systems
> 
> Diff to v2:
> - Version bump to v1.2
> - Removed e2fsprogs as dependency
> 
> Diff to v3:
> - Omit the explicit call to systemd-growfs if a fstab option has been
>   found
> - Be able to deal with both mounted and unmounted mountpoints
> 
> Diff to v4:
> - Mount the last partition unconditionally to a tmp dir and let
>   systemd-growfs operate there.
> 
> Henning Schild (1):
>   expand-on-first-boot: fix runtime deps for debian stretch
> 
> Tobias Schmidl (1):
>   expand-on-first-boot: Switch from resize2fs to systemd-growfs
> 
>  ...oot_1.1.bb => expand-on-first-boot_1.2.bb} |  5 +--
>  .../files/expand-last-partition.sh            | 31
> ++++++++++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-)
>  rename
> meta/recipes-support/expand-on-first-boot/{expand-on-first-boot_1.1.bb
> => expand-on-first-boot_1.2.bb} (82%)
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs
  2022-10-26  8:23 ` [PATCH v7 0/2] " Henning Schild
@ 2022-10-26  8:30   ` Anton Mikanovich
  0 siblings, 0 replies; 7+ messages in thread
From: Anton Mikanovich @ 2022-10-26  8:30 UTC (permalink / raw)
  To: Henning Schild, isar-users; +Cc: Joe MacDonald, Tobias Schmidl, Jan Kiszka

26.10.2022 11:23, Henning Schild wrote:
> I ran a set of manual tests on that. stretch worked and did resize, on
> bullseye i tried ext4 and btrfs, worked fine.
>
> Henning

Great, thanks for testing. We will also check it and I hope merge soon.

If speaking about stretch itself, we should decide a date of dropping it to
allow downstreams still use it move to the next distro.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs
  2022-10-26  8:20 [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
                   ` (2 preceding siblings ...)
  2022-10-26  8:23 ` [PATCH v7 0/2] " Henning Schild
@ 2022-11-04 12:49 ` Anton Mikanovich
  3 siblings, 0 replies; 7+ messages in thread
From: Anton Mikanovich @ 2022-11-04 12:49 UTC (permalink / raw)
  To: Henning Schild, isar-users; +Cc: Joe MacDonald, Tobias Schmidl, Jan Kiszka

26.10.2022 11:20, Henning Schild wrote:
> Diff to v6:
> - fix shell script syntax error
> - include a patch to actually make the package installable on stretch
>
> Diff to v5:
> - keep fallback path for debian stretch simply using old code and rdeps
>
> Original Authors log:
>
> Diff to v1:
> - Rewording on patch message ("root partition" --> "last partition",
>    added note to systemd-dependency and its impact)
> - Added systemd-version dependency
> - Removed runtime if case that allowed for non-systemd systems
>
> Diff to v2:
> - Version bump to v1.2
> - Removed e2fsprogs as dependency
>
> Diff to v3:
> - Omit the explicit call to systemd-growfs if a fstab option has been
>    found
> - Be able to deal with both mounted and unmounted mountpoints
>
> Diff to v4:
> - Mount the last partition unconditionally to a tmp dir and let
>    systemd-growfs operate there.
>
> Henning Schild (1):
>    expand-on-first-boot: fix runtime deps for debian stretch
>
> Tobias Schmidl (1):
>    expand-on-first-boot: Switch from resize2fs to systemd-growfs
>
>   ...oot_1.1.bb => expand-on-first-boot_1.2.bb} |  5 +--
>   .../files/expand-last-partition.sh            | 31 ++++++++++++++++---
>   2 files changed, 29 insertions(+), 7 deletions(-)
>   rename meta/recipes-support/expand-on-first-boot/{expand-on-first-boot_1.1.bb => expand-on-first-boot_1.2.bb} (82%)
>
Applied to next, thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v7 2/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs
  2022-10-26  8:21 ` [PATCH v7 2/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
@ 2022-12-13  8:33   ` Henning Schild
  0 siblings, 0 replies; 7+ messages in thread
From: Henning Schild @ 2022-12-13  8:33 UTC (permalink / raw)
  To: isar-users; +Cc: Joe MacDonald, Tobias Schmidl, Jan Kiszka

Am Wed, 26 Oct 2022 10:21:01 +0200
schrieb Henning Schild <henning.schild@siemens.com>:

> From: Tobias Schmidl <tobiasschmidl@siemens.com>
> 
> We want to be more versatile in our approach of resizing the last
> partition. Therefore we switch from resize2fs to systemd-growfs.
> 
> This allows for ext4, btrfs, xfs, and dm-crypt partitions to be
> resized.
> 
> Signed-off-by: Tobias Schmidl <tobiasschmidl@siemens.com>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  ...oot_1.1.bb => expand-on-first-boot_1.2.bb} |  3 +-
>  .../files/expand-last-partition.sh            | 31
> ++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-)
>  rename
> meta/recipes-support/expand-on-first-boot/{expand-on-first-boot_1.1.bb
> => expand-on-first-boot_1.2.bb} (89%)
> 
> diff --git
> a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
> b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
> similarity index 89% rename from
> meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
> rename to
> meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
> index 630e8d2cc510..0996000c3ce0 100644 ---
> a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
> +++
> b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
> @@ -1,13 +1,14 @@ # Resize last partition to full medium size on fist
> boot # # This software is a part of ISAR. -# Copyright (c) Siemens
> AG, 2018 +# Copyright (c) Siemens AG, 2018-2022 #
>  # SPDX-License-Identifier: MIT
>  
>  inherit dpkg-raw
>  
>  DESCRIPTION = "This service grows the last partition to the full
> medium during first boot" +MAINTAINER = "isar-users
> <isar-users@googlegroups.com>" 
>  DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs,
> fdisk (>=2.29.2-3) | util-linux (<2.29.2-3), util-linux" 
> 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 759ff8b61ccd..57055ccdcbd8 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
> @@ -3,7 +3,7 @@ # Resize last partition to full medium size # # This
> software is a part of ISAR. -# Copyright (c) Siemens AG, 2018
> +# Copyright (c) Siemens AG, 2018-2022
>  #
>  # SPDX-License-Identifier: MIT
>  
> @@ -57,8 +57,29 @@ sfdisk -d "${BOOT_DEV}" 2>/dev/null | \
>  # Inform the kernel about the partitioning change
>  partx -u "${LAST_PART}"
>  
> -# Do not fail resize2fs if no mtab entry is found, e.g.,
> -# when using systemd mount units.
> -export EXT2FS_NO_MTAB_OK=1
> +# this is for debian stretch or systemd < 236
> +if [ ! -x /lib/systemd/systemd-growfs ]; then
> +	# Do not fail resize2fs if no mtab entry is found, e.g.,
> +	# when using systemd mount units.
> +	export EXT2FS_NO_MTAB_OK=1
>  
> -resize2fs "${LAST_PART}"
> +	resize2fs "${LAST_PART}"
> +	exit 0
> +fi
> +
> +if grep -q x-systemd.growfs /etc/fstab; then
> +	echo "Found x-systemd.growfs option in /etc/fstab, won't
> call it explicitly." >&2
> +	exit 0
> +fi
> +
> +# mount $LAST_PART out of tree, so we won't conflict with other
> mounts +MOUNT_POINT=$(mktemp -d -p /mnt "$(basename "$0").XXXXXXXXXX")

We have some layers that make parts of the filesystem structure
read-only. While this patch will be reverted the code will come back
with another patch i will propose.

I will switch from -p /mnt to -p "", which essentially means going to
/tmp or allowing people to set TMPDIR

Henning

> +if [ ! -d "${MOUNT_POINT}" ]; then
> +	echo "Cannot create temporary mount point ${MOUNT_POINT}."
> >&2
> +	exit 1
> +fi
> +
> +mount "${LAST_PART}" "${MOUNT_POINT}"
> +/lib/systemd/systemd-growfs "${MOUNT_POINT}"
> +umount "${MOUNT_POINT}"
> +rmdir "${MOUNT_POINT}"


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-13  8:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26  8:20 [PATCH v7 0/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
2022-10-26  8:21 ` [PATCH v7 1/2] expand-on-first-boot: fix runtime deps for debian stretch Henning Schild
2022-10-26  8:21 ` [PATCH v7 2/2] expand-on-first-boot: Switch from resize2fs to systemd-growfs Henning Schild
2022-12-13  8:33   ` Henning Schild
2022-10-26  8:23 ` [PATCH v7 0/2] " Henning Schild
2022-10-26  8:30   ` Anton Mikanovich
2022-11-04 12:49 ` Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox