the new -server drivers break nvidia-detector

Bug #1891183 reported by Alberto Milone
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
ubuntu-drivers-common (Ubuntu)
Fix Released
Medium
Alberto Milone
Bionic
In Progress
Medium
Alberto Milone
Focal
In Progress
Medium
Alberto Milone

Bug Description

Calling nvidia-detector, fails when the new -server series are available in the archive:

nvidia-detector
Traceback (most recent call last):
  File "/usr/bin/nvidia-detector", line 8, in <module>
    a = NvidiaDetection(printonly=True, verbose=False)
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 73, in __init__
    self.getData()
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 163, in getData
    driver_version = self.__get_value_from_name(stripped_package_name)
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 92, in __get_value_from_name
    v = int(name)

Tags: patch
Changed in ubuntu-drivers-common (Ubuntu):
assignee: nobody → Alberto Milone (albertomilone)
Changed in ubuntu-drivers-common (Ubuntu Bionic):
assignee: nobody → Alberto Milone (albertomilone)
Changed in ubuntu-drivers-common (Ubuntu Focal):
assignee: nobody → Alberto Milone (albertomilone)
Changed in ubuntu-drivers-common (Ubuntu):
status: New → In Progress
Changed in ubuntu-drivers-common (Ubuntu Bionic):
status: New → In Progress
Changed in ubuntu-drivers-common (Ubuntu Focal):
status: New → In Progress
Changed in ubuntu-drivers-common (Ubuntu):
importance: Undecided → Medium
Changed in ubuntu-drivers-common (Ubuntu Bionic):
importance: Undecided → Medium
Changed in ubuntu-drivers-common (Ubuntu Focal):
importance: Undecided → Medium
description: updated
Revision history for this message
Jam Hernandez Quiceno (jam369) wrote :

Here is the output without the fix:
Traceback (most recent call last):
  File "/usr/bin/nvidia-detector", line 8, in <module>
    a = NvidiaDetection(printonly=True, verbose=False)
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 73, in __init__
    self.getData()
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 163, in getData
    driver_version = self.__get_value_from_name(stripped_package_name)
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 92, in __get_value_from_name
    v = int(name)
ValueError: invalid literal for int() with base 10: 'server'

Here are is my solution:

In function
    # line 88
    def __get_value_from_name(self, name):
        '''Get the integer associated to the name of a driver'''
        v = self.__driver_aliases.get(name)
        if v is None:
            if name.isdigit(): # I made sure is an int.
                v = int(name)
        return v

    # in line 164 I replaced with :
            if not (driver_version := self.__get_value_from_name(stripped_package_name)):
                continue

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "nvidiadetector.py" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-drivers-common - 1:0.8.6

---------------
ubuntu-drivers-common (1:0.8.6) groovy; urgency=medium

  [ Alberto Milone ]
  * share/hybrid/json-parser, debian/copyright:
    - Include json-parser (just C file and header).
  * gpu-manager.c:
    - Add json parsing code to detect support for runtimepm on NVIDIA
      (LP: #1895855).
    - Check that RTD3 is enabled, and write that to a file in /run.
    - Make on-demand mode the default when no settings are available.
    - Add support for AMD+NVIDIA hybrid systems.
    - Add support for checking PME capabilities for runtimepm, so that,
      if the GPU is not boot_vga, and it is not listed in the json
      database, we can at least check whether d3hot is supported, and
      enable runtimepm in the NVIDIA driver.
  * gpu-manager.py:
    - Adjust the test suite to match the changes in gpu-manager.c.
  * UbuntuDrivers/detect.py, ubuntu-drivers:
    - Catch apt exceptions.
    - Catch failure when modinfo is not available.
    - Introduce the concept of LTSB (long term support branch), NFB
      (new feature branch), Legacy, and Beta, which the driver packages
      can specify.
    - Use package support to pick the nvidia driver:
      o Desktop case: pick the latest non-server driver, when available
        (this preserves the current behaviour).
      o Server case: pick the LTSB -server driver, when available.
  * NvidiaDetector/nvidiadetector.py:
    - Use regex to parse package names (LP: #1891183).
  * ubuntu-drivers:
    - Select on-demand mode if runtimepm is supported.
    - Check RTD3 support for NVIDIA, and enable it when available.
    - Show the package support level, when available, when using
      "ubuntu-drivers debug".
  * debian/control:
    - Replace build-dep on libpciaccess-dev with libpci-dev.
  * debian/rules: make sure to call the clean target of the Makefile

  [ Cyrus Lien ]
  * gpu-manager.c:
    - Fix segmentation fault in json_find_feature_in_array.

 -- Alberto Milone <email address hidden> Mon, 12 Oct 2020 16:00:18 +0200

Changed in ubuntu-drivers-common (Ubuntu):
status: In Progress → Fix Released
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.