Skip to content

Commit

Permalink
Install kernel-devel for Rocky Linux from vault
Browse files Browse the repository at this point in the history
kernel-devel should be aligned to the installed version.
If there is kernel 8.8 we should have kernel-devel 8.8.

Without this patch we were installing latest kernel-devel package.
We cannot use `--releasever` to install 8.8 version because it is not more available in the repo.
Previous releases are moved into a vault area once a new minor release version is available for at least a week.

On RHEL8 instead all versions of the packages will remain available.

With this patch we're downloading this specific package from vault and installing it
if it's not available in the repository for the specific release version.

Signed-off-by: Enrico Usai <[email protected]>
  • Loading branch information
enrico-usai committed Dec 12, 2023
1 parent ca63ebb commit 81993ab
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cli/src/pcluster/resources/imagebuilder/update_and_reboot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ phases:
apt-get --purge autoremove -y
fi
- name: InstallUpdatedHeaders
- name: InstallAdditionalKernelPackages
action: ExecuteBash
inputs:
commands:
Expand All @@ -275,7 +275,21 @@ phases:
if [[ ${!PLATFORM} == RHEL ]]; then
# Install kernel-devel during OS update, so that headers are aligned with new kernel.
# The same is done for Debian through `apt-get -y install linux-aws`
yum -y install kernel-devel
if [[ ${!OS} == "rocky8" ]]; then
PACKAGE="kernel-devel-$(uname -r)"
RELEASE_VERSION=$(source /etc/os-release && echo ${!VERSION_ID})
# try to install kernel source for a specific release version
yum install -y ${!PACKAGE} --releasever ${!RELEASE_VERSION}
if [ $? -ne 0 ]; then
# Previous releases are moved into a vault area once a new minor release version is available for at least a week.
# https://wiki.rockylinux.org/rocky/repo/#notes-on-devel
wget https://dl.rockylinux.org/vault/rocky/${!RELEASE_VERSION}/BaseOS/$(uname -m)/os/Packages/k/${!PACKAGE}.rpm
yum install -y ./${!PACKAGE}.rpm
fi
else
yum -y install kernel-devel
fi
elif [[ ${!PLATFORM} == DEBIAN ]]; then
if [[ ${!DISABLE_KERNEL_UPDATE} != true ]]; then
Expand Down

0 comments on commit 81993ab

Please sign in to comment.