File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments