diff mbox series

[isar-cip-core,2/2] encryption: assume broken_system_clock for e2fsck before resize

Message ID 20240621105215.2233044-3-Quirin.Gylstorff@siemens.com (mailing list archive)
State Accepted
Headers show
Series fixes and documentation | expand

Commit Message

Gylstorff Quirin June 21, 2024, 10:12 a.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Some embedded system have no battery and default to some time to
avoid an fsck error do to a superblock in the future.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../initramfs-crypt-hook/files/encrypt_partition.script    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Jan Kiszka June 21, 2024, 11:13 a.m. UTC | #1
On 21.06.24 12:12, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> Some embedded system have no battery and default to some time to
> avoid an fsck error do to a superblock in the future.
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  .../initramfs-crypt-hook/files/encrypt_partition.script    | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script
> index c319540..ff4c135 100644
> --- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script
> +++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script
> @@ -72,7 +72,12 @@ reencrypt_existing_partition() {
>  	case $partition_fstype in
>  	ext*)
>  		# reduce the filesystem and partition by 32M to fit the LUKS header
> -		e2fsck -f "$1"
> +		export E2FSCK_CONFIG=/tmp/e2fsck.conf
> +		cat > "$E2FSCK_CONFIG" << EOF
> +[options]
> +	broken_system_clock=true
> +EOF
> +		e2fsck -p -f "$1"
>  		if ! resize2fs "$1" "${reduced_size_in_kb}"; then
>  			panic "reencryption of filesystem $1 cannot continue!"
>  		fi

Thanks, applied this one already.

Jan
diff mbox series

Patch

diff --git a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script
index c319540..ff4c135 100644
--- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script
+++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script
@@ -72,7 +72,12 @@  reencrypt_existing_partition() {
 	case $partition_fstype in
 	ext*)
 		# reduce the filesystem and partition by 32M to fit the LUKS header
-		e2fsck -f "$1"
+		export E2FSCK_CONFIG=/tmp/e2fsck.conf
+		cat > "$E2FSCK_CONFIG" << EOF
+[options]
+	broken_system_clock=true
+EOF
+		e2fsck -p -f "$1"
 		if ! resize2fs "$1" "${reduced_size_in_kb}"; then
 			panic "reencryption of filesystem $1 cannot continue!"
 		fi