Skip to content

Commit

Permalink
Use a 5.10 kernel version that supports live patching
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-vogt-dod committed Nov 22, 2022
1 parent a28ea16 commit 169e332
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions amazon-eks-al2.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ build {
script = "scripts/update.sh"
}

provisioner "shell" {
execute_command = "echo 'packer' | {{ .Vars }} sudo -S -E bash -eux '{{ .Path }}'"
expect_disconnect = true
pause_after = "15s"
script = "scripts/kernel.sh"
}

provisioner "shell" {
execute_command = "echo 'packer' | {{ .Vars }} sudo -S -E bash -eux '{{ .Path }}'"
environment_vars = [
Expand Down
25 changes: 25 additions & 0 deletions scripts/kernel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -o pipefail
set -o nounset
set -o errexit

echo "linux kernel info"
uname -r
rpm -qa | grep kernel
amazon-linux-extras | grep kernel

case $(uname -r) in
5.10.*)
echo "already using a 5.10 kernel version"
;;
*)
echo "use linux kernel 5.10"
amazon-linux-extras disable kernel-5.4
amazon-linux-extras install kernel-5.10 -y
rpm -qa | grep kernel

echo "rebooting the instance"
reboot
;;
esac

0 comments on commit 169e332

Please sign in to comment.