Public bug reported: Recent downstream ubuntu-specific changes in needrestart version 3.6-7ubuntu1 [1] set Ubuntu into autorestart mode during non-interactive apt-get dist-upgrade is being performed.
This causes an acute issue for cloud-init when #cloud-config user-data tries to perform apt-get dist-upgrade and package installs via user-data[2] like the following: #cloud-config package_update: true package_upgrade: true packages: [sl] Since cloud-init runs apt-get dist-upgrade in cloud-final.service in non-interactive mode, Ubuntu's behavior looks to set the default "opt_r" mode to "a" (automatic). This causes problems when cloud-init package is also being upgraded by dist-upgrade as needrestart will collect the currently running cloud-final.service and determine it is a target for automtic restart. The immediate SIGTERM of cloud-final.service prevents cloud-init from completing any of the remaining config modules in the cloud-final boot stage, notably, the additional package installs requested by the `packages:` directive in user data. Given that cloud-final.service is a oneshot service, that can spawn apt-get dist-upgrade. I'd propose that minimally Ubuntu initially carries a downstream patch to skip automated restart of cloud-final.service[3]. I don't see an easier way to inject other skip regex into /etc/needrestart/needrestart.conf via /etc/needrestart/conf.d/cloud-init.conf that would allow us to augment the list of skip regexs on a per-package basis. References: [1] Ubuntu needrestart setting automatic restart mode when non-interactive on Ubuntu https://git.launchpad.net/ubuntu/+source/needrestart/tree/debian/patches/ubuntu-mode.patch?id=0ee54f20335d49ba3c330e5f8328e88a8cc3f99b#n72 [2] Upstream cloud-init bug: cloud-final.service getting sigterm before installing packages https://github.com/canonical/cloud-init/issues/5109 [3] downstream packaging proposal: ** Affects: needrestart (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2059337 Title: noble: needrestart triggering SIGTERM of cloud-final.service preventing apt packages from being installed when cloud-init is also being upgraded To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/needrestart/+bug/2059337/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
