Public bug reported:

[Impact]

`ubuntu-drivers-common` supports a custom GPU configuration file,
`custom_supported_gpus.json`, which OEM images use to pin a specific NVIDIA
driver series for a given PCI device ID. Three defects make that mechanism
unusable in practice:

1. The pinned driver series is ignored when selecting a driver.**
   `system_driver_packages()` always flagged the highest-sorted NVIDIA
   alternative as `recommended`, so `ubuntu-drivers list`, `ubuntu-drivers
   install` and `ubuntu-drivers autoinstall` installed the newest driver in
   the archive instead of the series the OEM configuration pinned. On systems
   where the pinned series is the only validated/working driver for the GPU,
   users end up with a driver that was deliberately not selected for that
   platform (black screen, no acceleration, or regressions in suspend/resume).

2. The configuration file is only looked up in `/etc`.**
   OEM enablement packages ship the file in `/usr/share/oem-*-meta/`, so the
   file shipped by the OEM meta package was never read at all. Only a manual
   `/etc/custom_supported_gpus.json` had any effect.

3. runtimepm detection fails for `-open` branches.
   `_is_nv_allowing_runtimepm_supported()` compared the candidate driver
   version against `gpu["branch"].split(".")[0]` with an exact match. A branch
   recorded as `580-open` (variant suffix) never matched the `580` series, so
   runtime power management was not enabled on hardware that supports it,
   costing battery life on affected laptops. In addition the loop returned
   `False` on the first non-matching chip entry, so a later matching entry was
   never considered.

A related packaging-preference bug is fixed at the same time: for gpgpu
installs, an explicit flavour request without a variant suffix (e.g.
`ubuntu-drivers install --gpgpu nvidia:595`) only matched the closed
metapackage and ignored the `Prefer-Variant: Open` preference, so the `-open`
metapackage was not installed even when the packaging asked for it.

[Test Plan]

The upstream commits add automated coverage; run the existing test
suite:

    python3 -m pytest tests/test_ubuntu_drivers.py

New/updated tests exercise the custom-config pinning, the
`list --recommended` variant collapsing (`test_list_recommended_chroot`) and
the runtimepm branch matching.

Manual verification on a machine (or VM) with an NVIDIA GPU, or with the
package's fake-sysfs test chroot:

1. Install the version from -proposed.
2. Create `/etc/custom_supported_gpus.json` pinning a driver series that is
   *not* the newest one available for the installed GPU, e.g.:

       {
         "chips": [
           {
             "devid": "0x<DEVID>",
             "branch": "535",
             "features": ["runtimepm"]
           }
         ]
       }

3. `ubuntu-drivers list`
   * Expected: all applicable drivers are still listed, and
     `nvidia-driver-535` is the one flagged as recommended.
4. `ubuntu-drivers list --recommended`
   * Expected: exactly one nvidia driver is listed (`nvidia-driver-535`), plus
     every other non-nvidia suggested package.
5. `ubuntu-drivers install --dry-run` (or `autoinstall`)
   * Expected: `nvidia-driver-535` is selected, not the newest series.
6. `ubuntu-drivers install nvidia:<other-series>`
   * Expected: the explicitly requested series is installed, i.e. the custom
     pin does not override an explicit request.
7. Move the file to `/usr/share/oem-test-meta/custom_supported_gpus.json`,
   remove the one in `/etc`, and repeat steps 3-5.
   * Expected: identical results, proving the OEM lookup path works.
   * Before the fix, steps 3-7 all select the newest driver series.
8. With a `-open` branch entry (e.g. `"branch": "580-open"`) and the matching
   `580` series driver installed, check that the runtimepm udev rule /
   `/proc/driver/nvidia/.../power` settings are applied.
   * Before the fix, runtimepm was not enabled for such entries.

[Where problems could occur]

* The change alters which NVIDIA driver is reported as *recommended* and
  therefore which one `ubuntu-drivers install`/`autoinstall` picks, but only
  on systems that actually ship or define `custom_supported_gpus.json`. A
  malformed or stale file could now pin an unsuitable or unavailable driver
  series where previously it was ignored; in that case the pinned package
  simply is not found in the archive and the previous selection logic applies.
* The new `/usr/share/oem-*-meta/` lookup means files shipped by OEM meta
  packages take effect for the first time. On OEM images carrying an outdated
  file, the recommended driver may change compared to the previous release.
  `/etc/custom_supported_gpus.json` can be used to override it.
* `ubuntu-drivers list --recommended` output is intentionally shorter for
  NVIDIA (one package instead of the whole alternatives group). Scripts or
  installers parsing that output and expecting multiple nvidia entries would
  see a different result; `ubuntu-drivers list` (without `--recommended`) is
  unchanged. The removal of the stray `break` also means the plain listing can
  now show more lines than before, where previously entries were silently
  dropped.
* The relaxed runtimepm series matching could enable runtime power management
  on a few additional GPU/driver combinations that were previously (and
  incorrectly) skipped. The matching is still anchored on the numeric series,
  so it does not introduce substring false-positives.
* The `gpgpu` `-open` substitution changes which metapackage is installed for
  explicit flavour requests on drivers marked `Prefer-Variant: Open`. If the
  `-open` metapackage were uninstallable, the install would fail where it
  previously succeeded with the closed variant.
* Regressions would be confined to the `ubuntu-drivers` CLI and the DBus
  detection service; they would not affect already-installed drivers, and the
  package can be downgraded without side effects.

[Other Info]

** Affects: oem-priority
     Importance: Undecided
         Status: New

** Affects: ubuntu-drivers-common (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: jira-rusi-70 oem-priority

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

Title:
  [SRU] honour custom_supported_gpus.json for nvidia driver installation

To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/2168955/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to