UnboundLocalError Python error when running `ubuntu-drivers autoinstall`

Bug #2053296 reported by Pierre Equoy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-drivers-common (Ubuntu)
New
Undecided
Unassigned

Bug Description

As part of the Certification regression testing process, we automatically provision devices in our Certification lab with different versions of Ubuntu to make sure no regressions are introduced during the SRU process.

Recently, we got an issue when trying to provision Ubuntu 22.04 on a device with a Nvidia GPU. The Nvidia drivers should be installed with the ubuntu-drivers autoinstall command, however when run, the following exception is thrown:

ubuntu@10.102.163.75 sudo ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.1/0000:01:00.0 ==
modalias : pci:v000010DEd00002571sv0000103Csd00001611bc03sc00i00
vendor : NVIDIA Corporation
driver : nvidia-driver-525-open - distro non-free
driver : nvidia-driver-470-server - distro non-free
driver : nvidia-driver-535-server-open - distro non-free
driver : nvidia-driver-535 - distro non-free
driver : nvidia-driver-545-open - distro non-free recommended
driver : nvidia-driver-535-server - distro non-free
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-535-open - distro non-free
driver : nvidia-driver-525-server - distro non-free
driver : nvidia-driver-545 - distro non-free
driver : nvidia-driver-525 - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin

== /sys/devices/pci0000:00/0000:00:1f.4 ==
modalias : pci:v00008086d00007AA3sv0000103Csd0000895Ebc0Csc05i00
vendor : Intel Corporation
driver : oem-stella-asobo-meta - distro free

+ _run sudo ubuntu-drivers autoinstall
+ ssh -t -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@10.102.163.75 sudo ubuntu-drivers autoinstall
Traceback (most recent call last):
  File "/usr/bin/ubuntu-drivers", line 513, in <module>
    greet()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/bin/ubuntu-drivers", line 432, in autoinstall
    command_install(config)
  File "/usr/bin/ubuntu-drivers", line 187, in command_install
    UbuntuDrivers.detect.nvidia_desktop_pre_installation_hook(to_install)
  File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 839, in nvidia_desktop_pre_installation_hook
    with_nvidia_kms = version >= 470
UnboundLocalError: local variable 'version' referenced before assignment

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: ubuntu-drivers-common 1:0.9.6.2~0.22.04.6
ProcVersionSignature: Ubuntu 5.15.0-100.110-generic 5.15.143
Uname: Linux 5.15.0-100-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckResult: unknown
CloudArchitecture: x86_64
CloudID: maas
CloudName: maas
CloudPlatform: maas
CloudSubPlatform: seed-dir (http://10.102.160.2:5248/MAAS/metadata/)
Date: Thu Feb 15 21:53:15 2024
InstallationDate: Installed on 2022-05-10 (646 days ago)
InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - Release amd64 (20220419)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
RebootRequiredPkgs: Error: path contained symlinks.
SourcePackage: ubuntu-drivers-common
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Pierre Equoy (pieq) wrote :
Revision history for this message
Pierre Equoy (pieq) wrote :

This looks very similar to lp:1995158, but I wanted to complete the `ubuntu-bug` process in order to capture the logs for that machine.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.