uvtec@uvtec-MS-7B98:~$ sudo ubuntu-drivers autoinstall
Traceback (most recent call last):
File “/usr/bin/ubuntu-drivers”, line 513, in
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
办法:
这个报错看起来似乎与 Ubuntu 驱动管理器的 Nvidia 驱动程序检测有关。根据报错信息,似乎在检测 Nvidia 驱动版本时发生了错误。建议您尝试以下步骤来解决这个问题:
首先,您可以尝试更新系统并升级所有软件包到最新版本。您可以使用以下命令执行此操作:
sql
Copy code
sudo apt update && sudo apt upgrade
如果更新软件包不起作用,请尝试更新 Nvidia 驱动程序到最新版本。您可以使用以下命令执行此操作:
Copy code
sudo apt install nvidia-driver
如果更新 Nvidia 驱动程序不起作用,请尝试使用 ubuntu-drivers 命令手动安装适合您的 Nvidia 驱动程序版本。您可以使用以下命令列出可用的驱动程序:
Copy code
ubuntu-drivers list
然后,您可以使用以下命令安装适合您的 Nvidia 驱动程序版本:
Copy code
sudo ubuntu-drivers autoinstall
如果仍然遇到问题,请尝试在 Ubuntu 官方论坛或社区中寻求帮助。
uvtec@uvtec-MS-7B98:~$ sudo usb_modeswitch -KW -v 0bda -p 1a2b
Take all parameters from the command line
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x0bda
DefaultProduct= 0x1a2b
StandardEject=1
Look for default devices …
found USB ID 1d6b:0003
found USB ID 1d6b:0002
found USB ID 0781:5567
found USB ID 174c:235c
found USB ID 1d6b:0003
found USB ID 093a:2510
found USB ID 0bda:1a2b
vendor ID matched
product ID matched
found USB ID 17ef:6018
found USB ID 1d6b:0002
found USB ID 1d6b:0003
found USB ID 1d6b:0002
Found devices in default mode (1)
Access device 005 on bus 001
Get the current device configuration …
Current configuration number is 1
Use interface number 0
with class 8
Use endpoints 0x0b (out) and 0x8a (in)
Sending standard EJECT sequence
Looking for active drivers …
Set up interface 0
Use endpoint 0x0b for message sending …
Trying to send message 1 to endpoint 0x0b …
Sending the message returned error -7. Try to continue
Read the response to message 1 (CSW) …
Response reading failed (error -7)
Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!