My goal is to install nvidia cuda for some machine learning on a new Lenovo Thinkpad P52S laptop running Fedora 30. The laptop comes with both an integrated intel card and an nvidia quadro P500 card (I think this is called Optimus). I want to use the intel card for display and the nvidia exclusively for machine learning.
I've followed various tutorials and blogs on the web, most notably the rpmfusion howto: https://rpmfusion.org/Howto/NVIDIA
and a recent fedora magazine article: https://fedoramagazine.org/install-nvidia-gpu/
The latter says (in the comments) that there is no need to disable nouveau but I had to do that in the past every time I installed the nvidia drivers, so I'm trying to do that now as well.
So I did the following:
1. Installed the nvidia rpms:
dnf install xorg-x11-drv-nvidia akmod-nvidia
which installed the following + dependencies:
[root@thinkpad ~]# rpm -qa | grep -i nvidia xorg-x11-drv-nvidia-430.40-1.fc30.x86_64 nvidia-settings-430.40-1.fc30.x86_64 xorg-x11-drv-nvidia-libs-430.40-1.fc30.x86_64 akmod-nvidia-430.40-1.fc30.x86_64 xorg-x11-drv-nvidia-cuda-libs-430.40-1.fc30.x86_64 xorg-x11-drv-nvidia-kmodsrc-430.40-1.fc30.x86_64 kmod-nvidia-5.2.11-200.fc30.x86_64-430.40-1.fc30.x86_64
2. The dnf install command modified the boot options, to blacklist nouveau:
[root@thinkpad ~]# cat /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 resume=UUID=d1406222-e963-4043-a6f9-10c784752ed8 rhgb quiet" GRUB_DISABLE_RECOVERY="true" GRUB_ENABLE_BLSCFG=true
3. I read that is not enough though, as if nouveau is in the initram disk it will still do modeset = 1, so I blacklisted it in modprobe.d and created a new initram disk:
[root@thinkpad ~]# cat /etc/modprobe.d/blacklist_nouveau.conf blacklist nouveau options nouveau modeset=0
# backup nouveau initram disk [root@thinkpad boot]# cp initramfs-5.2.11-200.fc30.x86_64.img initramfs-5.2.11-200.fc30.x86_64_nouveau.img
# create new one: [root@thinkpad boot]# dracut --force
Now [root@thinkpad boot]# lsinitrd initramfs-5.2.11-200.fc30.x86_64.img | grep -i nouveau -rw-r--r-- 1 root root 44 Feb 14 2019 etc/modprobe.d/blacklist_nouveau.conf drwxr-xr-x 2 root root 0 Feb 14 2019 usr/lib/modules/5.2.11-200.fc30.x86_64/kernel/drivers/gpu/drm/nouveau -rw-r--r-- 1 root root 636252 Feb 14 2019 usr/lib/modules/5.2.11-200.fc30.x86_64/kernel/drivers/gpu/drm/nouveau/nouveau.ko.xz
so it picked up the blacklist_nouveau.conf file.
4. set runlevel 3
systemctl set-default multi-user.target
5. I'm running Xorg, not Wayland:
[root@thinkpad ~]# pidof xinit 1351 [root@thinkpad ~]# pidof Xwayland [root@thinkpad ~]#
6. Reboot. Even before starting X, I still get nouveau:
[root@thinkpad ~]# lsmod | grep nouveau nouveau 2265088 0 mxm_wmi 16384 1 nouveau ttm 118784 1 nouveau i2c_algo_bit 16384 2 i915,nouveau drm_kms_helper 225280 2 i915,nouveau drm 495616 8 drm_kms_helper,i915,ttm,nouveau wmi 36864 4 intel_wmi_thunderbolt,wmi_bmof,mxm_wmi,nouveau video 49152 3 thinkpad_acpi,i915,nouveau
I can, however modprobe -r nouveau and things seem OK.
But what do I do to have it not load on boot? When this happened in the past, as a last resort, I removed the appropriate rpms, but now the nouveau driver seems to be part of the kernel-modules package:
[root@thinkpad ~]# rpm -qf /usr/lib/modules/5.2.11-200.fc30.x86_64/kernel/drivers/gpu/drm/nouveau/nouveau.ko.xz kernel-modules-5.2.11-200.fc30.x86_64
Any help on this, anyone? Thanks!
On 9/11/19 8:18 AM, Amadeus WM via users wrote:
Any help on this, anyone? Thanks!
What is the output of "grub2-editenv list"
It should look similar to...
[root@meimei ~]# grub2-editenv list saved_entry=a48313ea54924eef8eca07a507b7541f-5.2.11-200.fc30.x86_64 boot_success=1 boot_indeterminate=0 kernelopts=root=UUID=4455f2e9-fed2-4e1e-856d-642b531547f9 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 nomodeset rhgb quiet
On Wed, 11 Sep 2019 08:37:54 +0800, Ed Greshko wrote:
On 9/11/19 8:18 AM, Amadeus WM via users wrote:
Any help on this, anyone? Thanks!
What is the output of "grub2-editenv list"
It should look similar to...
[root@meimei ~]# grub2-editenv list saved_entry=a48313ea54924eef8eca07a507b7541f-5.2.11-200.fc30.x86_64 boot_success=1 boot_indeterminate=0 kernelopts=root=UUID=4455f2e9-fed2-4e1e-856d-642b531547f9 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 nomodeset rhgb quiet
[root@thinkpad ~]# grub2-editenv list saved_entry=4413360b7e8148d49f500b9379d6dbf7-5.2.11-200.fc30.x86_64 menu_auto_hide=1 boot_success=1 kernelopts=root=UUID=099e669e-2682-4791-99f0-abc4010b72b0 ro resume=UUID=d1406222-e963-4043-a6f9-10c784752ed8 rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 boot_indeterminate=0
Problem solved.
As I said, I observed that I could modprobe -r nouveau, so I thought I'd try
# modprobe nvidia modprobe: ERROR: could not insert 'nvidia': Operation not permitted
So I googled that and found this article, which said disable secure boot: https://forums.fedoraforum.org/showthread.php?320115-modprobe-operation-not
I rebooted, disabled secure boot in the UEFI bios and lo and behold, nouveau is gone and nvidia is loaded (on boot):
[root@thinkpad ~]# lsmod | grep nvidia nvidia_drm 57344 5 nvidia_modeset 1118208 3 nvidia_drm nvidia_uvm 970752 0 nvidia 19103744 237 nvidia_uvm,nvidia_modeset ipmi_msghandler 73728 2 ipmi_devintf,nvidia drm_kms_helper 225280 2 nvidia_drm,i915 drm 495616 8 drm_kms_helper,nvidia_drm,i915
and
glxinfo | grep -i opengl OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: Quadro P500/PCIe/SSE2 OpenGL core profile version string: 4.6.0 NVIDIA 430.40 OpenGL core profile shading language version string: 4.60 NVIDIA OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 4.6.0 NVIDIA 430.40 OpenGL shading language version string: 4.60 NVIDIA OpenGL context flags: (none) OpenGL profile mask: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 430.40 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 OpenGL ES profile extensions:
Now, how do I make it use the onboard intel card for display and nvidia for cuda?