Skip to content

Commit 9dba5e5

Browse files
feat(templates): add AL2023 2025-12-08's image
This commit adds a simple template for the Amazon Linux 2023 operating system's 2025-12-08 version. The OS is scheduled to release every two weeks, therefore, a new script called hack/update-template-amazonlinux-2023.sh is added next to the other template updater scripts. Find the latest images here: cdn.amazonlinux.com/al2023/os-images/latest/ This patch: - Adds amazonlinux-2023 template with 2025-12-08 release by default (fallback). - Resolves mount issues on AL2023 with host OS. - Introduces a script on VM init where it updates the system to latest release. - Adds update-template-amazonlinux-2023.sh script to help maintainers automatically update the verison. Signed-off-by: Gyokhan Kochmarla <[email protected]>
1 parent b18eed7 commit 9dba5e5

File tree

2 files changed

+110
-0
lines changed

2 files changed

+110
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SETUP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
TEMPLATE_FILE="${SETUP_DIR}/../templates/experimental/amazonlinux-2023.yaml"
7+
8+
# Get the latest release version from the CDN redirect
9+
distribution_release_al2023=$(basename "$(curl -Ls -o /dev/null -w %{url_effective} https://cdn.amazonlinux.com/al2023/os-images/latest/)")
10+
11+
echo "Latest Release: ${distribution_release_al2023}"
12+
13+
# Function to get URL and Digest
14+
function get_image_details() {
15+
local arch="$1"
16+
local folder="$2" # kvm or kvm-arm64
17+
local base_url="https://cdn.amazonlinux.com/al2023/os-images/${distribution_release_al2023}/${folder}"
18+
19+
local checksums
20+
checksums=$(curl -Ls "${base_url}/SHA256SUMS")
21+
22+
local filename
23+
filename=$(echo "${checksums}" | awk '{print $2}')
24+
local digest
25+
digest=$(echo "${checksums}" | awk '{print $1}')
26+
27+
echo "${base_url}/${filename} ${digest}"
28+
}
29+
30+
# Get x86_64 details
31+
read -r url_amd64 digest_amd64 <<< "$(get_image_details "x86_64" "kvm")"
32+
echo "x86_64: ${url_amd64} ${digest_amd64}"
33+
34+
# Get aarch64 details
35+
read -r url_arm64 digest_arm64 <<< "$(get_image_details "aarch64" "kvm-arm64")"
36+
echo "aarch64: ${url_arm64} ${digest_arm64}"
37+
38+
sed -i.bak \
39+
-e "s|location: \".*kvm/.*\"|location: \"${url_amd64}\"|" \
40+
-e "/arch: \"x86_64\"/{n;s|digest: \".*\"|digest: \"sha256:${digest_amd64}\"|;}" \
41+
-e "s|location: \".*kvm-arm64/.*\"|location: \"${url_arm64}\"|" \
42+
-e "/arch: \"aarch64\"/{n;s|digest: \".*\"|digest: \"sha256:${digest_arm64}\"|;}" \
43+
"${TEMPLATE_FILE}"
44+
45+
# Update message
46+
sed -i.bak \
47+
-e "s|Amazon Linux 2023 (.*)|Amazon Linux 2023 (${distribution_release_al2023})|" \
48+
"${TEMPLATE_FILE}"
49+
50+
rm "${TEMPLATE_FILE}.bak"
51+
52+
echo "Updated ${TEMPLATE_FILE}"
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
minimumLimaVersion: 2.0.0
2+
3+
4+
5+
images:
6+
- location: "https://cdn.amazonlinux.com/al2023/os-images/2023.9.20251208.0/kvm/al2023-kvm-2023.9.20251208.0-kernel-6.1-x86_64.xfs.gpt.qcow2"
7+
arch: "x86_64"
8+
digest: "sha256:c91f244483d9a460869738f7fcfb5e37eb402aec8582d10456cf0c108e1a4d4c"
9+
- location: "https://cdn.amazonlinux.com/al2023/os-images/2023.9.20251208.0/kvm-arm64/al2023-kvm-2023.9.20251208.0-kernel-6.1-arm64.xfs.gpt.qcow2"
10+
arch: "aarch64"
11+
digest: "sha256:7aef1f189076a0416cd16062bbf7e0928d81061e68411cab8904447e1bd5eafd"
12+
13+
14+
# Do not install containerd by default.
15+
containerd:
16+
system: false
17+
user: false
18+
19+
provision:
20+
- mode: system
21+
script: |
22+
#!/bin/bash
23+
set -eux -o pipefail
24+
25+
# Amazon Linux 2023 missing mount.virtiofs and has tag issues
26+
if [ ! -e /sbin/mount.virtiofs ]; then
27+
echo '#!/bin/sh' > /sbin/mount.virtiofs
28+
echo 'exec mount -i -t virtiofs "$@"' >> /sbin/mount.virtiofs
29+
chmod +x /sbin/mount.virtiofs
30+
fi
31+
32+
# Lima seemingly uses 'mount0' tag on this setup but Guest Agent expects path.
33+
MOUNT_POINT="/mnt/host"
34+
35+
if ! mountpoint -q "${MOUNT_POINT}"; then
36+
mkdir -p "${MOUNT_POINT}"
37+
mount -t virtiofs mount0 "${MOUNT_POINT}" || true
38+
fi
39+
- mode: system
40+
script: |
41+
#!/bin/bash
42+
set -eux -o pipefail
43+
# Update to the latest release on the first boot
44+
if [ ! -f /etc/lima-al2023-updated ]; then
45+
dnf upgrade -y --releasever=latest
46+
fi
47+
48+
mounts:
49+
- location: "~"
50+
mountPoint: "/mnt/host"
51+
52+
message: |
53+
####################################################
54+
Amazon Linux 2023 (2023.9.20251208.0)
55+
56+
To update the latest Amazon Linux 2023 release, run:
57+
$ sudo dnf upgrade --releasever=latest
58+
####################################################

0 commit comments

Comments
 (0)