With needrestart, apt-get does not respect non-interactive instruction when upgrading services
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
needrestart (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned | ||
ubuntu-advantage-tools (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
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-
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-
systemctl restart unattended-
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
(Labelled as an issue with ubuntu- advantage- tools although it is apt-get doing this, because a) I can't report issues with apt-get here and b) the 22.04 desktop edition I was using didn't do this and the obvious difference is that the servers are signed up to the UA programme and the desktop wasn't so I am looking sternly at that as being the underlying cause.)