Public bug reported:

SYSTEM INFORMATION:
user@host# lsb_release -rd
Description:    Ubuntu 22.04.1 LTS
Release:        22.04


PACKAGE VERSION INFORMATION:
user@host# apt-cache policy ubuntu-drivers-common
ubuntu-drivers-common:
  Installed: 1:0.9.6.1
  Candidate: 1:0.9.6.1
  Version table:
 *** 1:0.9.6.1 500
        500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

EXPECTED RESULT:
Any updated/missing drivers are upgraded/installed

ACTUAL RESULT:
when using the command 'nvidia-drivers install' after a fresh installation, the 
following error is produced from Python3:
==================================================================================================
user@hostname:~$ sudo ubuntu-drivers install
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 413, in install
    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

==================================================================================================
FIX FOR THIS BUG/WORK AROUND:
This is fixed by adding the following code on line 830:
    version = 0

<CODE SNIPPET>
def nvidia_desktop_pre_installation_hook(to_install):
    '''Applies changes that need to happen before installing the NVIDIA 
drivers'''
    with_nvidia_kms = False
    version = 520

        # Enable KMS if nvidia >= 470
    for package_name in to_install:
        if package_name.startswith('nvidia-driver-'):
            try:
                version = int(package_name.split('-')[-1])
            except ValueError:
                pass
            finally:
                with_nvidia_kms = version >= 470

    if with_nvidia_kms:
        set_nvidia_kms(1)

</CODE SNIPPET>

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


** Tags: card crash critical fail failure gpu graphics install nvidia python 
ubuntu-drivers video

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to ubuntu-drivers-common in Ubuntu.
https://bugs.launchpad.net/bugs/1997484

Title:
  ubuntu-drivers for 22.04 crashes while attempting to detect nvidia gpu

Status in ubuntu-drivers-common package in Ubuntu:
  New

Bug description:
  SYSTEM INFORMATION:
  user@host# lsb_release -rd
  Description:  Ubuntu 22.04.1 LTS
  Release:      22.04

  
  PACKAGE VERSION INFORMATION:
  user@host# apt-cache policy ubuntu-drivers-common
  ubuntu-drivers-common:
    Installed: 1:0.9.6.1
    Candidate: 1:0.9.6.1
    Version table:
   *** 1:0.9.6.1 500
          500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
          100 /var/lib/dpkg/status

  EXPECTED RESULT:
  Any updated/missing drivers are upgraded/installed

  ACTUAL RESULT:
  when using the command 'nvidia-drivers install' after a fresh installation, 
the following error is produced from Python3:
  
==================================================================================================
  user@hostname:~$ sudo ubuntu-drivers install
  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 413, in install
      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

  
==================================================================================================
  FIX FOR THIS BUG/WORK AROUND:
  This is fixed by adding the following code on line 830:
      version = 0

  <CODE SNIPPET>
  def nvidia_desktop_pre_installation_hook(to_install):
      '''Applies changes that need to happen before installing the NVIDIA 
drivers'''
      with_nvidia_kms = False
      version = 520

          # Enable KMS if nvidia >= 470
      for package_name in to_install:
          if package_name.startswith('nvidia-driver-'):
              try:
                  version = int(package_name.split('-')[-1])
              except ValueError:
                  pass
              finally:
                  with_nvidia_kms = version >= 470

      if with_nvidia_kms:
          set_nvidia_kms(1)

  </CODE SNIPPET>

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/1997484/+subscriptions


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to