GoogleCloudDataproc / initialization-actions

Run in all nodes of your cluster before the cluster starts - lets you customize your cluster
https://cloud.google.com/dataproc/init-actions
Apache License 2.0
588 stars 512 forks source link

[gpu] Rocky kernel-devel is sometimes moved to the vault #1206

Closed cjac closed 3 months ago

cjac commented 3 months ago

When new kernels are released, the old kernel-devel (which we depend on to build kernel drivers with) is removed from the repository from which we can install. We need to add a work-around to fetch from the vault instead.

cjac commented 3 months ago
-    execute_with_retries "dnf -y -q install pciutils kernel-devel gcc"
+    execute_with_retries "dnf -y -q install pciutils gcc"
+
+    local dnf_cmd="dnf -y -q install kernel-devel-${uname_r}"
+    local kernel_devel_pkg_out="$(eval "${dnf_cmd} 2>&1")"
+    if [[ "${kernel_devel_pkg_out}" =~ 'Unable to find a match: kernel-devel-' ]] ; then
+      # this kernel-devel may have been migrated to the vault
+      local vault="https://download.rockylinux.org/vault/rocky/$(os_version)/"
+      execute_with_retries dnf -y -q --setopt=localpkg_gpgcheck=1 install \
+        "${vault}/BaseOS/x86_64/os/Packages/k/kernel-${uname_r}.rpm" \
+        "${vault}/BaseOS/x86_64/os/Packages/k/kernel-core-${uname_r}.rpm" \
+        "${vault}/BaseOS/x86_64/os/Packages/k/kernel-modules-${uname_r}.rpm" \
+        "${vault}/BaseOS/x86_64/os/Packages/k/kernel-modules-core-${uname_r}.rpm" \
+        "${vault}/AppStream/x86_64/os/Packages/k/kernel-devel-${uname_r}.rpm"
+    else
+      execute_with_retries "${dnf_cmd}"
+    fi
cjac commented 3 months ago

Thanks go to skip77 from #rockylinux on libera for the work-around here and to tmz for the note to validate packages with --setopt=localpkg_gpgcheck=1 in case we end up fetching from a mirror.

cjac commented 3 months ago

see PR #1207 for review

cjac commented 3 months ago

Fixed with #1207