Skip to content

Commit cbd74ea

Browse files
committed
fix: symlink
1 parent deb9107 commit cbd74ea

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/90-cleanup.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ elif [ -n "$(command -v apt-get)" ]; then
5050
apt-get -y install --no-install-recommends cloud-init openssh-server
5151

5252
# Ensure cloud-init and SSH services are enabled (may not be re-enabled on reinstall)
53-
systemctl enable cloud-init-local.service cloud-init.service cloud-config.service cloud-final.service ssh.service || true
53+
# systemctl enable can fail silently in chroot - create symlinks manually
54+
mkdir -p /etc/systemd/system/cloud-init.target.wants
55+
mkdir -p /etc/systemd/system/multi-user.target.wants
56+
ln -sf /usr/lib/systemd/system/cloud-init-local.service /etc/systemd/system/cloud-init.target.wants/ || true
57+
ln -sf /usr/lib/systemd/system/cloud-init.service /etc/systemd/system/cloud-init.target.wants/ || true
58+
ln -sf /usr/lib/systemd/system/cloud-config.service /etc/systemd/system/cloud-init.target.wants/ || true
59+
ln -sf /usr/lib/systemd/system/cloud-final.service /etc/systemd/system/cloud-init.target.wants/ || true
60+
ln -sf /usr/lib/systemd/system/cloud-init.target /etc/systemd/system/multi-user.target.wants/ || true
61+
ln -sf /usr/lib/systemd/system/ssh.service /etc/systemd/system/multi-user.target.wants/ || true
62+
echo "Created cloud-init and SSH service symlinks"
5463

5564
# Protect SSH and cloud-init dependencies from autoremove
5665
# Without these, the AMI won't be accessible via SSH after boot

0 commit comments

Comments
 (0)