UnboundLocalError: local variable 'version' referenced before assignment
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-drivers-common (Ubuntu) |
Fix Released
|
High
|
Alberto Milone | ||
Bionic |
Triaged
|
High
|
Alberto Milone | ||
Focal |
Triaged
|
High
|
Alberto Milone | ||
Jammy |
Fix Committed
|
High
|
Alberto Milone | ||
Kinetic |
Fix Released
|
High
|
Alberto Milone |
Bug Description
[ Impact ]
* The introduction of the -open NVIDIA drivers requires a change in the way we detect driver series and flavours. Failing to do so, causes the ubuntu-drivers tool to crash (LP: #1993019), or to prefer the -open drivers over the non-open ones (LP: #1988836).
* Furthermore, calling the ubuntu-drivers tool where the alsa-utils package is not installed (mainly on servers), ubuntu-drivers (through the sl-modem plugin) complains, unnecessarily about the missing aplay binary.
[ Test Plan ]
* Install the new ubuntu-
* Run the ubuntu-drivers list command, and make sure that the 515 driver series (or higher) is listed.
* Try installing the driver using the following command:
sudo ubuntu-drivers install
* Check which driver series was installed (you can use the "sudo ubuntu-drivers debug" command), and make sure that the installation does not cause ubuntu-drivers to crash.
[ Where problems could occur ]
* A problem in the ubuntu-drivers tool can cause it to install a driver which
is not recommended for the detected hardware, or even cause the package
installation to fail, and prevent users from logging in through the
graphics interface.
[ Other Info ]
* To prevent failures of the test-suite on architectures such as armhf (as seen
in Lunar), we are skipping the tests for any architectures other than amd64
and arm64 (which are the only ones actually using ubuntu-drivers).
This was already the case with riscv, and we now have an easier way
to do so in the debian/rules file.
== Changelogs ==
=== Kinetic and Jammy ===
[ Alberto Milone ]
* New upstream release:
* UbuntuDrivers/
- Make sure all -open drivers have a lower priority, regardless
of whether the --server parameter is passed in or not.
- Update regex in nvidia_
ubuntu-
drivers (LP: #1993019).
* tests/test_
- Add tests so we make sure to keep preferring non-open NVIDIA
modules over the -open ones, at least until the open modules catch up
feature wise and performance wise.
[ gongzhengyang ]
* UbuntuDrivers/
- Fix local variable 'version' being referenced before assignment
when catching ValueError (LP: #1993019).
[ Jeff Lane ]
* detect-
- Add some error trapping when aplay is not installed (on servers).
=== Jammy only (left over from 1:0.9.6.
* UbuntuDrivers/
- Make sure -open drivers have a lower priority (LP: #1988836).
== Changelogs ==
=== Kinetic and Jammy ===
[ Alberto Milone ]
* debian/rules:
- Limit the tests to the selected architectures (amd64, arm64).
This prevents armhf builds from failing.
* UbuntuDrivers/
- Make sure all -open drivers have a lower priority, regardless
of whether the --server parameter is passed in or not.
- Update regex and unify package name parsing in the following
functions by using the new NvidiaPkgNameInfo class:
nvidia_
_
nvidia_
get_
This prevents ubuntu-drivers from crashing when dealing with
the -open NVIDIA drivers (LP: #1993019).
* tests/test_
- Add tests so we make sure to keep preferring non-open NVIDIA
modules over the -open ones, at least until the open modules catch up
feature wise and performance wise.
[ gongzhengyang ]
* UbuntuDrivers/
- Fix local variable 'version' being referenced before assignment
when catching ValueError (LP: #1993019).
[ Jeff Lane ]
* detect-
- Add some error trapping when aplay is not installed (on servers).
=== Jammy only (left over from 1:0.9.6.
* UbuntuDrivers/
- Make sure -open drivers have a lower priority (LP: #1988836).
____
Hello, we received a drive-by complaint about the ubuntu-drivers autoinstall tool:
< Fhazal> hye i have problem with ubuntu 22.04 nvidia auto install command
< Fhazal> this error appear when i try to auto install recommended driver
< Fhazal> https:/
The contents of the pastebin:
Traceback (most recent call last):
File "/usr/bin/
greet()
File "/usr/lib/
return self.main(*args, **kwargs)
File "/usr/lib/
rv = self.invoke(ctx)
File "/usr/lib/
return _process_
File "/usr/lib/
return ctx.invoke(
File "/usr/lib/
return __callback(*args, **kwargs)
File "/usr/lib/
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/lib/
return __callback(*args, **kwargs)
File "/usr/bin/
command_
File "/usr/bin/
UbuntuDrive
File "/usr/lib/
with_nvidia_kms = version >= 470
UnboundLocalError: local variable 'version' referenced before assignment
Skimming the version on my system it sure feels plausible:
def nvidia_
'''Applies changes that need to happen before installing the NVIDIA drivers'''
with_nvidia_kms = False
# Enable KMS if nvidia >= 470
for package_name in to_install:
if package_
try:
except ValueError:
if with_nvidia_kms:
If there was an exception splitting, indexing, or converting to an int, that 'version' variable may not have a value.
Thanks
tags: | added: rls-jj-incoming |
Changed in ubuntu-drivers-common (Ubuntu): | |
assignee: | nobody → Alberto Milone (albertomilone) |
importance: | Undecided → High |
Changed in ubuntu-drivers-common (Ubuntu): | |
status: | Confirmed → Fix Released |
Changed in ubuntu-drivers-common (Ubuntu Kinetic): | |
status: | New → In Progress |
Changed in ubuntu-drivers-common (Ubuntu Jammy): | |
status: | New → In Progress |
Changed in ubuntu-drivers-common (Ubuntu Focal): | |
status: | New → In Progress |
Changed in ubuntu-drivers-common (Ubuntu Bionic): | |
status: | New → In Progress |
assignee: | nobody → Alberto Milone (albertomilone) |
Changed in ubuntu-drivers-common (Ubuntu Focal): | |
assignee: | nobody → Alberto Milone (albertomilone) |
Changed in ubuntu-drivers-common (Ubuntu Jammy): | |
assignee: | nobody → Alberto Milone (albertomilone) |
Changed in ubuntu-drivers-common (Ubuntu Kinetic): | |
assignee: | nobody → Alberto Milone (albertomilone) |
Changed in ubuntu-drivers-common (Ubuntu Bionic): | |
importance: | Undecided → High |
Changed in ubuntu-drivers-common (Ubuntu Focal): | |
importance: | Undecided → High |
Changed in ubuntu-drivers-common (Ubuntu Jammy): | |
importance: | Undecided → High |
Changed in ubuntu-drivers-common (Ubuntu Kinetic): | |
importance: | Undecided → High |
description: | updated |
description: | updated |
description: | updated |
Changed in ubuntu-drivers-common (Ubuntu Bionic): | |
status: | In Progress → Triaged |
Changed in ubuntu-drivers-common (Ubuntu Focal): | |
status: | In Progress → Triaged |
I saw the same issue. I performed fresh Ubuntu 22.04.1 install on Dell Precision 7540. First attempt I immediately installed proprietary drivers by enabling this third party option in install dialog. After this Software & Updates do not allow update. All options are greyed out and cannot be enabled. There is a message "This device is using a manually-installed driver"
Second attempt I installed without proprietary drivers / with third party disabled. After installation and reboot Software & Updates does allow me to select a proprietary driver. There is no longer a message "This device is using a manually-installed driver"