[Bug 2059337] Re: noble: needrestart triggering SIGTERM of cloud-final.service preventing apt packages from being installed when cloud-init is also being upgraded

Chad Smith 2059337 at bugs.launchpad.net
Wed Mar 27 22:59:20 UTC 2024


Thanks @demyers for context here too. I've just proposed the following
for cloud-final.service that seems to work on my side when testing in
lxd

https://code.launchpad.net/~chad.smith/ubuntu/+source/needrestart/+git/needrestart/+merge/463236

** Description changed:

  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:
+ 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. 
+ 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.
- 
+ 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:
+ [3] downstream packaging proposal: https://code.launchpad.net/~chad.smith/ubuntu/+source/needrestart/+git/needrestart/+merge/463236

** Also affects: cloud-init (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: cloud-init (Ubuntu)
       Status: New => Confirmed

** Also affects: cloud-init (Ubuntu Noble)
   Importance: Undecided
       Status: Confirmed

** Also affects: needrestart (Ubuntu Noble)
   Importance: Undecided
       Status: Confirmed

-- 
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:
  Confirmed
Status in cloud-init source package in Noble:
  Confirmed
Status in needrestart source package in Noble:
  Confirmed

Bug description:
  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: 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