1. Overview

Ubuntu is one of the most popular Linux distributions, with millions of users around the world. It’s known for its user-friendly interface, rich software repository, and frequent updates. However, updating a large and complex system like Ubuntu isn’t without risks.

Sometimes, updates may introduce bugs, break dependencies, or cause compatibility issues with hardware or software. To minimize these risks and ensure a smooth and stable user experience, Ubuntu employs a strategy called phased updates.

In this tutorial, we’ll look at phased updates in Ubuntu and how we can configure them.

2. What Are Phased Updates?

Phased updates are a way of gradually rolling out updates to a subset of user systems instead of releasing them to everyone at once. This enables the Ubuntu developers to monitor the feedback and performances of the updates and fix any issues that may arise before making them available to the rest of the users.

Moreover, phased updates provide its users more control over when and how they receive updates and reduce the load on the Ubuntu servers.

Effectively, one batch of users gets the initial updates. After a round of monitoring and feedback, the update may be modified or improved. Later, another batch of users gets the update, triggering a new round of feedback. This continues until a full rollout.

3. How Do Phased Updates Work?

Phased updates work by assigning a phased update percentage (PUP) to each update package. The PUP is a number between 0 and 100, which indicates the percentage of users who should receive the update. For example, if a package has a PUP of 50, it means that 50% of the users will get the update, and the other 50% won’t.

However, the PUP is determined by Ubuntu developers based on the severity, urgency, and impact of the update. Critical security updates usually have a PUP of 100, while the less important or risky updates may have a lower PUP.

Additionally, the PUP resides in the Release file of the Ubuntu repository, along with other metadata about the update. The Release file is signed by the Ubuntu developers to ensure its authenticity and integrity.

When we run apt update, the system reaches out to the repository:

$ apt update

After that, apt downloads the Release file and verifies its signature. Then, it compares the PUP of each package with a random number between 0 and 100 generated by the system. If the random number is less than or equal to the PUP, the system downloads and installs the update. Otherwise, it will skip the update and wait for the next cycle.

4. How to Configure Phased Updates?

By default, phased updates are enabled in Ubuntu, and the system checks for updates every day.

However, we can change the phased update settings to our preferences. To do so, we edit the APT configuration file named 20auto-upgrades located under /etc/apt/apt.conf.d.

This file contains two parameters:

  • APT::Periodic::Update-Package-Lists: how often the system checks for updates, in days
  • APT::Periodic::Unattended-Upgrade: whether the system automatically installs the updates or prompts the user for confirmation

Let’s see how we can access and edit the file:

$ cd /etc/apt/apt.conf.d
$ cat 20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

In the code snippet above, we use the first command to change the current working directory to the file location and the cat command to display what’s inside the file.

Moreover, one the first line, APT::Periodic::Update-Package-Lists “1”; means that the system checks for updates every day. In the second line, APT::Periodic::Unattended-Upgrade “1”; makes the system install updates automatically, without asking for user confirmation.

Additionally, we can also change the parameters to any positive integer with the same effect, or assign 0 to disable either.

For example, if we want to check for updates every week and install them automatically, we edit the 20auto-upgrades file accordingly:

APT::Periodic::Update-Package-Lists "7";
APT::Periodic::Unattended-Upgrade "1";

Now, we changed the settings to check for updates every week and install them automatically. If we want it to prompt for our confirmation before installing the updates, we set the APT::Periodic::Unattended-Upgrade parameter to 0. We can now choose to accept or decline the updates or defer them to a later time. This setting provides more control over the updates but also requires more attention and interaction from us.

Furthermore, if we want to disable phased updates altogether, we set the APT::Periodic::Update-Package-Lists parameter to 0.

5. Benefits and Drawbacks of Phased Updates

Phased updates have several benefits for both the Ubuntu developers and the users:

  • reduce the risk of widespread problems caused by faulty updates by limiting their exposure and enabling quick fixes
  • improve the quality and reliability of updates by collecting feedback and data from users who receive them
  • more flexibility and choice over when and how user update their systems and avoid forcing unwanted or unnecessary changes on them
  • optimize the use of the Ubuntu servers by distributing the load and avoiding congestion

However, phased updates also have some drawbacks:

  • may delay the delivery of important or desired updates to some users, who may miss out on new features or bug fixes
  • may create inconsistency and fragmentation among Ubuntu users, who may have different versions of the same package or software
  • may increase the complexity and difficulty of troubleshooting and support, as different users may have different problems or solutions

In summary, phased updates are a smart and effective way of updating a Ubuntu system, which aims to balance trade-offs between stability and innovation. They offer many advantages for developers and users but also pose challenges and limitations.

6. Conclusion

In this tutorial, we looked at what phased updates are in Ubuntu, how they work, and how we can configure them. We also looked at some benefits and drawbacks of phased updates.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.