Skip to content

Instantly share code, notes, and snippets.

@wellington1993
Last active August 15, 2017 03:07
Show Gist options
  • Save wellington1993/da8b51cae81a05156746bbc8e8304ec6 to your computer and use it in GitHub Desktop.
Save wellington1993/da8b51cae81a05156746bbc8e8304ec6 to your computer and use it in GitHub Desktop.
Mint Nvidia Reinstall after update
#!/bin/bash
#NVIDIA VERSION
#Get version here first
# apt install nvidia-persistenced
export VERSION="367";
echo "Kernel dependencies"
sudo apt autoremove;
sudo apt install -y build-essential linux-source g++ g++-5 libstdc++-5-dev; #linux-headers ;
sudo apt install -y libncurses-dev ncurses-dev kernel-package;
sudo apt install -y g++-5-multilib gcc-5-doc libstdc++6-5-dbg libstdc++-5-doc libncurses-dev ncurses-dev kernel-package;
sudo apt install -y docbook-utils kernel-common gcc-multilib libmail-sendmail-perl dblatex fop dbtoepub docbook-xsl-doc-html docbook-xsl-doc-pdf docbook-xsl-doc-text docbook-xsl-saxon fop libsaxon-java libxalan2-java libxslthl-java xalan lib32stdc++6-5-dbg libx32stdc++6-5-dbg ncurses-doc libmail-box-perl w3m lynx-cur links xmltex;
echo " The kernel..."
sudo apt install -y linux-headers-`uname -r` linux-source-`uname -r |cut -d- -f1`;
echo "Purge"
sudo apt autoremove;
sudo nvidia-settings --uninstall;
sudo apt remove -y --purge nvidia*;
sudo apt remove -y --purge xserver-xorg-video-nouveau xserver-xorg-video-nv;
sudo apt remove -y --purge nvidia*;
sudo apt remove -y --purge bumblebee;
echo "Install"
sudo apt install -y nvidia-common;
sudo apt install -y xserver-xorg-video-nouveau;
sudo apt install -y --reinstall libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core;
sudo dpkg-reconfigure xserver-xorg;
echo "Instal hardcore Nvidia"
sudo apt install -y nvidia-$VERSION*;
sudo apt install -y nvidia-persistenced;
echo "Force kernel recompile"
sudo apt remove -y --purge bumblebee;
sudo apt install -y bumblebee* bumblebee-nvidia* primus*;
echo "Important: Use this kernel"
locate nvidia |grep ".ko" |tail -n1
# TIP!!! Create only nvidia link for each nvidia_$VERSION? files in kernel folder (ln -s ...)
#Reboot
#Check after reboot
export VERSION="367"
cat /var/log/Xorg.0.log | egrep -i "nvidia|nouveau"
sudo /sbin/lsmod | grep nvidia;
sudo depmod -a;
sudo modprobe nvidia_$VERSION;
lspci -nn | grep VGA;
lspci -k | grep -A 2 -i "VGA"
@wellington1993
Copy link
Author

wellington1993 commented Aug 15, 2017

Kernel 4.12.0-11 is just an example. As root:

If:
modprobe: FATAL: Module nvidia_367 not found in directory /lib/modules/4.12.0-11-generic

Do:
locate nvidia |grep ".ko" |tail -n1
Use returned path to create the link

ls /lib/modules/4.12.0-11-generic/
cd /lib/modules/4.12.0-11-generic/
for x in $(find /lib/modules/4.12.0-11-generic/updates/dkms/ -name "*.ko"); do ln -s $x ; done
for x in $(ls *.ko |cut -d\. -f1); do echo modprobe $x ;done

reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment