12

Does anybody know if there is a way to disable or skip the phased updates on Ubuntu 22.04 so the package installation candidate is updated to the latest version of the package immediately?

I have tried the suggestions to disable here - https://discourse.ubuntu.com/t/phased-updates-in-apt-in-21-04/20345

However, the candidate version of the required packages always remains at the older version when I check with the command apt-cache policy.

Holly Sherlock
  • 161
  • 1
  • 8
  • 2
    For the layman; What is Phased Updates possibly? => https://wiki.ubuntu.com/PhasedUpdates – Hannu Sep 22 '22 at 17:05
  • @Hannu the link you have posted describes them. But basically, the main thing to know is that when a phased update is rolled out, not all machines get the update at once. You can tell if a package is being phased if you run the command apt-cache policy . If you see something like this in the output: 3.10.6-1~22.04 1 (phased 10%) – Holly Sherlock Sep 22 '22 at 19:20
  • 1
  • 1
    @ArturMeinild one of the answers sort of does, but it doesn't really explain what actually happens when you disable phased updates. For example I wasn't sure if I would get the update straight away or if disabling meant I would have to wait until it was 100% phased. The accepted answer below helped me to resolve my problem – Holly Sherlock Sep 23 '22 at 12:41
  • Ok, I somewhat thought that was part of the other thread. But the answer to that is, that if you disable phased updates, you'll get the packages immediately, instead of them being phased in. – Artur Meinild Sep 23 '22 at 12:43
  • 1
    @ArturMeinild thank you, another thing I found really baffling when this first became a problem was that it actually affects packages that you haven't installed yet. So I wasn't trying to upgrade like most of these threads are I was trying to install new packages. – Holly Sherlock Sep 23 '22 at 12:51

1 Answers1

17

Phased Updates are one layer of protection for your system. Folks who disable this layer of protection should have the skills, experience, and willingness to troubleshoot problems and file bugs. You're volunteering to be a tester.

Only folks who know what they are doing should do this.

If you really want to bypass phasing, then insert the correct apt option into the command:

apt -o APT::Get::Always-Include-Phased-Updates=true upgrade

or

apt -o APT::Get::Always-Include-Phased-Updates=true install <package_name>
  • Before using this option, it's wise to run apt-cache policy <packagename> to verify that the package you in question is really phasing. It's not a magic incantation to solve every apt-related problem.

But what if you have a whole lab of machines? And each is phasing at a different time, and it's a big mess?

The answer is NOT to disable phasing. Instead, have all your machines phase together by setting a common Machine-ID string.

Here's an example apt config file to set a Machine-ID string for apt. Let's call it /etc/apt/apt.conf.d/20phased-updates. This apt-specific string, whatever you choose, should be identical for all machines that you want to phase together. Each machine in your lab gets this file.

// To have all your machines phase the same, set the same string in this field
// If commented out, apt will use /etc/machine-id to seed the random number generator
APT::Machine-ID "aaaabbbbccccddddeeeeffff";

Alternately, if you really want the latest and greatest for autoinstalls, AND subsequently to phase together....

// To have all your machines phase the same, set the same string in this field
// If commented out, apt will use /etc/machine-id to seed the random number generator
APT::Machine-ID "aaaabbbbccccddddeeeeffff";

// Always include phased updates // After your initial build, you would comment this out. // If left in place you will always include phased updates instead of phasing all machines together. APT::Get::Always-Include-Phased-Updates "1";

user535733
  • 62,253
  • I don't think that this question should be considered to be a duplicate of any other question because the question's title is clearly searchable which adds value to Ask Ubuntu. – karel Sep 22 '22 at 15:18
  • 2
    @karel isn't that the point of duplicates? – Esther Sep 22 '22 at 15:22
  • Thank you very much for this answer, I have been able to resolve my issue on 1 machine with the manual apt command suggested. The problem is that I am trying to build many machines for a classroom, and when the basic packages are installed during the initial autoinstall stage it always seems to get the very latest versions. But when I later and try and install further packages that depend on these basic pre-installed packages with Ansible, they haven't received the updates yet. So it fails with dependency errors. I don't suppose if anybody knows of a way to make it behave this way by default? – Holly Sherlock Sep 22 '22 at 15:31
  • Thanks again @user535733 I understand what you are saying, it's not that I particularly don't want to wait for the updates, it's that it is causing my build process to fail. It would be fine to wait if the autoinstall stage wasn't installing the latest versions and causing this mismatch of candidate versions for various packages that depend on each other. I think I will look into the autoinstall options to see if there's anything I can do there instead. – Holly Sherlock Sep 22 '22 at 16:05
  • 2
    @HollySherlock edited to address the question of how to get an entire lab full of machines to phase together AND to build. – user535733 Sep 22 '22 at 16:05
  • Amazing thank you @user535733 – Holly Sherlock Sep 22 '22 at 16:13
  • This is great information. – Organic Marble Sep 22 '22 at 16:33
  • 2
    I feel like this makes turning phased updates off sound a lot more risky than it is, especially given that in older versions of Ubuntu, they were basically always off. – Joseph Sible-Reinstate Monica Sep 23 '22 at 04:40
  • @JosephSible-ReinstateMonica the intent is not to overstate risk; the intent is to keep new and unskilled users on the tested, safest, and supported path. Experienced users like you understand that it's possible to disable layer after layer of built-in protections until you break your system. You're not the target audience of this answer. – user535733 Sep 23 '22 at 11:49