diff --git a/cookbooks/aws-parallelcluster-platform/resources/install_packages/install_packages_rocky8.rb b/cookbooks/aws-parallelcluster-platform/resources/install_packages/install_packages_rocky8.rb index 2b8b98931..9868f5179 100644 --- a/cookbooks/aws-parallelcluster-platform/resources/install_packages/install_packages_rocky8.rb +++ b/cookbooks/aws-parallelcluster-platform/resources/install_packages/install_packages_rocky8.rb @@ -20,11 +20,22 @@ use 'partial/_install_packages_rhel_amazon.rb' action :install_kernel_source do + # 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 bash "Install kernel source" do user 'root' code <<-INSTALL_KERNEL_SOURCE set -e - dnf install -y #{kernel_source_package}-#{kernel_source_package_version} --releasever #{node['platform_version']} + package="#{kernel_source_package}-#{kernel_source_package_version}" + + # try to install kernel source for a specific release version + dnf install -y ${package} --releasever #{node['platform_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/#{node['platform_version']}/BaseOS/$(uname -m)/os/Packages/k/${package}.rpm + dnf install -y ./${package}.rpm + fi dnf clean all INSTALL_KERNEL_SOURCE end unless on_docker?