尝试 ubuntu-drivers 自动安装 ubuntu 22.04 时出错

尝试 ubuntu-drivers 自动安装 ubuntu 22.04 时出错

我在 Acer Nitro 5 AN515-55 上安装了 Ubuntu 22.04 LTS,它配备了 Nvidia Geoforce GTX,运行良好,大约 3 个月。昨天我把它关掉了;当我再次打开电源时,第二个显示器无法识别。尝试了几种方法都没有成功,所以最终重新安装了整个系统... 经过几次尝试,我终于通过使用 X.org 驱动程序让第二个显示器被识别。

现在,当我尝试在设置-显示中移动显示侧时,单击“应用”后,我的笔记本电脑进入开始登录屏幕,没有任何变化。我尝试运行sudo ubuntu-drivers autoinstall并查看:

    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

我使用与最初相同的实时 USB 棒进行安装,并更新了系统几次(使用软件更新程序和控制台)。宏碁的支持没有提供任何帮助。

答案1

这是在正式决定之前的一个临时解决方案:(取自此处https://forums.developer.nvidia.com/t/ubuntu-22-04-1-nvidia-driver-open-kernel-nvidia-driver-515-open-issue/231356

sudo nano /usr/lib/python3/dist-packages/UbuntuDrivers/detect.py

在第 835 行更改

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

对此

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

相关内容