[Bug 2059337] Re: noble: needrestart triggering SIGTERM of cloud-final.service preventing apt packages from being installed when cloud-init is also being upgraded
Launchpad Bug Tracker
2059337 at bugs.launchpad.net
Sun Apr 7 07:08:59 UTC 2024
This bug was fixed in the package needrestart - 3.6-7ubuntu4
---------------
needrestart (3.6-7ubuntu4) noble; urgency=medium
* d/p/ubuntu-avoid-restart-cloud-final.patch:
- avoid automatic restart of cloud-init systemd oneshot services when
cloud-init invokes apt-get dist-upgrade due to user-data (LP: #2059337)
-- Chad Smith <chad.smith at canonical.com> Wed, 27 Mar 2024 16:51:58
-0600
** Changed in: needrestart (Ubuntu Noble)
Status: Confirmed => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to needrestart in 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
Status in cloud-init package in Ubuntu:
Confirmed
Status in needrestart package in Ubuntu:
Fix Released
Status in cloud-init source package in Noble:
Confirmed
Status in needrestart source package in Noble:
Fix Released
Bug description:
Recent downstream ubuntu-specific changes in needrestart version
3.6-7ubuntu1 [1] set Ubuntu into autorestart mode when 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: https://code.launchpad.net/~chad.smith/ubuntu/+source/needrestart/+git/needrestart/+merge/463236
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2059337/+subscriptions
More information about the foundations-bugs
mailing list