Nvidia on Ubuntu/commands: Difference between revisions

From Freephile Wiki
add nomodeset
add more
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
;[[wp:Mode setting|Mode setting]] e.g. <code>nomodeset</code>:
;[[Mode setting]]: is a description of the display capabilities of your graphics hardware.
:Linux kernels since 2012 have moved the video "mode setting" into the kernel. Programming of the hardware specific clock rates and registers on the video card happen in the kernel rather than in the X driver when the X server starts. This makes it possible to have high resolution, nice looking splash (boot) screens and flicker free transitions from boot splash to login screen. Unfortunately, on some cards this doesnt work properly and you end up with a black screen. Adding the <code>nomodeset</code> parameter instructs the kernel to not load video drivers and use BIOS modes instead until X is loaded.
;[[DKMS]]: stands for Dynamic Kernel Module Support
: https://forums.developer.nvidia.com/t/understanding-nvidia-drm-modeset-1-nvidia-linux-driver-modesetting/204068
;<code>dpkg</code>: for [[packages]] ([https://man7.org/linux/man-pages/man1/dpkg.1.html dpkg manual])
: [https://wiki.archlinux.org/title/Kernel_mode_setting|Kernel mode setting] (arch linux wiki)
: [[wp:Direct Rendering Manager#Kernel mode setting]] Note that DRM in this context is Direct Rendering Manager




<syntaxhighlight lang="bash">#!/bin/bash
CLI commands used while installing / removing the NVIDIA driver version 570 on a Debian-based system.
# some CLI commands used while installing / removing the NVIDIA driver version 570 on a Debian-based system.
This is not a "script" to be run, it's just a collection of helpful commands as a reference.
# most commands should be executed as root
'''most commands should be executed as root'''


<syntaxhighlight lang="bash">
# RTFM
# RTFM
# less /usr/share/doc/nvidia-driver-570/README.txt.gz
less /usr/share/doc/nvidia-driver-570/README.txt.gz


# Is nouveau installed?
apt policy xserver-xorg-video-nouveau


# switch to root user
# switch to root user
Line 18: Line 19:


# echo "Disabling nouveau driver"
# echo "Disabling nouveau driver"
# bash -c "echo 'blacklist nouveau' >> /etc/modprobe.d/disable-nouveau.conf"
bash -c "echo 'blacklist nouveau' >> /etc/modprobe.d/disable-nouveau.conf"
# bash -c "echo 'options nouveau modeset=0' >> /etc/modprobe.d/disable-nouveau.conf"
bash -c "echo 'options nouveau modeset=0' >> /etc/modprobe.d/disable-nouveau.conf"
# update-initramfs -u
update-initramfs -u -k all




Line 31: Line 32:
# what certificates are installed?
# what certificates are installed?
mokutil --list-enrolled
mokutil --list-enrolled
# what is configured?
grep mok_signing_key /etc/dkms/framework.conf
# is that one enrolled?
mokutil --test-key /var/lib/shim-signed/mok/MOK.der


# Are there any dynamic kernel module support (dkms) packages installed?
# Are there any dynamic kernel module support (dkms) packages installed?
Line 44: Line 51:
# any nvidia packages installed?
# any nvidia packages installed?
dpkg -l | grep -i nvidia
dpkg -l | grep -i nvidia
# Are development headers installed for any/all kernels that DKMS would build for?
dpkg -l |grep headers


# NVIDIA System Management Interface
# NVIDIA System Management Interface
Line 69: Line 78:
# apt-get remove -y --purge '*570*'
# apt-get remove -y --purge '*570*'
# apt -y autoremove
# apt -y autoremove
apt-get remove -y --purge '^libnvidia-.*' && apt-get remove -y --purge '^nvidia-*' && apt-get remove -y --purge '*570*' && apt -y autoremove
## reboot
# you need to do this a lot
shutdown -r now
# enroll a new MOK
update-secureboot-policy --enroll-key
# change something in grub menu
vim /etc/default/grub
# generate the grub config file /boot/grub/grub.cfg
update-grub
# Ubuntu's debug tool
ubuntu-drivers debug
# NVIDIA's debug tool
nvidia-bug-report.sh
</syntaxhighlight>


# # reboot
# shutdown -r now</syntaxhighlight>
[[Category:System Administration]]
[[Category:System Administration]]
[[Category:Linux]]
[[Category:Kernel]]
[[Category:Graphics]]

Latest revision as of 09:17, 3 July 2025

Mode setting
is a description of the display capabilities of your graphics hardware.
DKMS
stands for Dynamic Kernel Module Support
dpkg
for packages (dpkg manual)


CLI commands used while installing / removing the NVIDIA driver version 570 on a Debian-based system. This is not a "script" to be run, it's just a collection of helpful commands as a reference. most commands should be executed as root

# RTFM
less /usr/share/doc/nvidia-driver-570/README.txt.gz

# Is nouveau installed?
apt policy xserver-xorg-video-nouveau

# switch to root user
sudo su -

# echo "Disabling nouveau driver"
bash -c "echo 'blacklist nouveau' >> /etc/modprobe.d/disable-nouveau.conf"
bash -c "echo 'options nouveau modeset=0' >> /etc/modprobe.d/disable-nouveau.conf"
update-initramfs -u -k all


# what is the current kernel version?
uname -r

# is secure boot enabled?
mokutil --sb-state

# what certificates are installed?
mokutil --list-enrolled

# what is configured?
grep mok_signing_key /etc/dkms/framework.conf
# is that one enrolled?
mokutil --test-key /var/lib/shim-signed/mok/MOK.der


# Are there any dynamic kernel module support (dkms) packages installed?
dkms status

# what nvidia hardware do I have?
lspci | grep -i nvidia
# show a tree in both numeric and text format
lspci -nntv

# any nvidia modules loaded?
lsmod | grep -i nvidia
# any nvidia packages installed?
dpkg -l | grep -i nvidia
# Are development headers installed for any/all kernels that DKMS would build for?
dpkg -l |grep headers

# NVIDIA System Management Interface
nvidia-smi

# If you have the cuda compiler (cuda-toolkit) installed, check its version
nvcc -V

# Are there any nvidia services running?
systemctl list-units --type=service --all | grep nvidia 

# What version of xrandr is installed?
# xrandr is a command-line interface to the X11 Resize and Rotate extension (RandR).
# It is used to set the size, orientation and/or reflection of the outputs for a
# screen. It can also set the screen size and provide information about the outputs
# and their capabilities.
xrandr --version
# xrandr program version       1.5.2
# Server reports RandR version 1.6


# remove everything nvidia
# apt-get remove -y --purge '^libnvidia-.*'
# apt-get remove -y --purge '^nvidia-.*'
# apt-get remove -y --purge '*570*'
# apt -y autoremove
apt-get remove -y --purge '^libnvidia-.*' && apt-get remove -y --purge '^nvidia-*' && apt-get remove -y --purge '*570*' && apt -y autoremove

## reboot
# you need to do this a lot
shutdown -r now

# enroll a new MOK
update-secureboot-policy --enroll-key


# change something in grub menu
vim /etc/default/grub
# generate the grub config file /boot/grub/grub.cfg 
update-grub

# Ubuntu's debug tool
ubuntu-drivers debug
# NVIDIA's debug tool
nvidia-bug-report.sh