Forcing Installation of Held-Back Packages in Ubuntu/Debian

During regular software updates in Ubuntu Linux distros, you may encounter a situation where some packages have been kept back and are not updated. This could lead to disparities in the version of packages across different systems.

In this tutorial you will learn:

  • Allowing automatic system upgrade
  • Forcing a specific package upgrade
  • Disabling the Phased Updates
Forcing Installation of Held-Back Packages in Ubuntu/Debian
Forcing Installation of Held-Back Packages in Ubuntu/Debian
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian/Ubuntu Linux
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

This article will delve into the management of kept back packages in Ubuntu. It will provide a step-by-step guide on how to force these packages to be automatically installed. We will ficticions be using a package named ‘vol1.2-linuxconfig-1.0’ as an example for the purpose of this article.

Understanding the Scenario:

Normally, during software upgrade or dist-upgrade, messages indicating that some packages have been kept back may appear. These are packages that are not upgraded due to dependency issues or because they have been set not to upgrade manually.

In our example, we have two Ubuntu systems: a main system and a secondary virtual system. Both systems should ideally have the same ‘vol1.2-linuxconfig-1.0’ package versions. However, while in the main system this package has been kept back, in the secondary system, the same package has been installed automatically.

The Symptoms:

To investigate this divergence, we run the following command on the main system:

$ sudo apt --installed list | grep vol1.2-linuxconfig-1.0

The output shows that the ‘vol1.2-linuxconfig-1.0’ package is installed but upgradable. However, the same command on the secondary system shows that the package is installed automatically.

To better understand the differences, we use the command:

$ apt-cache policy vol1.2-linuxconfig-1.0

By looking at the “version table” part of the output, we identify the Phased Updates feature. If present, it will show a (phased x%) field, x being the percentage of the updates that are phased.

How Does Phased Updates Work?

The phased updates mechanism distributes new package versions to a random subset of users. This feature is designed to avoid situation where a newly introduced bug affects all users simultaneously.

Solutions:

  1. Allowing automatic system upgrade: As a safety feature, Phased Updates will eventually install the kept back packages automatically after a period, usually a week or so, as it is a phased rollout.
    $ sudo apt install unattended-upgrades
    $ sudo dpkg-reconfigure unattended-upgrades
  2. Forcing a specific package upgrade: If you want to manually override the kept back status for a package, you can use the –only-upgrade option. This way, the specific package will be forced to upgrade:
    bash
    sudo apt install --only-upgrade vol1.2-linuxconfig-1.0
  3. Disabling the Phased Updates: If you want to disable this feature completely and install all the upgrades immediately, you can do so by altering the APT configuration file with the following command:
    cat <<EOF > /etc/apt/apt.conf.d/80PhasedUpdates
    APT::Get::Never-Include-Phased-Updates: True;
    Update-Manager::Never-Include-Phased-Updates;
    EOF

Conclusion

Learnings from the above scenarios point out that Kept-back packages can be managed in various ways. A cautious user can opt for the phased update system by allowing the automatic system upgrade. A more risk-taking user might decide to force the specific package upgrade or to disable the Phased Updates feature altogether.

However, it’s advisable for beginner users to let the system handle these updates automatically to prevent potential system breaks from manual forced upgrades. Disabling the Phased Updates permanently is not typically recommended as it bypasses safety measures intended to prevent widespread impact of newly introduced bugs.



Comments and Discussions
Linux Forum