As it turns out, python3-jinja2 is installed. This is output after the upgrade to cloud-init
root@IP-INSTANCE-REDACT:~# systemctl status cloud-init ● cloud-init.service - Initial cloud-init job (metadata service crawler) Loaded: loaded (/lib/systemd/system/cloud-init.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2024-05-21 15:41:26 EDT; 5s ago Process: 523670 ExecStart=/usr/bin/cloud-init init (code=exited, status=1/FAILURE) Main PID: 523670 (code=exited, status=1/FAILURE) May 21 15:41:26 IP-INSTANCE-REDACT cloud-init[523670]: File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 34, in <module> May 21 15:41:26 IP-INSTANCE-REDACT cloud-init[523670]: from cloudinit.handlers.jinja_template import JinjaTemplatePartHandler May 21 15:41:26 IP-INSTANCE-REDACT cloud-init[523670]: File "/usr/lib/python3/dist-packages/cloudinit/handlers/jinja_template.py", line 14, in <module> May 21 15:41:26 IP-INSTANCE-REDACT cloud-init[523670]: from cloudinit.templater import ( May 21 15:41:26 IP-INSTANCE-REDACT cloud-init[523670]: File "/usr/lib/python3/dist-packages/cloudinit/templater.py", line 21, in <module> May 21 15:41:26 IP-INSTANCE-REDACT cloud-init[523670]: from jinja2 import TemplateSyntaxError May 21 15:41:26 IP-INSTANCE-REDACT cloud-init[523670]: ModuleNotFoundError: No module named 'jinja2' May 21 15:41:26 IP-INSTANCE-REDACT systemd[1]: cloud-init.service: Main process exited, code=exited, status=1/FAILURE May 21 15:41:26 IP-INSTANCE-REDACT systemd[1]: cloud-init.service: Failed with result 'exit-code'. May 21 15:41:26 IP-INSTANCE-REDACT systemd[1]: Failed to start Initial cloud-init job (metadata service crawler). root@IP-INSTANCE-REDACT:~# apt install python3-jinja2 Reading package lists... Done Building dependency tree Reading state information... Done python3-jinja2 is already the newest version (2.10.1-2ubuntu0.2). 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. root@IP-INSTANCE-REDACT:~# dpkg --list | grep cloud-init ii cloud-init 24.1.3-0ubuntu1~20.04.1 all initialization and customization tool for cloud instances ii cloud-initramfs-copymods 0.45ubuntu2 all copy initramfs modules into root filesystem for later use ii cloud-initramfs-dyn-netconf 0.45ubuntu2 all write a network interface file in /run for BOOTIF By way of comparison, I upgrade cloud-init on a machine *without* python3.9 and that restarted successfully: root@IP-INSTANCE-REDACT:~# dpkg --list | grep cloud-init ii cloud-init 23.3.3-0ubuntu0~20.04.1 all initialization and customization tool for cloud instances ii cloud-initramfs-copymods 0.45ubuntu2 all copy initramfs modules into root filesystem for later use ii cloud-initramfs-dyn-netconf 0.45ubuntu2 all write a network interface file in /run for BOOTIF root@IP-INSTANCE-REDACT:~# install ^C You have new mail in /var/mail/root root@IP-INSTANCE-REDACT:~# apt install cloud-init Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-aws-5.15-headers-5.15.0-1053 linux-aws-5.15-headers-5.15.0-1055 linux-aws-5.15-headers-5.15.0-1056 linux-headers-5.15.0-1053-aws linux-headers-5.15.0-1055-aws linux-headers-5.15.0-1056-aws linux-image-5.15.0-1053-aws linux-image-5.15.0-1055-aws linux-image-5.15.0-1056-aws linux-modules-5.15.0-1053-aws linux-modules-5.15.0-1055-aws linux-modules-5.15.0-1056-aws Use 'apt autoremove' to remove them. The following packages will be upgraded: cloud-init 1 upgraded, 0 newly installed, 0 to remove and 16 not upgraded. Need to get 563 kB of archives. After this operation, 118 kB of additional disk space will be used. Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 cloud-init all 24.1.3-0ubuntu1~20.04.1 [563 kB] Fetched 563 kB in 0s (25.1 MB/s) Preconfiguring packages ... (Reading database ... 261166 files and directories currently installed.) Preparing to unpack .../cloud-init_24.1.3-0ubuntu1~20.04.1_all.deb ... Unpacking cloud-init (24.1.3-0ubuntu1~20.04.1) over (23.3.3-0ubuntu0~20.04.1) ... Setting up cloud-init (24.1.3-0ubuntu1~20.04.1) ... Installing new version of config file /etc/cloud/cloud.cfg ... Installing new version of config file /etc/cloud/cloud.cfg.d/05_logging.cfg ... Installing new version of config file /etc/cloud/templates/chrony.conf.cos.tmpl ... Installing new version of config file /etc/cloud/templates/chrony.conf.debian.tmpl ... Installing new version of config file /etc/cloud/templates/chrony.conf.ubuntu.tmpl ... Installing new version of config file /etc/cloud/templates/hosts.alpine.tmpl ... Installing new version of config file /etc/cloud/templates/hosts.mariner.tmpl ... Installing new version of config file /etc/cloud/templates/ntp.conf.ubuntu.tmpl ... Installing new version of config file /etc/profile.d/Z99-cloud-locale-test.sh ... Installing new version of config file /etc/profile.d/Z99-cloudinit-warnings.sh ... Removing obsolete conffile /etc/cloud/clean.d/README ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for rsyslog (8.2001.0-1ubuntu1.3) ... root@IP-INSTANCE-REDACT:~# systemctl restart cloud-init root@IP-INSTANCE-REDACT:~# systemctl status cloud-init ● cloud-init.service - Initial cloud-init job (metadata service crawler) Loaded: loaded (/lib/systemd/system/cloud-init.service; enabled; vendor preset: enabled) Active: active (exited) since Tue 2024-05-21 15:39:39 EDT; 5s ago Process: 844642 ExecStart=/usr/bin/cloud-init init (code=exited, status=0/SUCCESS) Main PID: 844642 (code=exited, status=0/SUCCESS) May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: +-------+-------------+-------------+-----------------+-----------+-------+ May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++ May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: +-------+-------------+---------+-----------+-------+ May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: | Route | Destination | Gateway | Interface | Flags | May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: +-------+-------------+---------+-----------+-------+ May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: | 1 | fe80::/64 | :: | ens5 | U | May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: | 3 | local | :: | ens5 | U | May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: | 4 | multicast | :: | ens5 | U | May 21 15:39:39 IP-INSTANCE-REDACT cloud-init[844646]: ci-info: +-------+-------------+---------+-----------+-------+ May 21 15:39:39 IP-INSTANCE-REDACT systemd[1]: Finished Initial cloud-init job (metadata service crawler). root@IP-INSTANCE-REDACT:~# dpkg --list | grep cloud-init ii cloud-init 24.1.3-0ubuntu1~20.04.1 all initialization and customization tool for cloud instances ii cloud-initramfs-copymods 0.45ubuntu2 all copy initramfs modules into root filesystem for later use ii cloud-initramfs-dyn-netconf 0.45ubuntu2 all write a network interface file in /run for BOOTIF You have new mail in /var/mail/root root@IP-INSTANCE-REDACT:~# dpkg --list | grep python3-jinja2 ii python3-jinja2 2.10.1-2ubuntu0.2 all small but fast and easy to use stand-alone template engine -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2066066 Title: cloud-init startup failure with Python 3.9.5, Ubuntu Focal To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2066066/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs