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!