If you manually install your Nvidia drivers- be they beta or stable releases – you’ll probably have noticed that you need to manually reinstall them every time you receive a kernel update via update manager.
Thankfully you can solve this annoyance with a simple script that automates the process of rebuilding your driver for a newer kernel. As such when a new kernel is released, your graphics driver updates too and you need to do next to nothing to benefit!
Preparation
Kudos must first go to Ubuntuforums member sdennie who wrote the original guide from which I’m writing this.
Firstly this will only work for people who have manually download and installed their Nvidia drivers. If you’ve used EnvyNG or synaptic – this won’t work.
It also requires you to have successfully installed your driver prior to this; if you installed it and it works then you’re good to go; you can safely use this script from now on to take the hassle out of kernel updates.
- Nvidia Linux Download Site
Let’s Go!
First you’re going to need to get a copy of the driver you’re currently using from the Nvidia site. Save it to your home folder.
Move
Now we’re going to move it and make a symlink to it. This is simply for ease of use if you change driver at some point.
- sudo mv nvidia-driver-name-here.run /usr/src
- sudo mv nvdrivers_2.3_linux_64_190.29.run /usr/src/
- sudo ln -s /usr/src/nvidia-driver-name.run /usr/src/nvidia-driver
- sudo ln -s /usr/src/nvdrivers_2.3_linux_64_190.29.run /usr/src/nvidia-driver
The Script
- sudo mkdir -p /etc/kernel/postinst.d
- sudo install update-nvidia /etc/kernel/postinst.d