[Bug 2128606] Re: Correctly copy Architecture-Variant field

Julian Andres Klode 2128606 at bugs.launchpad.net
Thu Oct 23 08:55:43 UTC 2025


It tried storing the status file from the upgraded containers:

$ lxc exec cute-fowl cat /var/lib/dpkg/status > a     # old dpkg
$ lxc exec unbiased-cub cat /var/lib/dpkg/status > b  # new dpkg

Diffing the two status files revealed no changes:
$ diff a b
diff --git a b
index 68e24a6..509f9b7 100644
--- a
+++ b
@@ -2056,11 +2056,11 @@ Essential: yes
 Status: install ok installed
 Priority: required
 Section: admin
-Installed-Size: 6457
+Installed-Size: 6393
 Maintainer: Ubuntu Developers <ubuntu-devel-discuss at lists.ubuntu.com>
 Architecture: amd64
 Multi-Arch: foreign
-Version: 1.22.21ubuntu3
+Version: 1.22.21ubuntu3.1
 Depends: tar (>= 1.28-1)
 Pre-Depends: libbz2-1.0, libc6 (>= 2.38), liblzma5 (>= 5.4.0), libmd0 (>= 0.0.0), libselinux1 (>= 3.1~), libzstd1 (>= 1.5.5), zlib1g (>= 1:1.1.4)
 Suggests: apt, debsig-verify
@@ -10663,6 +10663,39 @@ Description: Linux kernel headers for version 6.14.0
  This is for sites that want the latest kernel headers.  Please read
  /usr/share/doc/linux-headers-6.14.0-33/debian.README.gz for details.


And a couple more linux-*-6.14.0-34 packages were installed as I dist-upgraded unbiased-cup first, but that has no impact on dpkg.


Diffoscoping two tarballs of /var/lib/dpkg revealed no other pertinent changes just a couple of time stamp changed (and expected differences between the dpkg hashes).

Overall, we have now succesfully verified the test plan:

#5 verifies the behavior with a single test deb; migrating to and back from v3
#6 verifies the behavior of a release upgrade to questing working and producing no variants
#7 further verifies that the release upgrade hasn't otherwise changed in unexpected ways

** Tags removed: verification-needed verification-needed-questing
** Tags added: verification-done verification-done-questing

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dpkg in Ubuntu.
https://bugs.launchpad.net/bugs/2128606

Title:
  Correctly copy Architecture-Variant field

Status in dpkg package in Ubuntu:
  Fix Released
Status in dpkg source package in Questing:
  Fix Committed
Status in dpkg source package in Resolute:
  Fix Released

Bug description:
  [Impact]
  amd64v3 packages are differentiated from amd64 packages by

  Architecture-Variant: amd64v3

  When APT sees amd64v3 packages, it considers them an upgrade to amd64
  packages, so when amd64v3 is enabled, a dist-upgrade first upgrades
  you to amd64v3.

  Inadvertently, dpkg did not copy the field when installing the
  package, causing apt to consider the installed amd64v3 package as
  amd64 again, and the next dist-upgrade trying to "upgrade" them again.

  [Test plan]
  Check that the field appears in dpkg --status when installing an amd64v3 package
  Check that the field disappears in dpkg --status when installing an amd64 package.

  If no amd64v3 packages are involved the field always remains NULL (no
  Architecture-Variant is written to the status file); so no visible
  change is seen on any system in the real world now; as amd64v3 is opt-
  in and not yet announced.

  Do a release-upgrade in a lxd container with the new dpkg available
  and installed during the upgrade; vs a lxd container without the new
  dpkg, and ensure there are no regressions.

  [Where problems could occur]
  The field could be garbage if not initialized (covered by "install an amd64 package"). The default value of the field is NULL; this is not a concern:

  The field is used here:

  src/deb/build.c
  487:                 pkg->available.arch_variant ? pkg->available.arch_variant : pkg->available.arch->name, DEBEXT);

  ^ this is unaffected by the change as available always contains the
  field if availabe

  lib/dpkg/parse.c
  66:  { FIELD("Architecture-Variant"),      f_charfield,       w_charfield,      PKGIFPOFF(arch_variant)   },

  - w_charfield will now write that field if set (it checks if the field
  value is null and skips it, which always happened so far)

  src/main/unpack.c
  908:  pkg->installed.arch_variant = pkg->available.arch_variant;

  ^ here we copy the available value to the installed database, this is
  the new line. It's a no-op everywhere that doesn't have amd64v3
  packages about to be installed (copying default NULL to NULL, nothing
  else set the field of course).

  lib/dpkg/dpkg-db.h
  124:  const char *arch_variant;

  ^ declaration of the field inside the struct

  The only thing that reads the field outside of dpkg is apt when it
  sees if the installed version is the same as an available version:
  There it checks if they have matching variants. A variant is always
  preferred over an architecture.

  If no variants where ever configured or force-installed, variants do
  not appear anywhere on the system.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/2128606/+subscriptions




More information about the foundations-bugs mailing list