6

I recently re-installed my wife's XUbuntu 22 machine. Previously we used the NVidia driver package from the NVidia website, especially after a bit of a f&%k up last year where the official repo version broke due to broken dependencies.

This time I thought I would give the repo version another go, especially since my wife is scared of re-installing the graphics drivers after a kernel update - and it is a real nuisance.

As per the guide I found online I ran the command sudo ubuntu-drivers autoinstall. The result was:

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

I manually installed the 515 drivers repo package, but it does not seem to include the 32 bit drivers, and now Steam, among other things, doesn't work.

AlastairG
  • 193
  • I just listed packages and I do appear to have libnvidia-gl-515:i386, so maybe that isn't why Steam isn't working. I would like to get rid of the error though. – AlastairG Oct 16 '22 at 14:18
  • It looks like the ubuntu-drivers command is having some trouble. You might want to try running it again with the --debug option to see if that provides any more information.

    Alternatively, you can try manually installing the drivers from the NVIDIA website. Just download the drivers for your specific graphics card and follow the instructions on the website.

    – Mohamed Elgazar Oct 16 '22 at 16:59
  • @Mohamed, what you suggest is what I used to do and am trying to avoid doing. – AlastairG Oct 18 '22 at 06:47

2 Answers2

6

The reason for the error is the bug in the installer. The more detailed explanation could be found on nvidia forum. If you want to use command line for driver installation, you could run such a command to get possible driver versions:

sudo ubuntu-drivers devices

Then you can manually choose the version you want from the list, but use it without -open at the end (this is the reason for the error). So, instead of nvidia-driver-515-open use nvidia-driver-515 and run:

sudo apt install nvidia-driver-515
dinarkino
  • 176
2

Had the same issue, fixed it by installing the driver from "Software & Updates" -> "Additional Drivers" & then the newest Nvidia Driver. After that running sudo ubuntu-driver autoinstall gave me "All the available drivers are already installed."

Olli
  • 21
  • 1
    That works, but I really prefer using the command line. I would still like to get the ubuntu-drivers command to work without crashing. Is it a bug in the command? The config? Something I did? Something I need to raise a bug report on? – AlastairG Oct 18 '22 at 06:49