Skip to content

Commit b127205

Browse files
committed
systemvmtemplate: install a newer cloud-init on Debian 13
cloud-init 25.1.x of Debian 13 fails in the CloudStack datasource when it finds no lease of dhcpcd. It asks the DHCP client for the newest lease to read the domain name and does not handle the missing lease, so the init stage of the CKS nodes and the shared filesystem VMs fails and the user data is not applied, even when the metadata server is found. This is fixed in cloud-init 26.x, see canonical/cloud-init#6554 Install cloud-init 26.2 from the Debian archive if the installed version is older.
1 parent 4d1618e commit b127205

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,25 @@ function debconf_packages() {
3535
echo "libc6 libraries/restart-without-asking boolean false" | debconf-set-selections
3636
}
3737

38+
# cloud-init 25.1.x of Debian 13 fails in the CloudStack datasource when there is no DHCP lease
39+
# (https://github.com/canonical/cloud-init/pull/6554), so the user data of the CKS nodes and the
40+
# shared filesystem VMs is not applied. Install a newer one if the installed one is older.
41+
CLOUD_INIT_VERSION="26.2-1"
42+
CLOUD_INIT_SHA256="17fc7a7f428dbea1195543259955a75f170870473990a43375de99009bd60462"
43+
44+
function upgrade_cloud_init() {
45+
local installed=$(dpkg-query -W -f='${Version}' cloud-init 2>/dev/null || true)
46+
if [[ -n "${installed}" ]] && dpkg --compare-versions "${installed}" ge "${CLOUD_INIT_VERSION}"; then
47+
return
48+
fi
49+
50+
local deb="/tmp/cloud-init_${CLOUD_INIT_VERSION}_all.deb"
51+
wget https://deb.debian.org/debian/pool/main/c/cloud-init/cloud-init_${CLOUD_INIT_VERSION}_all.deb -O ${deb}
52+
echo "${CLOUD_INIT_SHA256} ${deb}" | sha256sum -c -
53+
apt-get --no-install-recommends -q -y install ${deb}
54+
rm -f ${deb}
55+
}
56+
3857
function apt_clean() {
3958
apt-get -y autoremove --purge
4059
apt-get clean
@@ -81,6 +100,7 @@ function install_packages() {
81100
conntrack apt-transport-https ca-certificates curl gnupg gnupg-agent
82101

83102
apt-get install -y python3-json-pointer python3-jsonschema cloud-init
103+
upgrade_cloud_init
84104

85105
apt_clean
86106

0 commit comments

Comments
 (0)