Bash scripts to automate installation of NVIDIA proprietary driver

Hi miguelinux and thanx for your help!
I used your method and the kernel line was added to the bootloader. A much better way than mine because I added it directly to the conf and the next clr-boot-manager update will wipe it.

Unfortunately the result after installing the nvidia driver was still the same white screen.

How can I be sure that the module is not loaded / used? I use

sudo lspci -vs 00:02.0

which gives me:

00:02.0 VGA compatible controller: Intel Corporation Device 3e94 (prog-if 00 [VGA controller])
Subsystem: Lenovo Device 2269
Flags: bus master, fast devsel, latency 0, IRQ 130
Memory at 404a000000 (64-bit, non-prefetchable) [size=16M]
Memory at 80000000 (64-bit, prefetchable) [size=256M]
I/O ports at 3000 [size=64]
[virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
Capabilities: [40] Vendor Specific Information: Len=0c <?>
Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
Capabilities: [ac] MSI: Enable+ Count=1/1 Maskable- 64bit-
Capabilities: [d0] Power Management version 2
Capabilities: [100] Process Address Space ID (PASID)
Capabilities: [200] Address Translation Service (ATS)
Capabilities: [300] Page Request Interface (PRI)
Kernel driver in use: i915

I interpret this that the driver i still in use. This

sudo lsmod | grep ^nvidia gives me:

nvidia_uvm 823296 0
nvidia_drm 45056 0
nvidia_modeset 1110016 1 nvidia_drm
nvidia 18767872 2 nvidia_uvm,nvidia_modeset
nvidiafb 53248 0

Any more Ideas? I really like clear linux but a non working nvidia setup is a showstopper for me.

Cheers

@specter
https://wiki.archlinux.org/index.php/Bumblebee

If your laptop has NVIDIA Optimus, you may try Bumblebee, also has dynamic GPU switching.

Ok, I finally got this working! Cannot believe how hard this was. So, installing the nvidia driver with the tutorial was only half the way. This is my first notebook with an integrated and a nvidia gpu. So the problem was that the i915 gpu was the default one and just used for everything. As I don’t have access to the bios, I couldn’t switch to discreet only.

So what I did. I added two more modules to blacklist

disable-nouveau.conf:

blacklist nouveau
blacklist nvidiafb
blacklist rivafb
options nouveau modeset=0

I added another file to modprobe.d

nvidia-drm.conf:

options nvidia_drm modeset=1

I added:

/etc/X11/xorg.conf.d/90-mhwd.conf

Section “Module”
Load “modesetting”
EndSection

Section “Device”
Identifier “nvidia”
Driver “nvidia”
BusID “PCI:1:0:0”
Option “AllowEmptyInitialConfiguration”
EndSection

Added /usr/local/share/optimus.desktop

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c “xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto”
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer

Then symlink

sudo ln -s /usr/local/share/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop
sudo ln -s /usr/local/share/optimus.desktop /etc/xdg/autostart/optimus.desktop

When the destination folders don’t exist, just create them.

Then reboot and cross fingers :wink:

All instructions beyond the nvidia driver tutorial are basically from here:

This is the result on a Thinkpad P72 with Quadro 5200:

glxinfo
name of display: :1
display: :1 screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
.
.
.
OpenGL version string: 4.6.0 NVIDIA 430.14
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:

Maybe this could be useful for similar setups.

Cheers

6 Likes

Does it work if you do
sudo ln -s /usr/local/share/optimus.desktop /etc/gdm/greeter/autostart/optimus.desktop

if not we need to fix it.

Fabulous! I will try this with my own system.

Hi miguelinux

give me one night with a working nvidia setup :wink: I will test tomorrow.

Cheers

Are you using gnome Xorg or Wayland? Do the drivers only work with Xorg?

@miguelinux

I deleted my symlink

sudo ln -s /usr/local/share/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop

and created yours

sudo ln -s /usr/local/share/optimus.desktop /etc/gdm/greeter/autostart/optimus.desktop

but unfortunately the system booted into a black screen.

@Sumdewd

I use Xorg

Cheers

So far most things work well. I found two issues.

The gnome-settings are not starting. The workaround to start is:

export LD_LIBRARY_PATH=/opt/nvidia/lib:$LD_LIBRARY_PATH
gnome-control-center -v

A little bit annoying to start from console and export the path everytime.

The second thing is, that I have strong system freezes (1-2 seconds) in some situations. Often it happens when i activate gnome dash in the left top area. I never had any hard locks or something. It just freezes the whole system and comes back after 1-2 second. There is no screen corruptions or anything. Just cannot move mouse.

Maybe someone has a hint.

Cheers

Ok we need to fix it

I summarized what I believe the issue is here nvidia 2060 rtx: Black screen after login live usb ¡ Issue #791 ¡ clearlinux/distribution ¡ GitHub

Mainly impacts autotools builds, setting RPATH/RUNPATH.

for i in /usr/lib64/lib*; do readelf -d ${i} | grep PATH; done

shows the extent of the problem.

1 Like

I never even knew this was an issue until you all clued me in. I use blackbox on most distros so its either cli or dconf editor. I thought this settings bug might have something to do with me removing qt libraries so I spent hours reinstalling and optimizing them… only to realize I run Gnome not KDE. These graphics libraries are so fancy I need a second monocle up in here.

@miguelinux
It seems to me that you’ve fixed the issue with OpenGL library now. I’ve just reinstalled the NVIDIA driver and everything works fine now

I am also having the same issue as you, will try this solution. It would be great if these were added to the scripts. Perhaps some day @doct0rHu?

it has been a while. what issue are you referring to?

@doct0rHu the white screen on machines with an intel onboard graphics card and a nVidia card.

I tried it with the latest NVIDIA drivers (NVIDIA-Linux-x86_64-340.107.run) and latest CL. And it fails in two ways:
There are error on -force-libglx-indirect that it is not supported. So I removed it from the script. Installation goes further but ends up with an error.

Kernel preparation unnecessary for this kernel.

I can repeat the process and save the logs if it helps. Right now I run ./uninstall to get working PC. And write this.

Does anyone else have such problems lately?

What GPU is it @w84death? If it requires the older version of NVIDIA drivers try using the LTS kernel.

1 Like

Right now I have just for testing an old Quadro FX 580. This is on my “testing” hardware. The idea was to test nvidia drivers installation. And then decide what (better) card to buy. Or just go with AMD.

I also have a RTX card but I have a working distro there that I don’t want to touch right now. But in the future I plan to put CL on it.

Thanks for pointing out the older kernel. I can try with LTS.

EDIT: no luck; same error. I copied the log file. It’s quite long. http://nextcloud.p1x.in/s/W9YMZC7rFBGtPHJ

EDIT2: last lines reveals the exact error
/var/lib/dkms/nvidia/340.107/build/uvm/nvidia_uvm_lite.c:857:14: error: initialization of ‘vm_fault_t (*)(struct vm_fault *)’ {aka ‘int (*)(struct vm_fault *)’} from incompatible pointer type ‘int (*)(struct vm_area_struct *, struct vm_fault *)’

@w84death these aren’t the same exact version but it seems to have been a known-issue in the past that people are addressing with patches to the NVIDIA drivers as far as I can tell.

http://rglinuxtech.com/?p=2527

Doublecheck the running kernel got switched with uname -a