Skip to content

Commit 471933c

Browse files
committed
fix: explicitly reinstall cloud-init and openssh-server before autoremove
cloud-init was being removed during Ansible package cleanup despite autoremove being disabled. Rather than debug further, explicitly reinstall both critical packages before apt-mark and autoremove.
1 parent 7ad787d commit 471933c

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

scripts/90-cleanup-qemu.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ elif [ -n "$(command -v apt-get)" ]; then
4747
# Protect critical runtime packages from autoremove
4848
apt-mark manual libevent-2.1-7t64
4949

50+
# Ensure cloud-init and openssh-server are installed
51+
# They may have been removed as dependencies during package cleanup
52+
apt-get -y install --no-install-recommends cloud-init openssh-server
53+
5054
# Protect SSH and cloud-init dependencies from autoremove
5155
# Without these, the image won't be accessible via SSH after boot
5256
apt-mark manual openssh-server cloud-init python3-systemd python3-jinja2 \

scripts/90-cleanup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ elif [ -n "$(command -v apt-get)" ]; then
4545
apt-get -y update
4646
apt-get -y upgrade
4747

48+
# Ensure cloud-init and openssh-server are installed
49+
# They may have been removed as dependencies during package cleanup
50+
apt-get -y install --no-install-recommends cloud-init openssh-server
51+
4852
# Protect SSH and cloud-init dependencies from autoremove
4953
# Without these, the AMI won't be accessible via SSH after boot
5054
apt-mark manual openssh-server cloud-init python3-systemd python3-jinja2 \

0 commit comments

Comments
 (0)