Nvidia on Ubuntu: Difference between revisions

mNo edit summary
use Subpages template
 
(5 intermediate revisions by 2 users not shown)
Line 4: Line 4:


Why not just continue to use [https://nouveau.freedesktop.org/index.html Nouveau], a project of the [https://www.freedesktop.org/wiki/ freedesktop] community? I mean "if it ain't broke, don't fix it" - right? In principle, I'd very much like to use nouveau. I'm not even sure that any alternative is "better" in any way - especially since ''I am not a gamer''<ref>I'm not opposed in any way, I just don't have the time to add another hobby. This is a clarifying statement for my use-case, and therefore, requirements.</ref>. My use case is to get the best performance from local LLMs. As I become familiar with the methods to switch video drivers reliably, I intend to run benchmarks and explore the benefits of one configuration vs another.
Why not just continue to use [https://nouveau.freedesktop.org/index.html Nouveau], a project of the [https://www.freedesktop.org/wiki/ freedesktop] community? I mean "if it ain't broke, don't fix it" - right? In principle, I'd very much like to use nouveau. I'm not even sure that any alternative is "better" in any way - especially since ''I am not a gamer''<ref>I'm not opposed in any way, I just don't have the time to add another hobby. This is a clarifying statement for my use-case, and therefore, requirements.</ref>. My use case is to get the best performance from local LLMs. As I become familiar with the methods to switch video drivers reliably, I intend to run benchmarks and explore the benefits of one configuration vs another.
== Status ==
As of 2025-07-03, I'm still not running with an NVIDIA driver. According to [https://www.reddit.com/r/Ubuntu/comments/1li7wg7/how_do_i_install_nvidiadriver575_correctly/ a Reddit thread] just days ago, it's always been rather messy getting the right system together. I should "upgrade your system either to Ubuntu 25.04 for Wayland experience and no working suspend to RAM, or to 24.04 if you need suspend to RAM, but are Ok with using X11 instead of Wayland."
Since I'm on 24.04, and I've tried using X11 instead of Wayland without success, I plan to ensure my home directory is on its own partition and reinstall the OS to 25.04


== Opposite ==
== Opposite ==
Line 18: Line 23:


'''OpenGL version''' string: 4.3 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1
'''OpenGL version''' string: 4.3 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1
If you are on a TTY (without a display), <code>lspci</code> shows the same info
<code>lspci | grep VGA</code>
01:00.0 '''VGA''' compatible controller: NVIDIA Corporation AD107 [GeForce RTX 4060] (rev a1)


After the installation of Nvidia drivers fails, you won't have a functioning GPU, since you will no longer have the nouveau driver available either, and so the output of the same glxinfo command will show that "llvmpipe" is the renderer.
After the installation of Nvidia drivers fails, you won't have a functioning GPU, since you will no longer have the nouveau driver available either, and so the output of the same glxinfo command will show that "llvmpipe" is the renderer.
Line 25: Line 36:
'''OpenGL version''' string: 4.5 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1
'''OpenGL version''' string: 4.5 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1


LLVMpipe is a software rasterizer within the Mesa 3D graphics library that utilizes the LLVM compiler infrastructure to perform rendering entirely on the CPU. It acts as a software fallback when a dedicated GPU or its drivers are unavailable or malfunctioning, allowing OpenGL applications to run without hardware acceleration. Essentially, LLVMpipe takes over the rendering process when the GPU can't or shouldn't be used.  
[https://docs.mesa3d.org/drivers/llvmpipe.html LLVMpipe] is a software rasterizer within the Mesa 3D graphics library that utilizes the LLVM compiler infrastructure to perform rendering entirely on the CPU. It acts as a software fallback when a dedicated GPU or its drivers are unavailable or malfunctioning, allowing OpenGL applications to run without hardware acceleration. Essentially, LLVMpipe takes over the rendering process when the GPU can't or shouldn't be used.  


If dpkg shows xserver-xorg-video-'''nouveau is installed''', then you can switch to it from e.g. "Driver Manager" in Settings. Although you can view drivers through Synaptic, you won't be able to switch from that interface (you'll get an error message about a lock file).
If dpkg shows xserver-xorg-video-'''nouveau is installed''', then you can switch to it from e.g. "Driver Manager" in Settings.


<code>lspci | grep VGA</code>
Synaptic will allow you to view drivers, but you won't be able to switch from that interface (you'll get an error message about a lock file).


01:00.0 '''VGA''' compatible controller: NVIDIA Corporation AD107 [GeForce RTX 4060] (rev a1)
Although switching drivers from the system settings interface appears to complete without error, I'm not sure how well it works - if at all.
 
I was getting a broken desktop (single monitor, no good results from things like nvidia-smi) after installing Nvidia drivers, and so I tried switching to nouveau - and it somehow eventually worked.  <pre>
apt-get remove -y --purge '^libnvidia-.*' && apt-get remove -y --purge '^nvidia-*' && apt-get remove -y --purge '*575*' && apt -y autoremove
apt -y autoclean
shutdown -r now
(recovery mode)
vim /etc/default/grub
update-grub
</pre>After doing a couple of reboots changing the boot 'modeline' and 'nosplash' options from a recovery console or the TTY, I didn't seem to get anywhere. But when I issued a 'startX' command, and the system booted into the GNOME desktop instead of KDE (?!!??), then I had dual monitors again. Amazingly nvidia-smi returned results, but glxinfo says now that I'm using onboard graphics from the CPU (not the GPU) but it doesn't say LLVMpipe
 
'''OpenGL renderer''' string: Mesa Intel(R) Graphics ('''RPL-S''') 
 
'''OpenGL version''' string: 4.6 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1<pre>
sudo lsmod|grep -i nvidia
nvidia_uvm          2158592  4
nvidia_drm            139264  5
nvidia_modeset      1736704  6 nvidia_drm
nvidia              11550720  81 nvidia_uvm,nvidia_modeset
ecc                    45056  2 ecdh_generic,nvidia
video                  77824  3 xe,i915,nvidia_modeset
</pre>Grub right now is 'normal'  <pre>
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
</pre>The NVIDIA persistence daemon is running <pre>
systemctl list-units --type service --all | grep nvidia
  nvidia-persistenced.service                          loaded    active    running      NVIDIA Persistence Daemon
</pre>[[DKMS|dkms]] shows that kernel modules are installed for two kernels<pre>
dkms status
nvidia/575.57.08, 6.8.0-60-generic, x86_64: installed (Original modules exist)
nvidia/575.57.08, 6.8.0-62-generic, x86_64: installed (Original modules exist)
</pre>


== GUI is stuck ==
== GUI is stuck ==
Line 186: Line 227:
=== Module Signing ===
=== Module Signing ===
On systems with Secure Boot enabled (mine), you most likely need to sign the module. See [https://download.nvidia.com/XFree86/Linux-x86_64/570.153.02/README/installdriver.html#modulesigning Signing NVIDIA Kernel Module]. However, I didn't get an explicit message that signing was a problem; and I did see that the installation process signs the module with a generated key. I assume that the MOK process hooks into the trust system somehow.
On systems with Secure Boot enabled (mine), you most likely need to sign the module. See [https://download.nvidia.com/XFree86/Linux-x86_64/570.153.02/README/installdriver.html#modulesigning Signing NVIDIA Kernel Module]. However, I didn't get an explicit message that signing was a problem; and I did see that the installation process signs the module with a generated key. I assume that the MOK process hooks into the trust system somehow.
When troubleshooting keeps turning up mysteries, you have to check your assumptions.<syntaxhighlight lang="text">
sudo modprobe nvidia
modprobe: ERROR: could not insert 'nvidia': Key was rejected by service
</syntaxhighlight>See [[Nvidia on Ubuntu/Kernel modules|Kernel modules]]


== Tools and Troubleshooting ==
== Tools and Troubleshooting ==
Line 208: Line 254:
As a regular user, my DE is KDE Plasma (using Kubuntu) rather than the GNOME default of Ubuntu
As a regular user, my DE is KDE Plasma (using Kubuntu) rather than the GNOME default of Ubuntu


=== See Also ===
{{Subpages|}}
{{#subpages:}}
 


{{References}}
{{References}}