如何使用 ubuntu-drivers 更改显卡驱动程序?

如何使用 ubuntu-drivers 更改显卡驱动程序?

我想验证 NVIDIA 当前使用的是什么驱动程序,然后在必要时将驱动程序切换为 nvidia-331-updates。

我怎样才能做到这一点?

sudo ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00000FFBsv00001462sd000010DBbc03sc00i00
model    : GK107GLM [Quadro K2000M]
vendor   : NVIDIA Corporation
driver   : nvidia-331-updates - distro non-free
driver   : nvidia-304 - distro non-free
driver   : nvidia-304-updates - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

sudo ubuntu-drivers list
nvidia-304
nvidia-331
nvidia-331-updates
nvidia-304-updates

(我尝试过,sudo ubuntu-drivers autoinstallsudo ubuntu-drivers autoinstall nvidia-331-updates由于缺乏有用的帮助文本,最终无济于事)

最近有人问过类似的问题(如何在命令行中使用 ubuntu-drivers-common 或 software-properties 来更改图形驱动程序?),但提问者接受的答案并没有真正回答问题。这就是为什么我想再试一次。

我对此感兴趣的原因是,在尝试设置第二台显示器之后,图形“附加驱动程序”工具突然停止工作。

答案1

不可以。至少用那个工具不行。没有命令可以帮助你安装不同的驱动程序:

list: Show all driver packages which apply to the current system.
debug: Print all available information and debug data about drivers.
devices: Show all devices which need drivers, and which packages apply to them.
autoinstall: Install drivers that are appropriate for automatic installation.

list不安装,但列出。debug只是打印更多信息。devices是信息丰富的。autoinstall不允许其他参数:

def command_autoinstall(args):
    '''Install drivers that are appropriate for automatic installation.'''

    cache = apt.Cache()

    packages = UbuntuDrivers.detect.system_driver_packages(cache)
    packages = UbuntuDrivers.detect.auto_install_filter(packages)
    if not packages:
        print('No drivers found for automatic installation.')
        return

    # ignore packages which are already installed
    to_install = []
    for p in packages:
        if not cache[p].installed:
            to_install.append(p)

    if not packages:
        print('All drivers for automatic installation are already installed.')
        return

    ret = subprocess.call(['apt-get', 'install', '-o',
        'DPkg::options::=--force-confnew', '-y'] + to_install)

    # create package list
    if ret == 0 and args.package_list:
        with open(args.package_list, 'a') as f:
            f.write('\n'.join(to_install))
            f.write('\n')

    return ret

apt您可以忽略该工具,并按照您得到的输出自行手动安装包。只需删除一个包并安装另一个包:

sudo apt-get install nvidia-331-updates

相关内容