[Merge] ~schopin/ubuntu-release-upgrader:nvidia-quirk into ubuntu-release-upgrader:ubuntu/jammy
Nick Rosbrook
mp+427718 at code.launchpad.net
Tue Aug 2 18:46:10 UTC 2022
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)
> + 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
Would the most likely cause of such a situation be that a user disabled restricted, after previously having it enabled to install nvidia packages? If so, would it be sufficient to display a prompt suggesting that they re-enable restricted, and then restart the upgrade? The prompt could be a y/N so that the user can "continue anyways" despite the warning.
If you are thinking of another situation that would cause 'nvidia-driver-$num' to be missing from the cache, please elaborate.
> + logging.debug("Installing missing nvidia driver metapackage {}".format(missing_metapackage))
> + cache[missing_metapackage].mark_install()
> + cache.commit(None, None)
--
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