From patchwork Fri Jul 12 08:11:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Koch X-Patchwork-Id: 13731376 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6687C3DA4D for ; Fri, 12 Jul 2024 08:12:00 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.59]) by mx.groups.io with SMTP id smtpd.web10.3114.1720771915351009156 for ; Fri, 12 Jul 2024 01:11:56 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@siemens.com header.s=selector2 header.b=apmNXLUZ; spf=pass (domain: siemens.com, ip: 40.107.21.59, mailfrom: stefan-koch@siemens.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nNz9OgLi7elP6tDRPmuvdAQTwFsEySz1InJLFzKKBxYpwZJGqv9GCOkOfN/E++ut9iinGrsIV2dxdgajuaS1WUrFLhoZ+K/LNvn6b7n9uZo5WZiDvVdHtaZkVodbAE30wub3XdePgEhKHDdhw+0qHGbBRVDlir6moL82US/GQvZLu00PlfuvDU2TwlXOfYr8l2lBQxGQdV1PRLZX7SWROwiPJPsvh3E9IcCMpFpL7MzqoVzHsb6ZtmxtOzDspyHeCI8h64ut9cSUMChPVDwIGk4dJhxRQEjfkvb0zUtkzhLqrTNQ8Ob76AlrzvwzYbmKm3vyim95bqtKotMi0eMPbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1Q24Tu2uwjZfXJmLlSAJYpA5T7ljBNbrWYhvu3P6hfc=; b=QSYHuWKWyiyti04apZETHtQ0pXgo7BgIchHjlow9AoSU+rB4r3XxWaPNtil5mgwKOflJkh/IS8My5tWjeveljzJfVfEEub6gG564Drs3cbw+vTvpTbWN4JxvarXal/q9Yu9oWKG2x49v/Gr3QR5ZxQ2768Xhx7s3egWewGoPDUKF9NicIGj+cBYunyF2DfVtkCLkGZKKafu9YVsr+6FaY0lJSSJLRuW7ShKH6q8vnXx5FroCrPXMZ5BfNd62fIixenme0pHAAAvqLUKvomQ8oTXF4zpgJXfc6JEPfV9CYs/LNw4b0BQZ6BCXY4ExNOcY6evhqMXIAlWYF0YbG2hUtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siemens.com; dmarc=pass action=none header.from=siemens.com; dkim=pass header.d=siemens.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Q24Tu2uwjZfXJmLlSAJYpA5T7ljBNbrWYhvu3P6hfc=; b=apmNXLUZEkqTY9xF6fD1k+TsuqUvyPX+3Zm/BuJ3Ag+awlVySbIuk5EOBzQMhFqJMrDvw/9NPcqc6mQXoNYWoe0m4QzB0jJ0V2jvESMbHzsknN+y+VWvWnZrVvBy40OAUXdHgGDxISb6LpNST7ErhCpOc8h1c1G8WA9rlJenaqUiaAwvZpfMhrI40f0+6+SHt3HNBH57PQXfkWpQeIhMPKF6mo3CHi7XsiTeHNtIvXFokxCzPfT8jxWxYM82setrTG1gCQWq8AGjkmooP9cNLFbow+W3Zg9aorT82Jjw1VU2CG+IEVj+9HLtD2/SV5bWhrW5EvFzGR/I8fm7ynYoPA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siemens.com; Received: from AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:41e::11) by VI1PR10MB8134.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:1df::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.20; Fri, 12 Jul 2024 08:11:52 +0000 Received: from AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM ([fe80::71d7:e998:3abf:a1ec]) by AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM ([fe80::71d7:e998:3abf:a1ec%4]) with mapi id 15.20.7762.020; Fri, 12 Jul 2024 08:11:52 +0000 From: Stefan Koch To: cip-dev@lists.cip-project.org CC: jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, christian.storm@siemens.com, michael.adler@siemens.com, simon.sudler@siemens.com, stefan-koch@siemens.com Subject: [PATCH 1/4] initramfs-crypt-hook: Do not attempt to repair a partially encrypted filesystem Date: Fri, 12 Jul 2024 10:11:40 +0200 Message-ID: <20240712081143.1376952-2-stefan-koch@siemens.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240712081143.1376952-1-stefan-koch@siemens.com> References: <20240712081143.1376952-1-stefan-koch@siemens.com> X-ClientProxiedBy: FR4P281CA0294.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:e7::15) To AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:41e::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR10MB4959:EE_|VI1PR10MB8134:EE_ X-MS-Office365-Filtering-Correlation-Id: a0d9f41e-59b5-4082-9fa4-08dca24a49a0 X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: 4Oq40kwsT4Mmx43Accw90To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IEFK8FPd71/IObSTPtoUQtP24qymh5jkp1OarGaBJ1u8ebtBexFOJvnmyjXb35U9DqNoMj8yDtMNM5OqwOF5tUXW18+495kXtzDCdt/TNWHJofJDyDnYwJABy0aFF3J9yRh8vilZ17qosdiRkNGn2ogp13A0xqtWBPU775ty2q2/ggT9Y29IkvdbPsNE/LS+yJktPDXYbipnvpHU6jG3FfUcmefEf5vBb+w91ca4fSvwCeXiNoynWso7TEUBcpk0w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hL+Y6iPq8DRh1XYaaq8nwAOCpJqjXRZTs5/clYTYpuVDpyeFafvs/TgAN5lJxs+E60WOzjow8Ij3FEpYG1g6J7BpNebHgX7aTLSdadlKYr6Lf24Oziq43kHyNW0wgpFVTcpBrDoAyzkBsLtn8BaSwq03S0ta5ldtL0Z2dqCSBE+ZOsjI60Iyux1sl6VUpZxe8rn0KLBkyXCzwcRN4ls2tF6hXG7pAxJMqIVaGJntb7xlLbVKuVNcybcEu+Cjm8X0oNgvnnVm93Fp7n7p+H+ZoRgCuXi9IurCKEnAUVi7KmazY6KzfhkVyEPefypiwf2vDpSScNPc2o/EGBNTuU0/VvkKKfyaDEEhgiUyUlp1OaqqseD1TBA6+iOhMMQS1XC5/dP4ZKiZBOzT+YSK3uwJ+8cJrL12CdFLxRwnztz0K3/gqV4efpE38vmTmdIAsaumPesc+u6vkGO7TdunrlWpLE3PtLgBBjMWF1qT2p8hldFUZsOh31sKstHL84jxVOBqryo4jKXkHkPjI9eZgUwkhUldf1M1rGc6tVdmtmMzTSToI3v1vE7aWHz6rdGQCUsjAW15B1l7WmO3PHKz2FWQs0K3uEol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siemens.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0d9f41e-59b5-4082-9fa4-08dca24a49a0 X-MS-Exchange-CrossTenant-AuthSource: AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 08:11:52.7807 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MNayEHfK8UsJZQ3e6loHS+Br1WVLjnZqnieKUxApoN5AQM9sGVyO8T57RSTJ/q9eI8HfcKAnnec3h3QDQbydjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB8134 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 12 Jul 2024 08:12:00 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/16458 Signed-off-by: Stefan Koch --- .../initramfs-crypt-hook/files/encrypt_partition.script | 8 +++++++- 1 file changed, 7 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 ff4c135..f943aea 100644 --- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script +++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.script @@ -77,7 +77,13 @@ reencrypt_existing_partition() { [options] broken_system_clock=true EOF - e2fsck -p -f "$1" + # ensure that filesystem is clean otherwise resize2fs will fail + # do not attempt to repair a partially encrypted filesystem + # ensure that there is no attempt to + # repair a partially encrypted filesystem + if ! cryptsetup luksUUID "$1" &> /dev/null; then + e2fsck -p -f "$1" + fi if ! resize2fs "$1" "${reduced_size_in_kb}"; then panic "reencryption of filesystem $1 cannot continue!" fi