Skip to content

Commit 364cab4

Browse files
Improve build-image on non-latest Rocky (#6889)
* Remove pinning of kernel-abi-stablelists According to https://access.redhat.com/solutions/444773 With Red Hat Enterprise Linux 7 and 8, the stablelist is valid for the particular major release. This means that once a symbol has been introduced into kABI for a particular major release, it will not be removed, nor will its meaning be changed during that kernel major release complete life cycle. With Red Hat Enterprise Linux 9, each minor release will have a unique stablelist that is valid throughout the minor release lifecycle. For more information on this, please refer to the following knowledgebase article; We are pinning the minor release for the duration of the build. So the stablelist for the minor version will be installed * Install kernel packages before pinning 1. Move DisableNouveau, InstallAdditionalKernelPackages from `update_and_reboot.yaml` to `parallelcluster.yaml`. This improves consistency of build between with and without `UpdateOsPackages` 2. Remove InstallEfiBootManager because the bug it was trying to work around already got resolved. 3. Move RHEL minor version pinning from `InstallPrerequisite` to the beginning of `PinVersion` for the following reasons 3.1 Even if we make mistakes pinning packages without installing, with minor version pinned, we will pin to the latest within the minor 3.2 `yum install -y yum-plugin-versionlock` will install the version within the minor 3.3 In terms of code style, RHEL minor version pinning fits in `PinVersion` better than `InstallPrerequisite` 4. For RHEL/Rocky, install kernel-headers, kernel-devel, kernel-devel-matched(RHEL/Rocky >=9) before pinning the version. For Ubuntu, install `linux-headers` before pinning the version 5. Add a Reboot after installing and pinning kernel packages * Enable vault repository for Rocky when mirrors don't work This commit improves the Rocky9 vault repository usage. Instead of using `wget` from the URL of the vault, this commit enables vault repository, so all subsequent `yum` commands will be able to use the vault. This reduces code duplication and improves robustness. Example of repo configuration in Rocky: ``` cat /etc/yum.repos.d/Rocky-AppStream.repo # Rocky-AppStream.repo # # The mirrorlist system uses the connecting IP address of the client and the # update status of each mirror to pick current mirrors that are geographically # close to the client. You should use this for Rocky updates unless you are # manually picking other mirrors. # # If the mirrorlist does not work for you, you can try the commented out # baseurl line instead. [appstream] name=Rocky Linux $releasever - AppStream mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial ```
1 parent b109307 commit 364cab4

File tree

3 files changed

+56
-98
lines changed

3 files changed

+56
-98
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
**BUG FIXES**
88
- Fix a bug that update-cluster, update-compute-fleet may fail when compute resources use an expired Capacity Reservation.
9+
- Fix build image failures on Rocky 9 non-lastest versions.
910

1011
3.13.1
1112
------

cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ phases:
184184
fi
185185
fi
186186
187-
- name: PinKernelVersion
187+
- name: PinVersion
188188
action: ExecuteBash
189189
inputs:
190190
commands:
@@ -193,26 +193,66 @@ phases:
193193
OS='{{ build.OperatingSystemName.outputs.stdout }}'
194194
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
195195
KERNEL_VERSION=$(uname -a)
196+
RELEASE_VERSION='{{ build.OperatingSystemVersion.outputs.stdout }}'
196197
if [[ ${!PLATFORM} == RHEL ]]; then
197-
yum install -y yum-plugin-versionlock
198-
# listing all the packages because wildcard does not work as expected
199-
yum versionlock kernel kernel-core kernel-modules
198+
if [[ ${!OS} == rhel9 ]] || [[ ${!OS} == rocky9 ]]; then
199+
if [[ ! -f /etc/yum/vars/releasever ]]; then
200+
echo "yes" > /opt/parallelcluster/pin_releasesever
201+
echo ${!RELEASE_VERSION} > /etc/yum/vars/releasever
202+
yum clean all
203+
fi
204+
fi
205+
PACKAGE_LIST="kernel-headers-$(uname -r) kernel-devel-$(uname -r)"
206+
if [[ ${!OS} != "rocky8" ]] && [[ ${!OS} != "rhel8" ]]; then
207+
PACKAGE_LIST+=" kernel-devel-matched-$(uname -r)"
208+
fi
200209
201-
if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then
202-
yum versionlock kernel-abi-whitelists
210+
if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
211+
for PACKAGE in ${!PACKAGE_LIST}
212+
do
213+
yum install -y ${!PACKAGE}
214+
if [ $? -ne 0 ]; then
215+
# Enable vault repository
216+
sed -i 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=http://dl.rockylinux.org/vault/rocky|g' /etc/yum.repos.d/*.repo
217+
sed -i 's|^#baseurl=https://dl.rockylinux.org/$contentdir|baseurl=https://dl.rockylinux.org/vault/rocky|g' /etc/yum.repos.d/*.repo
218+
yum install -y ${!PACKAGE}
219+
fi
220+
done
203221
else
204-
yum versionlock kernel-abi-stablelists
222+
for PACKAGE in ${!PACKAGE_LIST}
223+
do
224+
yum -y install ${!PACKAGE}
225+
done
205226
fi
206227
228+
yum install -y yum-plugin-versionlock
229+
# listing all the packages because wildcard does not work as expected
230+
yum versionlock kernel kernel-core kernel-modules
231+
207232
if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
208233
yum versionlock rocky-release rocky-repos
209234
elif [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rhel9" ]] ; then
210235
yum versionlock redhat-release
211236
fi
212237
else
238+
apt-get -y install linux-headers-$(uname -r)
213239
apt-mark hold linux-aws* linux-base* linux-headers* linux-image*
214240
fi
215-
echo "Kernel version is ${!KERNEL_VERSION}"
241+
echo "Kernel version is ${!KERNEL_VERSION}"
242+
243+
- name: DisableNouveau
244+
action: ExecuteBash
245+
inputs:
246+
commands:
247+
- |
248+
set -v
249+
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
250+
/bin/sed -r -i -e 's/GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="\1 rd.driver.blacklist=nouveau nouveau.modeset=0"/' /etc/default/grub
251+
if [[ ${!PLATFORM} == RHEL ]]; then
252+
grub2-mkconfig -o /boot/grub2/grub.cfg
253+
elif [[ ${!PLATFORM} == DEBIAN ]]; then
254+
update-grub
255+
fi
216256
217257
# Install prerequisite OS packages
218258
- name: InstallPrerequisite
@@ -223,16 +263,8 @@ phases:
223263
set -v
224264
OS='{{ build.OperatingSystemName.outputs.stdout }}'
225265
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
226-
VERSION='{{ build.OperatingSystemVersion.outputs.stdout }}'
227266
228267
if [[ ${!PLATFORM} == RHEL ]]; then
229-
if [[ ${!OS} == rhel9 ]] || [[ ${!OS} == rocky9 ]]; then
230-
if [[ ! -f /etc/yum/vars/releasever ]]; then
231-
echo "yes" > /opt/parallelcluster/pin_releasesever
232-
echo ${!VERSION} > /etc/yum/vars/releasever
233-
yum clean all
234-
fi
235-
fi
236268
yum -y update krb5-libs
237269
yum -y groupinstall development && sudo yum -y install wget jq
238270
if [[ ${!OS} != alinux2023 ]]; then
@@ -252,6 +284,13 @@ phases:
252284
apt-get -y install build-essential curl wget jq
253285
fi
254286
287+
- name: RebootStep
288+
action: Reboot
289+
onFailure: Abort
290+
maxAttempts: 2
291+
inputs:
292+
delaySeconds: 10
293+
255294
# Install Cinc
256295
- name: InstallCinc
257296
action: ExecuteBash
@@ -350,12 +389,6 @@ phases:
350389
if [[ ${!PLATFORM} == RHEL ]]; then
351390
yum versionlock delete kernel kernel-core kernel-modules
352391
353-
if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then
354-
yum versionlock delete kernel-abi-whitelists
355-
else
356-
yum versionlock delete kernel-abi-stablelists
357-
fi
358-
359392
if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
360393
yum versionlock delete rocky-release rocky-repos
361394
elif [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rhel9" ]] ; then

cli/src/pcluster/resources/imagebuilder/update_and_reboot.yaml

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,6 @@ phases:
9999
fi
100100
fi
101101
102-
- name: DisableNouveau
103-
action: ExecuteBash
104-
inputs:
105-
commands:
106-
- |
107-
set -v
108-
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
109-
/bin/sed -r -i -e 's/GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="\1 rd.driver.blacklist=nouveau nouveau.modeset=0"/' /etc/default/grub
110-
if [[ ${!PLATFORM} == RHEL ]]; then
111-
grub2-mkconfig -o /boot/grub2/grub.cfg
112-
elif [[ ${!PLATFORM} == DEBIAN ]]; then
113-
update-grub
114-
fi
115-
116102
- name: DisableUnattendedUpgrades
117103
action: ExecuteBash
118104
inputs:
@@ -131,20 +117,6 @@ phases:
131117
# update package index
132118
DEBIAN_FRONTEND=noninteractive apt-get -y update
133119
fi
134-
135-
- name: InstallEfiBootManager
136-
action: ExecuteBash
137-
inputs:
138-
commands:
139-
- |
140-
set -v
141-
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
142-
ARCH=$(uname -m)
143-
if [[ `echo ${!ARCH}` == 'aarch64' ]] && [[ ${!PLATFORM} == DEBIAN ]]; then
144-
# temporary workaround to solve https://bugs.launchpad.net/ubuntu/+source/grub2-signed/+bug/1936857
145-
apt-get -y install efibootmgr
146-
fi
147-
148120
- name: InstallPrerequisites
149121
action: ExecuteBash
150122
inputs:
@@ -202,12 +174,6 @@ phases:
202174
# listing all the packages because wildcard does not work as expected
203175
yum versionlock kernel kernel-core kernel-modules
204176
205-
if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then
206-
yum versionlock kernel-abi-whitelists
207-
else
208-
yum versionlock kernel-abi-stablelists
209-
fi
210-
211177
if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
212178
yum versionlock rocky-release rocky-repos
213179
elif [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rhel9" ]] ; then
@@ -252,42 +218,6 @@ phases:
252218
maxAttempts: 2
253219
inputs:
254220
delaySeconds: 10
255-
- name: InstallAdditionalKernelPackages
256-
action: ExecuteBash
257-
inputs:
258-
commands:
259-
- |
260-
set -v
261-
OS='{{ build.OperatingSystemName.outputs.stdout }}'
262-
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
263-
DISABLE_KERNEL_UPDATE='{{ build.DisableKernelUpdate.outputs.stdout }}'
264-
265-
if [[ ${!PLATFORM} == RHEL ]]; then
266-
# Install kernel-devel during OS update, so that headers are aligned with new kernel.
267-
# The same is done for Debian through `apt-get -y install linux-aws`
268-
if [[ ${!OS} == "rocky8" ]] ; then
269-
PACKAGE="kernel-devel-$(uname -r)"
270-
RELEASE_VERSION=$(source /etc/os-release && echo ${!VERSION_ID})
271-
272-
# try to install kernel source for a specific release version
273-
yum install -y ${!PACKAGE} --releasever ${!RELEASE_VERSION}
274-
if [ $? -ne 0 ]; then
275-
yum install -y wget
276-
# Previous releases are moved into a vault area once a new minor release version is available for at least a week.
277-
# https://wiki.rockylinux.org/rocky/repo/#notes-on-devel
278-
wget https://dl.rockylinux.org/vault/rocky/${!RELEASE_VERSION}/BaseOS/$(uname -m)/os/Packages/k/${!PACKAGE}.rpm
279-
yum install -y ./${!PACKAGE}.rpm
280-
fi
281-
else
282-
yum -y install kernel-headers-$(uname -r)
283-
yum -y install kernel-devel-$(uname -r)
284-
fi
285-
286-
elif [[ ${!PLATFORM} == DEBIAN ]]; then
287-
if [[ ${!DISABLE_KERNEL_UPDATE} != true ]]; then
288-
apt-get -y install linux-aws linux-headers-aws linux-image-aws
289-
fi
290-
fi
291221

292222
- name: RemoveKernelPin
293223
action: ExecuteBash
@@ -303,12 +233,6 @@ phases:
303233
if [[ ${!DISABLE_KERNEL_UPDATE} == true ]] && [[ ${!PLATFORM} == RHEL ]]; then
304234
yum versionlock delete kernel kernel-core kernel-modules
305235
306-
if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then
307-
yum versionlock delete kernel-abi-whitelists
308-
else
309-
yum versionlock delete kernel-abi-stablelists
310-
fi
311-
312236
if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
313237
yum versionlock delete rocky-release
314238
elif [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rhel9" ]] ; then

0 commit comments

Comments
 (0)