From 857e8f469cba32c4697fb005747b0f2a4edc4cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Wed, 4 Oct 2023 13:09:39 +0200 Subject: [PATCH] distro/rhel9: Make /boot 600 MiB big on RHEL 9.3+ Changes in xfsprogs in 9.3 caused XFS partitions have less available space (due to more space reserved for the log section). We discovered that this causes issues with kernel updates. When 3 kernels are already installed and dnf wants to install a new one (and replace the oldest one), /boot must contain 4 kernels for a brief period of time, which doesn't fit on the small partition. This causes the transation test to fail, and dnf refuses to perform such a transaction. There's a workaround: Remove one of the kernels manually using `dnf remove` before running an update. This is however quite surprising and annoying, thus this commits bumps the size of /boot to 600 MiB starting from 9.3 (and on CentOS Stream). --- pkg/distro/rhel9/azure.go | 10 ++++++++-- pkg/distro/rhel9/partition_tables.go | 14 ++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pkg/distro/rhel9/azure.go b/pkg/distro/rhel9/azure.go index 5e80d57389..cc88d4ca76 100644 --- a/pkg/distro/rhel9/azure.go +++ b/pkg/distro/rhel9/azure.go @@ -177,6 +177,12 @@ func azureRhuiPackageSet(t *imageType) rpmmd.PackageSet { // PARTITION TABLES func azureRhuiBasePartitionTables(t *imageType) (disk.PartitionTable, bool) { + // RHEL >= 9.3 needs to have a bigger /boot, see RHEL-7999 + bootSize := uint64(600) * common.MebiByte + if common.VersionLessThan(t.arch.distro.osVersion, "9.3") && t.arch.distro.isRHEL() { + bootSize = 500 * common.MebiByte + } + switch t.platform.GetArch() { case platform.ARCH_X86_64: return disk.PartitionTable{ @@ -198,7 +204,7 @@ func azureRhuiBasePartitionTables(t *imageType) (disk.PartitionTable, bool) { }, }, { - Size: 500 * common.MebiByte, + Size: bootSize, Type: disk.FilesystemDataGUID, UUID: disk.FilesystemDataUUID, Payload: &disk.Filesystem{ @@ -307,7 +313,7 @@ func azureRhuiBasePartitionTables(t *imageType) (disk.PartitionTable, bool) { }, }, { - Size: 500 * common.MebiByte, + Size: bootSize, Type: disk.FilesystemDataGUID, UUID: disk.FilesystemDataUUID, Payload: &disk.Filesystem{ diff --git a/pkg/distro/rhel9/partition_tables.go b/pkg/distro/rhel9/partition_tables.go index b977bf5db7..ff590dcdf9 100644 --- a/pkg/distro/rhel9/partition_tables.go +++ b/pkg/distro/rhel9/partition_tables.go @@ -7,6 +7,12 @@ import ( ) func defaultBasePartitionTables(t *imageType) (disk.PartitionTable, bool) { + // RHEL >= 9.3 needs to have a bigger /boot, see RHEL-7999 + bootSize := uint64(600) * common.MebiByte + if common.VersionLessThan(t.arch.distro.osVersion, "9.3") && t.arch.distro.isRHEL() { + bootSize = 500 * common.MebiByte + } + switch t.platform.GetArch() { case platform.ARCH_X86_64: return disk.PartitionTable{ @@ -34,7 +40,7 @@ func defaultBasePartitionTables(t *imageType) (disk.PartitionTable, bool) { }, }, { - Size: 500 * common.MebiByte, + Size: bootSize, Type: disk.XBootLDRPartitionGUID, UUID: disk.FilesystemDataUUID, Payload: &disk.Filesystem{ @@ -81,7 +87,7 @@ func defaultBasePartitionTables(t *imageType) (disk.PartitionTable, bool) { }, }, { - Size: 500 * common.MebiByte, + Size: bootSize, Type: disk.XBootLDRPartitionGUID, UUID: disk.FilesystemDataUUID, Payload: &disk.Filesystem{ @@ -119,7 +125,7 @@ func defaultBasePartitionTables(t *imageType) (disk.PartitionTable, bool) { Bootable: true, }, { - Size: 500 * common.MebiByte, + Size: bootSize, Payload: &disk.Filesystem{ Type: "xfs", Mountpoint: "/boot", @@ -148,7 +154,7 @@ func defaultBasePartitionTables(t *imageType) (disk.PartitionTable, bool) { Type: "dos", Partitions: []disk.Partition{ { - Size: 500 * common.MebiByte, + Size: bootSize, Payload: &disk.Filesystem{ Type: "xfs", Mountpoint: "/boot",