[Merge] ~schopin/ubuntu-release-upgrader:nvidia-quirk into ubuntu-release-upgrader:ubuntu/jammy
Julian Andres Klode
mp+427718 at code.launchpad.net
Tue Aug 2 13:56:58 UTC 2022
Review: Needs Fixing
Diff comments:
> diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
> index c6be753..f60e3c0 100644
> --- a/DistUpgrade/DistUpgradeQuirks.py
> +++ b/DistUpgrade/DistUpgradeQuirks.py
> @@ -1437,3 +1438,42 @@ class DistUpgradeQuirks(object):
> "%s: %s; %s",
> netplan_config_filename, exc, failure_action)
> return
> +
> + def _fix_missing_nvidia_metapackage(self):
> + # LP: #1955047
> + # Desktop installs for 20.04.3 on systems with nvidia graphics don't have the
> + # driver metapackage installed
> + logging.debug("running Quirks._test_and_fix_missing_nvidia_metapackage")
> + try:
> + from NvidiaDetector.nvidiadetector import NvidiaDetection
> + except (ImportError) as e:
> + logging.error("NvidiaDetection can not be imported %s" % e)
> + return
> + nv = NvidiaDetection()
> + versions = nv.drivers.keys()
> + cache = self.controller.cache
> + # Early exit if there's a driver metapackage installed
> + for version in versions:
> + desktop = 'nvidia-driver-{}'.format(version)
Odd name, maybe call it driver?
> + if desktop in cache and cache[desktop].is_installed:
> + logging.debug("package {} detected, exit.".format(desktop))
> + return;
> + version_to_fix = None
> + # If we find an autoremovable libnvidia-gl package, this probably means the user
> + # hit LP: #1955047
> + for version in versions:
> + nvidia_gl = 'libnvidia-gl-{}'.format(version)
> + if nvidia_gl in cache and cache[nvidia_gl].is_installed and cache[nvidia_gl].is_auto_removable:
> + version_to_fix = version
> + logging.debug("Found autoremovable package {}, assuming we're missing nvidia-driver-{}".format(nvidia_gl, version))
> + break
> + if version_to_fix is None:
> + logging.debug("No autoremovable libnvidia-gl found, exiting.")
> + return
> + missing_metapackage = "nvidia-driver-{}".format(version_to_fix)
> + if missing_metapackage not in cache:
> + logging.error("Package {} not available in the APT cache!".format(missing_metapackage))
> + return
> + logging.debug("Installing missing nvidia driver metapackage {}".format(missing_metapackage))
> + cache[missing_metapackage].mark_install()
> + cache.commit(None, None)
This invalidates cache, but it's not getting reloaded. They probably only should be marked for install and then will be installed as part of the upgrade.
--
https://code.launchpad.net/~schopin/ubuntu-release-upgrader/+git/ubuntu-release-upgrader/+merge/427718
Your team Ubuntu Core Development Team is subscribed to branch ubuntu-release-upgrader:ubuntu/jammy.
More information about the Ubuntu-reviews
mailing list