I am running Ubuntu 22.04 and I am trying to update gcc-12 and all its related dependencies (currently version 12.1.0-7) to the latest version available in jammy-security (12.1.0-2ubuntu1~22.04) but my system insists that gcc-12 is already at the newest version.

To my understanding and according to the man pages for apt_preferences, it states,

In a typical situation, the installed version of a package (priority 100) is not as recent as one of the versions available from the sources listed in the sources.list(5) file (priority 500 or 990). Then the package will be upgraded when apt-get install some-package or apt-get upgrade is executed.

However, despite jammy-security having a higher pin-priority than the current version installed gcc-12 refuses to upgrade.

I know I can force the update by specifying the version and target repo with

sudo apt-get install gcc-12=12.1.0-2ubuntu1~22.04 -t jammy-security

but then I would have to do that for all of gcc-12's dependencies and then the respective dependencies' dependencies. Anyone know a fix without having to resort to individually upgrading each package?

Here are a couple of my terminal outputs:

sudo apt-get install

sudo apt-get install gcc-12
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gcc-12 is already the newest version (12.1.0-7).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

apt-cache policy gcc-12

  Installed: 12.1.0-7
  Candidate: 12.1.0-7
  Version table:
 *** 12.1.0-7 100
        100 /var/lib/dpkg/status
     12.1.0-2ubuntu1~22.04 500
        500 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages
     12-20220319-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages


deb http://archive.ubuntu.com/ubuntu jammy main universe restricted
deb http://security.ubuntu.com/ubuntu/ jammy-security main universe restricted
deb http://archive.ubuntu.com/ubuntu jammy-updates main universe restricted

1 Answer 1


Your gcc-12 package really is newer than the version available from jammy-security, as far as apt can determine: 12.1.0-7 is a higher version than 12.1.0-2ubuntu1~22.04.

To downgrade your packages, you need to pin them to a priority greater than 1000. See Debian batch downgrade packages to whatever currently downloadable for one possible approach.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .