[Bug 2004203] [NEW] With needrestart, apt-get does not respect non-interactive instruction when upgrading services

Launchpad Bug Tracker 2004203 at bugs.launchpad.net
Thu Sep 5 13:53:21 UTC 2024


You have been subscribed to a public bug by Simon Chopin (schopin):

For many years, I have had a script that checks for and installs
available updates on Debian and Ubuntu servers.

Code:

#!/bin/bash
apt-get update
apt-get dist-upgrade -y
[then clear cache, refresh snaps, restart if needed etc]

With the Ubuntu 22.04 servers, it happily 'apt-get update's and then
does the upgrade without pausing to ask if I want to do it :) but it
then checks to see if any services need restarting and if any might do,
asks if I want to restart them and won't continue until I answer. :( :(
:(

Typically some are preselected (if apache has been updated, then apache
will be preselected, for example) and some are unselected (unattended-
upgrades is the classic example). Sometimes, all are unselected meaning
it doesn't think any do need restarting, but it will still stay waiting
for my OK not to do so.

More info is given than before:

[do actual update]
Scanning processes...                                                           
Scanning candidates...                                                          
Scanning linux images...                                                        

Running kernel seems to be up-to-date.

[wait for interaction here or after next line]
Restarting services...
Service restarts being deferred:
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
[all done!]                                         

So some significant stuff has changed, but if I do

man apt-get

there is no indication that the behaviour has been changed like this:
the bit about the -y command line option still says "run non-
interactively", yet there it is waiting for interaction. There is also
no indication of any new command line option to really be non-
interactive.

It is lovely that it is now explicitly checking things like this, but if
I ask for a non-interactive upgrade, I should get a non-interactive
upgrade!

I have not come across an instance where the suggestion about which
services need restarting has been wrong, so I am happy to accept the
recommendation and just restart/not restart as suggested.

# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

** Affects: needrestart (Ubuntu)
     Importance: Undecided
         Status: Fix Released

** Affects: ubuntu-advantage-tools (Ubuntu)
     Importance: Undecided
         Status: Invalid

** Affects: needrestart (Ubuntu Jammy)
     Importance: Undecided
         Status: Confirmed

-- 
With needrestart, apt-get does not respect non-interactive instruction when upgrading services
https://bugs.launchpad.net/bugs/2004203
You received this bug notification because you are a member of Ubuntu Sponsors, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list