How do I update my nvidia modules after updating my kernel?

For me dpkg-reconfigure rebuilds the Nvidia driver with the latest kernel. This then requires a reboot to take effect. My example below uses the older nvidia-304-updates.

sudo dpkg-reconfigure nvidia-304-updates

EDIT: I managed to automate this by writing a script zz-dkpg-reconfigure-nvidia that runs after kernel updates

#!/bin/bash
#
# Reconfigure nvidia driver

DRIVER=nvidia-304-updates

dpkg-reconfigure $DRIVER > /var/log/dpkg-reconfigure-nvidia.log 2>&1

exit 0

I installed the above script by running

sudo install zz-dkpg-reconfigure-nvidia /etc/kernel/postinst.d

Works on my Ubuntu 14.04 kernel 3.13.0-29 to 3.13.0-36 update.


If you have installed the NVIDIA driver as an ubuntu package, it should be updated automatically after each kernel upgrade.

You can install the packaged driver using the Additional Drivers tool in the dashboard, or installing the package nvidia-current.

If you have installed the nvidia driver directly from their website it is probably sensible to remove it before installing this package - I'm not certain how good it will be at detecting the conflict.

If you have installed the package from the ubuntu repositories, you can try reconfiguring it with dpkg-reconfigure but I suspect building the nvidia module is triggered by installing a new kernel, and I'm not sure how to trigger this otherwise. The traditional uninstall and re-install might well work (sudo apt-get remove nvidia-current; sudo apt-get install nvidia-current).


When you have installed the NVIDIA binary driver, you probably haven't installed the dkms package. Dkms makes sure that every time you update kernel, modules which support it are recompiled:

sudo apt-get install dkms

You would probably need to re-install the NVIDIA binary drivers afterwards, and allow to use DKMS during the setup as it needs to be registered with it.