Comment 6 for bug 2059337

Revision history for this message
Chad Smith (chad.smith) wrote (last edit ):

:) Thanks again David for the context on your immediate workarounds you would pursue here in the meantime while needrestart folks determine best course of action for Ubuntu.

While I think one solution could be appending all critical or oneshot services of the world into upstream's ex/needrestart.conf, just like my linked Merge request suggested for ubuntu downstream, it's probably better to pursue individual packages delivering their own supplemental /etc/needrstart/conf.d/<pkg>.conf as you alluded to.

I had a hard time understanding how to use /etc/needrestart/conf.d but happened upon https://github.com/liske/needrestart/issues/184#issuecomment-650402676 which explained pushing another element onto the default config's $nrconfi{nblacklist_interp} array.

It was a small step further for cloud-init to deliver a file to /etc/needrestart/config/cloud-init.conf with the content:

# Add a needrestart skip for cloud-final.service across APT upgrade operations.
# This avoids SIGTERMs disrupting cloud-init before it is able to install
# packages and/or setup PPAs. LP: #2059337
$nrconf{override_rc}->{qr(^cloud-final\.service$)} = 0;

Just tested and that this ensures cloud-final.service will be skipped instead of autorestarted anytime it happens to be running as needrestart is invoked. Then we can allow Ubuntu's needrestart definitions of default behavior get sorted separately than the cloud-init specific issue. And cloud-init doesn't necessarily have to await either a downstream ubuntu fix for needrestart auto-restarting or upstream's default ex/needrestart.conf changes.