安装 Nvidia 驱动程序 Fedora 35 内核 5.16.15 时出错
花了三天时间尝试在运行内核 5.16 的 Fedora 35 中安装 nvidia 显卡驱动程序。我正在从下载的 .run 文件进行安装,该文件在 /var/lib/dkms/nvidia/495.46/build/make.log 中抛出未声明的错误“MIGRATE_PFN_LOCKED”
我尝试在不启用 dkms 的情况下进行安装,但仍然无法安装驱动程序
systemctl set-default multi-user.target
然后
以 root 用户身份systemctl restart
。登录后,将目录更改为您下载 Nvidia 显卡的 .run 安装程序的位置,然后在下面运行
sh ./NVIDIA-Linux-x86_64-XXX.XX.run --extract-only
以上提取安装程序文件使我们能够编辑驱动程序源代码。使用您最喜欢的编辑器打开文件 uvm_migrate_pageable.c,该文件位于提取的驱动程序文件夹中,如下所示:
kernel/nvidia-uvm/uvm_migrate_pageable.c
我最喜欢的编辑器是 vim,所以就我而言,我将打开它进行编辑,如下所示:-
vim /NVIDIA-Linux-x86_64-XXX.XX/kernel/nvidia-uvm/uvm_migrate_pageable.c
在源文件的声明部分或在此 c 源文件中引用的位置之前添加以下行。
#ifndef MIGRATE_PFN_LOCKED
#define MIGRATE_PFN_LOCKED 0
#endif
保存文件,然后在我们提取的文件夹中运行驱动程序,如下所示:
./nvidia-installer
安装过程现在应该完成,没有任何错误,您现在可以通过运行以下命令恢复到 X 窗口系统命令:
systemctl set-defaultdesktop.target
参考资料:
https://bbs.archlinux.org/viewtopic.php?id=271400
https://github.com/torvalds/linux/commit/ab09243aa95a72bac5c71e852773de34116f8d0f
Spent three days trying to install nvidia graphic card drivers in Fedora 35 running on kernel 5.16. I was installing from the download .run file which threw error 'MIGRATE_PFN_LOCKED' undeclared in /var/lib/dkms/nvidia/495.46/build/make.log
I tried installing without enabling dkms but still couldn't install the drivers
systemctl set-default multi-user.target
then
systemctl reboot
as root user. On logging in, change directory to where you download .run installer for your Nvidia graphic card and run below
sh ./NVIDIA-Linux-x86_64-XXX.XX.run --extract-only
Above extract the installer file which will give us ability to edit the driver source code. Use your favorite editor to open the file uvm_migrate_pageable.c which is located in your extracted driver folder as below:
kernel/nvidia-uvm/uvm_migrate_pageable.c
My favorite editor is vim, so in my case, I will open it for editing as below:-
vim /NVIDIA-Linux-x86_64-XXX.XX/kernel/nvidia-uvm/uvm_migrate_pageable.c
Add below lines on declaration part of the source file or before where it is referenced in this c source file.
#ifndef MIGRATE_PFN_LOCKED
#define MIGRATE_PFN_LOCKED 0
#endif
save the file and now run your driver as below while inside the folder we extracted:
./nvidia-installer
Installation process should now complete without any errors and you can now revert to your X windowing system by running the command:
systemctl set-default desktop.target
References:
https://bbs.archlinux.org/viewtopic.php?id=271400
https://github.com/torvalds/linux/commit/ab09243aa95a72bac5c71e852773de34116f8d0f
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题:NVIDIA 团队暂时还不支持内核 5.16.15。
解决方案:通过运行下面的命令自行修补当前的安装程序,请注意,您必须通过文本模式登录到 Fedora 来禁用 x,这可以通过运行命令来实现
Issue: The NVIDIA team do not yet have support for kernel 5.16.15 for the time being.
Solution: Patch the current installer yourself by running below, note that you must have x disabled probably by logging into your fedora via text mode which can be achieved by running the command