Score:1

System problem detected when trying to install nividia drivers and random system freezes

tm flag

linux newbie here I have just installed Ubuntu 22.04.2 with a few other things such as Docker and some jetbrains IDEs but besides that its a relatively clean install

it keeps freezing quite often but quite randomly (takes usually 1-2 min to full come back and be usable, the entire computer freezes, mouse, keyboard, screen, even hitting alt+F2 does nothing) so I assume it's that I haven't installed any of my nividia drivers for my 3070 Tuff Card.

$ uname -a
Linux Desktop-MOON 5.19.0-42-generic #43~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 21 16:51:08 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

$ inxi -G
Graphics:
  Device-1: NVIDIA GA104 [GeForce RTX 3070] driver: nouveau v: kernel
  Display: wayland server: X.Org v: 1.22.1.1 with: Xwayland v: 22.1.1
    compositor: gnome-shell v: 42.5 driver: gpu: nouveau
    resolution: 3840x1080~60Hz
  OpenGL: renderer: llvmpipe (LLVM 15.0.7 256 bits) v: 4.5 Mesa 22.2.5

I am following the instruction from this page: https://help.ubuntu.com/community/NvidiaDriversInstallation

cat /proc/driver/nvidia/version returns: cat /proc/driver/nvidia/version: No such file or directory

and sudo ubuntu-drivers list returns:

nvidia-driver-470, (kernel modules provided by linux-modules-nvidia-470-generic-hwe-22.04)
nvidia-driver-525-open, (kernel modules provided by linux-modules-nvidia-525-open-generic-hwe-22.04)
nvidia-driver-470-server, (kernel modules provided by linux-modules-nvidia-470-server-generic-hwe-22.04)
nvidia-driver-510, (kernel modules provided by linux-modules-nvidia-510-generic-hwe-22.04)
nvidia-driver-515, (kernel modules provided by linux-modules-nvidia-515-generic-hwe-22.04)
nvidia-driver-530-open, (kernel modules provided by linux-modules-nvidia-530-open-generic-hwe-22.04)
nvidia-driver-525, (kernel modules provided by linux-modules-nvidia-525-generic-hwe-22.04)
nvidia-driver-515-open, (kernel modules provided by nvidia-dkms-515-open)
nvidia-driver-530, (kernel modules provided by linux-modules-nvidia-530-generic-hwe-22.04)
nvidia-driver-525-server, (kernel modules provided by linux-modules-nvidia-525-server-generic-hwe-22.04)
nvidia-driver-515-server, (kernel modules provided by linux-modules-nvidia-515-server-generic-hwe-22.04)

and sudo ubuntu-drivers install returns:

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

and a System program problem detected popup message

how do I stop my system from freezing so often and how do I install the nividia drivers?

kanehekili avatar
zw flag
Could you list your GPU by executing `inxi -G` in the the terminal? Post the answer into your question. In addtion `uname -a`would help (I assume you'll need a newer kernel)
Moon avatar
tm flag
I added `inxi -G` and `uname -a` to the question. I did not modify python on my system at all. I am trying to install the driver because when I run `cat /proc/driver/nvidia/version` I get `No such file or directory`. And to my knowledge no gpu driver = more strain on the cpu. so I figured that it could be a source of the problem/ a pain point Like I said in my question I just installed and have only really installed Docker desktop, webstorm, rider, and Datagrip, git, along with chrome and discord, zsh, node, and nvm. I followed instruction on their own websites
Nmath avatar
ng flag
Developers don't necessarily provide installation instructions that are going to play nicely with your system. This is especially true for software that's already in official repos, because it's typically assumed you are going directly to their site because you want a newer version than is available in your distros sources, or because you want to install from source. Even adding sources alters your system and can have cascading effects on dependencies for other software. It definitely matters *how* you install software, especially if you didn't get it from Ubuntu 22.04 sources.
cc flag
Instead of modifying Python scripts, change the driver you select to one without the "-open" at the end. Some scripts get confused, thinking the "open" is a version number.
kanehekili avatar
zw flag
That should apply the the "-server" versions as well, since the script splits the version number with "-". As Nmath pointed out: It is not a good idea to install nvidia drivers from outside.
Score:0
zw flag

There seems to be a bug in the code. Since it is a python script, you should be able to fix it by yourself:

You need to execute nano or vi as "sudo" to edit /usr/lib/python3/dist-packages/UbuntuDrivers/detect.py.

Offending line is 835.

Find following line:

version = int(package_name.split('-')[-1])

modify to:

version = int(package_name.split('-')[2])

and retry. More documentation can be found here

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.