Featured image of post Nvidia on Linux

Nvidia on Linux

Nvidia Graphics Setup on Debian SID with Secure Boot

Note: I don’t use NVIDIA anymore so this update will probably be the last one I make to this post.

Nvidia Drivers Installation

First check the specific steps for your Debian version in the official documentation.

Add Required Repositories

Edit your /etc/apt/sources.list to include contrib non-free non-free-firmware components:

1
2
# Example for Debian Sid
deb http://deb.debian.org/debian/ sid main contrib non-free non-free-firmware

Install Nvidia Drivers

Update packages and install the necessary components:

1
2
3
sudo apt update
sudo apt install linux-headers-amd64
sudo apt install nvidia-driver firmware-misc-nonfree

Secure Boot Configuration

If you have Secure Boot enabled, you’ll need to enroll the MOK (Machine Owner Key):

1
sudo mokutil --import /var/lib/dkms/mok.pub  # Prompts for one-time password

After rebooting:

  1. The MOK manager will appear
  2. Select “Enroll MOK”
  3. Confirm the key enrollment using your one-time password

Verify the MOK was loaded correctly:

1
sudo mokutil --test-key /var/lib/shim-signed/mok/MOK.der

Expected output:

1
/var/lib/shim-signed/mok/MOK.der is already enrolled

Verify Installation

After completing the driver installation (and rebooting if you enrolled MOK keys), verify that the Nvidia drivers are working correctly with:

1
nvidia-smi

NVIDIA Management

Cooler management

For managing Nvidia GPU coolers, I use NVML-GPU-Control which is a simple Python script that allows you to control the GPU fans with a curve.

You can install it with:

1
sudo pipx install --global caioh-nvml-gpu-control

and then run it with:

1
sudo chnvml fan-control -n 'NVIDIA GeForce RTX 3070' -sp '10:35,20:50,30:50,35:100'

Also I put it on my crontab to run at boot:

1
@reboot /usr/local/bin/chnvml fan-control -n 'NVIDIA GeForce RTX 3070' -sp '10:35,20:50,30:50,35:100'

Official cooler management

As an alternative, you can use the official Nvidia settings tool for fan control. It just sets the fan speed to 50% on boot, which is not ideal for cooling but works if you don’t want to use a custom script. Add this to root’s crontab (sudo crontab -e):

1
@reboot nvidia-settings -V -c :0 -a '[gpu:0]/GPUFanControlState=1' -a '[fan:0]/GPUTargetFanSpeed=50' -a '[fan:1]/GPUTargetFanSpeed=50'

Undervolting Nvidia GPU

Undervolting (reducing power consumption) your GPU can provide several benefits reducing the maximum voltage while maintaining stable performance. This can lead to:

  • Lower temperatures - Reduced power consumption means less heat generation
  • Quieter operation - Lower temps allow fans to run slower and quieter
  • Extended GPU lifespan - Cooler operation reduces thermal stress on components
  • Energy savings - Lower power consumption reduces electricity costs
  • Better performance stability - Prevents thermal throttling during heavy loads

Power limiting is a simple form of undervolting that caps the maximum power draw without complex voltage adjustments.

The simplest approach is using crontab. Add this to root’s crontab (sudo crontab -e):

1
@reboot /usr/bin/nvidia-smi --persistence-mode=1 && /usr/bin/nvidia-smi --power-limit=125

Note: Replace 125 with your desired power limit in watts. Check your GPU’s maximum power limit with nvidia-smi -q -d POWER before setting a value.

Using systemd service (alternative)

For users who prefer systemd services, create a service to manage power limits:

1
sudo nvim /etc/systemd/system/nvidia-powerlimit.service

Add this content:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[Unit]
Description=Set Nvidia power limit

[Service]
Type=oneshot
ExecStartPre=/usr/bin/nvidia-smi --persistence-mode=1
ExecStart=/usr/bin/nvidia-smi --power-limit=125
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Enable the service:

1
2
3
sudo chmod 644 /etc/systemd/system/nvidia-powerlimit.service
sudo systemctl daemon-reload
sudo systemctl enable nvidia-powerlimit.service

GUI Controllers

I can recommend these two GUI tools for managing Nvidia GPUs:

  • LACT Originally designed for AMD GPUs, but it also supports Nvidia cards now. It has GPU info, overclocking, and fan control features. You can see the hardware compatibility list here.

  • Also can try TuxClocker, for almost the same functionality. I prefer LACT because it has more features and is actively developed but TuxClocker is also a good option.

Troubleshooting

Failed to Start Nvidia Persistence Daemon

If you encounter issues with the persistence daemon:

1
2
sudo apt purge nvidia-*
sudo apt install nvidia-kernels-dkms

Then repeat the driver installation steps from the beginning.

Licensed under CC BY-NC-SA 4.0
Last updated on Nov 04, 2025 03:05 UTC