Bash scripts to automate installation of NVIDIA proprietary driver

The instructions in the tutorial shall be good.

Do you also have a motherboard GPU?

Yeah, I hadnā€™t paid much attention to the onboard graphics before as I always used the NVIDIA but yes that is probably the main reason this failed.

You can pull the latest version of Nvidia from:

https://download.nvidia.com/XFree86/Linux-x86_64/latest.txt

and download the latest version on the list:

https://download.nvidia.com/XFree86/Linux-x86_64/

Itā€™s just a suggestion if you want to simplify your scripts. Cheers!

2 Likes

@CaptSilver

Thx! I will incorporate this.

Well, you have to either disable the motherboard GPU or try to utilize both GPUs. Unfortunately Iā€™m not aware of any successful cases.

1 Like

Iā€™ve disabled the motherboard GPU, as I never use it anyway.

If you disabled it, it shall work.

BTW, how do you do that?

@doct0rHu I disabled it from the BIOS, it had an option to permanently disable. Iā€™m assuming it worked as I did ā€˜lshw -short | grep -i displayā€™ and it only showed my NVIDIA card.

Thatā€™s great because some people cannot find such option in their BIOS and cannot easily disable motherboard gpu.

After i did the basic nvidia install tutorial i canā€™t run nvidia drivers (outputs i post here). Steps that you describe in your post help me fix launch nvidia-settings and nvidia-smi, but despite the fact that the discrete card is much more powerful than the built-in, image became very laggy (for example - event just page scroll in firefox work with ~5FPS framerate).
And glxinfo output look not like you

> glxinfo| grep OpenGL 
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 8.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.2.0-devel
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.1 Mesa 19.2.0-devel
OpenGL shading language version string: 1.40
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 19.2.0-devel
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

@Akiyamka
It seems your system is running within a virtual machine. To be honest, Iā€™m not sure whether the tutorial is relevant to your case.

clear linux is not in a virtual machine, it is installed as as system on my laptop. But I understand why you thought that. If you look at last strings you see that now used driver - mesa. Mesa is an open source software implementation of OpenGL. Maybe itā€™s somehow use virtual machine internally for emulation.

This is really strange.

When do you downloaded the scripts? Because I was updating it on July 2nd ( US Eastern Time).

And would you uninstall it and have another try with the updated scripts? There are some changes from Clear Linux official tutorial and I have incorporated them

Also, if you would reinstall the driver, could you also show me the output of lspci before and after installation? ( In my case, before installation itā€™s using the library from nvidafb.)

For some raisin I canā€™t even see the download or am I just that blind? :thinking:

Sorry, I forgot to add the link after I updated the post. You can find it at the top now.

You right, i used old script.
Now I rollback all changes, and try again with new updated script.

Here my system state before i run scripts:
Nvidia driver is not used:

> glxinfo|egrep "OpenGL vendor|OpenGL renderer*"
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2)

My cards:

> lspci | grep NVIDIA && lspci | grep VGA     
01:00.0 3D controller: NVIDIA Corporation GP108M [GeForce MX150] (rev a1)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
00:13.0 Non-VGA unclassified device: Intel Corporation Sunrise Point-LP Integrated Sensor Hub (rev 21)

Attention to NVIDIA - just ā€œ3D controllerā€ without ā€œVGAā€ substring.
In your example you uselspci | grep -i vga command and see nvidia card as ā€œVGA compatible controllerā€. Maybe that important.

In accordance with the guidelines here, I expanded the blacklist

> cat /etc/modprobe.d/nvidia-disable-nouveau.conf
blacklist nouveau
blacklist nvidiafb
blacklist rivafb
options nouveau modeset=0

Letā€™s make sure that there are no pieces from nvidia drivers

> lsmod | grep ^nvidia
[nothing]

> nvidia-settings     
command not found

> nvidia-smi -a
command not found

OK, letā€™s do it. :crossed_fingers:

  1. I create /etc/X11/xorg.conf.d/20-optimus.conf with content from post above
> cat /etc/X11/xorg.conf.d/20-optimus.conf                 
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0.0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection
  1. And Default file
> cat /etc/gdm/Init/Default 
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
  1. Without reboot and new session run fresh install script. (I already have DKMS and blacklist so I pass pre_install.sh)
> sudo ./install.sh
ā³ Locating NVIDIA-Linux-x86_64-<VERSION>.run ...
ā³ Configuring dynamic linker configuration ...
 Updating dynamic linker run-time bindings and library cache...
ā³ Configuring Xorg to search for additional module ...
ā³ Installing NVIDIA proprietary Driver now ... 
If the installation is successful, GUI may automatically start.
Please run the post_install.sh to validate that the nvidia kernel modules are loaded.
The version of the driver is 430.26
Press any key to continue... 

Nice itā€™s my driver. Press anykey

verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 430.26
  1. Nothing after, script stop without any messages. Letā€™s run post_install.sh
sudo ./post_install.sh
ā³ Making sure NVIDIA kernel modules are loaded ...
nvidia_drm             45056  1
nvidia_modeset       1114112  1 nvidia_drm
nvidia              18784256  1 nvidia_modeset
ā³ Verifying the integrity of OpenGL library files ...
Verifying version 30210
Verifying files
	...100%
Starting download of remaining update content. This may take a while...
	...576%
Adding any missing files

Missing file: /usr/lib64/libEGL.so
fixed

Missing file: /usr/lib64/libEGL.so.1
fixed

Missing file: /usr/lib64/libEGL.so.1.0.0
fixed

Missing file: /usr/lib64/libGL.so
fixed

Missing file: /usr/lib64/libGL.so.1
fixed

Missing file: /usr/lib64/libGL.so.1.2.0
fixed

Missing file: /usr/lib64/libGLESv1_CM.so
fixed

Missing file: /usr/lib64/libGLESv1_CM.so.1
fixed

Missing file: /usr/lib64/libGLESv1_CM.so.1.1.0
fixed

Missing file: /usr/lib64/libGLESv2.so
fixed

Missing file: /usr/lib64/libGLESv2.so.2
fixed

Missing file: /usr/lib64/libGLESv2.so.2.0.0
fixed

Inspected 260 files
  12 files were missing
    12 of 12 missing files were replaced
    0 of 12 missing files were not replaced
Calling post-update helper scripts.
none
Repair successful
šŸ‘ Installation completed!

Ok, now I reboot :sweat_smile:

2 Likes

After reboot i saw black screen with blinking cli cursor. After ~10 sec blinking stoped, and system totally freeze. So i reboot again, go to clrl+2 session and collect some info:

> lsmod | grep ^nvidia
nvidia_drm             45056  0
nvidia_modeset       1114112  1 nvidia_drm
nvidia              18784256  1 nvidia_modeset

and journalctl output about last boot.
journalctl gist

I think the reason why prime doesnā€™t work in GDM issue. I need to install gdm-prime instead gdm or use x-run with another window-manager.

Now the problem is that I did not find gdm-prime for Clear* Linux and without any ideas where to get it

I am finding the same results with the same Nvidia GPU.

My next step will be to run all these steps and use lightdm instead of gdm and see.

As for the scripts

  1. pre_install.sh tries to install DKMS for you and itā€™s harmless to run it because swupd will just tell you itā€™s already installed. Then pre_install.sh updates the clr-boot-manager and disable nouveau driver. Youā€™ve manually disabled it so itā€™s okay to skip this script.
  2. By design install.sh donā€™t have any output after you successfully installed the driver. The reason is that usually once the driver is installed, the graphical display manager such as gdm will starts automatically and you are no longer in tty.
  3. Configurations in /etc/X11/xorg.conf.d/20-optimus.conf and /etc/gdm/Init/Default come from NVIDIAā€™s documentation and I didnā€™t find it anywhere else online and I cannot test this because I donā€™t have optimus. The documentation is available here.
  4. The output of post_install.sh looks correct.

My thoughts

  1. Before NVIDIA driver is installed, the output of glxinfo and lspci indicates that your system is using your on-board GPU. The output shall looks like this

    āÆ glxinfo|egrep "OpenGL vendor|OpenGL renderer*"
    OpenGL vendor string: nouveau
    OpenGL renderer string: NV132
    

    Notice the nouveau driver is used, and that is what we blacklisted in modrprobe.

  2. Iā€™ve did some search online and it says that itā€™s normal to have some NVIDIA GPU who supports OPTIMUS to be identified as 3D Controller instead of VGA Compatible Controller. Because theyā€™re not really GPU, but just a rendering unit connecting to onboard GPU via an adapter. (Not sure whether this is correct.)

    ArchWiki has this post(PRIME - ArchWiki) that might be helpful. In particular, Iā€™ve forked nvidia-xrun so that itā€™s consistent with the official tutorial on installing NVIDIA driver. The fork is available here.

    Please refer to ArchWiki and the original repository for more detailed instructions. I cannot test it.

This is also what I had after I installed the NVIDIA driver but when I connect the display to motherboard GPU.

So in other word it confirmed my guess that your NVIDIA GPU is never used by the system, though the modules ARE installed given the output of lsmod.

Check my forked version of nvidia-xrun .