Learning one day at a time, living one day at a time, and sharing one day at a time.
As a machine learning developer, you’l often find yourself installing programs and applications developed by others. Sometimes if you aren’t careful, they’re changes can overwrite files used by you. This leads to situations like the one I faced recently. A unamed program borked my desktop so bad that i needed to reinstall the drivers for my gpu without having ready access to the internet. So this guide is a way to have this information handy.
Ensure your system is up-to-date (even offline) to avoid compatibility issues:
sudo apt update && sudo apt upgrade -y
(Optional) If you need additional system updates, you can download the necessary package files (.deb) on another machine and manually transfer them.
Create a configuration file to disable the Nouveau driver:
sudo nano /etc/modprobe.d/blacklist-nouveau.conf
Add the following lines:
blacklist nouveau
options nouveau modeset=0
Regenerate the kernel initramfs:
sudo update-initramfs -u
Reboot the machine:
sudo reboot
NVIDIA drivers require some build tools to compile kernel modules. Install them using:
sudo apt install build-essential gcc make dkms -y
If offline, download the .deb packages for these dependencies from a system with internet access and install them using dpkg:
sudo dpkg -i /path/to/package.deb
Navigate to the directory where the driver file is stored:
cd /path/to/driver
Make the downloaded driver file executable:
chmod +x NVIDIA-Linux-x86_64-<version>.run
Run the installer:
sudo ./NVIDIA-Linux-x86_64-<version>.run # Sub in your version!
Replace <version> with the specific driver version you downloaded (e.g., NVIDIA-Linux-x86_64-470.141.03.run).
Once the installation is complete, reboot the system:
sudo reboot
After rebooting, check if the NVIDIA driver is installed and functioning correctly:
nvidia-smi
This command should display information about your NVIDIA GPU, including the driver version.
dpkg -i to install missing dependencies manually.