I have been hunting for an answer to this for a long time, and although I've seen proposed solutions, none of them works.
I can see all packages ready for update with this command:
apt list --upgradable
Some of them are held back due to phased updates. I want to know which ones will be upgraded, and which ones held back.
All that I have so far is to issue this command (once for each package):
apt-cache policy [packagename]
If the output contains the string (phased …%)
(one, two or three digits before the percentage sign), it means that the package is part of the phased updates. But it doesn't tell whether or not it will be installed on my machine right now.
How do I tell which of the pending packages would be installed right now, and which ones would be held back due to phased updates?
I'm running Ubuntu 22.04, in case that makes a difference.
Thank you
Here's one way:
The list of phasing packages is, of course, the difference between the lists.
I also cobbled together some commands. I am mostly parsing
apt
output usingawk
but it would be great if somebody else knows more native commands.If you want to find all the packages going through phased updates and their associated phase percentage.
However, based on the question you probably only care about installed packages that are going through phased updates.
You can also find the packages that will be held back. In this case, during a
full-upgrade
.But then you want to "tell which of the pending packages would be installed right now, and which ones would be held back due to phased updates". Putting it all together.
Here is sample output on a patched 22.04 server (piping into
column
).The results match the
full-upgrade
outputnotes
2.4.8
.apt-cache policy
to determine whether a package was held back or not. That no longer appears reliable. I found an apt configuration optionAPT::Get::Phase-Policy=True
that helps, but the results are not consistent with actual apt behavior. This was the output I generated when parsing the output ofapt-cache policy
, but it does not match what apt would do.The output of
apt upgrade
will tell you exactly which packages are going to be upgraded and which packages will be kept back.You may also use
apt -s upgrade
to run a simulation which will give you the same desired information.