Skip to content

Instantly share code, notes, and snippets.

@Jiab77
Last active February 28, 2024 00:28
Show Gist options
  • Save Jiab77/d3344422ee6d334f284425b558dc572c to your computer and use it in GitHub Desktop.
Save Jiab77/d3344422ee6d334f284425b558dc572c to your computer and use it in GitHub Desktop.
nVidia drivers installation on ElementaryOS - Loki (ubuntu 16.04 based distrib)

nVidia drivers installation on ElementaryOS - Loki

Introduction

ElementaryOS - Loki is an amazing ubuntu based distribution, I've just felt in love on it BUT they've removed what's required to install easily the nVidia Proprietary drivers. So here is the reason of this gist, to store the install instructions in one place inside a crystal clear documentation.

Check your device

Open your favorite terminal application then type sudo ubuntu-drivers devices, you should get something like this:

== /sys/devices/pci0000:00/0000:00:03.0/0000:01:00.0 ==
modalias : pci:v000010DEd000011C6sv00001043sd0000842Abc03sc00i00
model    : GK106 [GeForce GTX 650 Ti]
vendor   : NVIDIA Corporation
driver   : nvidia-304 - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin
driver   : nvidia-340 - distro non-free
driver   : nvidia-367 - distro non-free recommended

== cpu-microcode.py ==
driver   : intel-microcode - distro non-free

In my case, I want to install this one:

driver   : nvidia-367 - distro non-free recommended

Via GUI

Install the required dependencies for the GUI

As I said in the introduction, ElementaryOS - Loki is not shipped with the required GUI to install the nVidia Proprietary drivers, so you'll have to install the required dependencies. Just proceed as follow:

sudo apt install software-properties-gtk software-properties-common

Once finished, go to your applications menu then search additional drivers (add should be enougth to find the application). Run it and select the version you want.

Instructions and screenshots comes from elementaryOS forums.

Via Terminal

Auto Install

If you want things to be done and don't want to know what's going on, simply type:

sudo ubuntu-drivers autoinstall

Use it with caution:

This will install nVidia drivers but also, all others detected proprietary drivers !! If you want a closer control, read the manual install instructions. In my case, I don't wan't to install intel-microcode driver as it has screwed up many of my Ubuntu and Ubuntu based distrib like Linux Mint 18 - Sarah - Cinnamon...

So I'll use the manual install.

When done, go to the Avoid Boot Issues section.

Manual Install

Get the package name

Now, what I need to know is the package name of the nVidia driver. To do so, just type:

sudo ubuntu-drivers list

You should get something like this:

nvidia-304
nvidia-340
intel-microcode
nvidia-367

Install the package

Once you've decide the package version you want to install, just do it so:

sudo apt install nvidia-367 nvidia-settings

In my case, I wanted to install the version 367 of the nVidia driver.

Avoid boot issues...

As read in comments, you should do this only if you have boot issues after the driver installation. don't change anything if the reboot works normally

But if you got boot issues, these instructions might help you:

Once you've finished the installation, you should apply these changes to your grub config to avoid graphical issues that comes with the use of nVidia Proprietary Driver apply this to fix the issues you are encountering:

sudo nano /etc/default/grub

Naviguate in the file to find a line starting with menuentry 'elementary' then below a line like this one:

linux	/vmlinuz-4.4.0-62-generic root=/dev/mapper/elementary--vg-root ro  quiet splash

Change it to:

linux	/vmlinuz-4.4.0-62-generic root=/dev/mapper/elementary--vg-root ro  quiet nomodeset

Please, don't copy the line, you may not have the same kernel version on your machine!

Just change the boot flags at the end of the line as explained and that's all ^^

Save your file with Ctrl+x then update the bootloader:

sudo update-grub

Don't forget to reboot to complete the installation !

sudo reboot

So easy ! 😁

Feel free to comment if you want to contribute to this gist.

Thank you.

@Epemaster
Copy link

Thanks!

@fernand-o
Copy link

Thanks a lot!

@njaustin123
Copy link

I installed version 387 with the GUI method for my MX150 and added nomodeset with grub update as mentioned. But after selecting Elementary in grub, it just hangs on a black screen with blinking cursor. Any help? I am not an expert in elementary or Ubuntu.

@njaustin123
Copy link

I was able to fix it with the help of a somebody from reddit; installed nVidia drivers from the AppCenter and it worked fine without anything like nomodeset.

@moodysalem
Copy link

I'm using the 390.25 driver from the nvidia website and I can't get it to boot, with or without nomodeset. I'm also not even really sure how to uninstall a manually installed driver. Any ideas?

@LucKy-4-U
Copy link

after running "sudo ubuntu-drivers devices", I only see one driver. which is, Intel-Microcode - distro free
does that mean I already have nvidia driver installed maybe?

@nimishchaudhari
Copy link

Thank you!! ^___^

@Jiab77
Copy link
Author

Jiab77 commented May 14, 2018

Thank you all for your comments!

@njaustin123, the nomodeset flag is required only if you have trouble to boot after the installation. Maybe I was not clear enougth...

@moodysalem, You might try to remove or searching by sudo apt remove --purge nvidia* or apt-cache search nvidia | sort.

@LucKy-4-U, I'm sorry I had to switch to ubuntu-budgie because I needed OpenCL and VA-API on my Intel NUC which was not available under ElementaryOS so I can't check on my side to help you.

@evsrt
Copy link

evsrt commented Oct 4, 2019

thanks!

@miniferretti
Copy link

Many thanks !

@ilyavoronin
Copy link

adding nomodeset didn't work for me, but this steps helped:

  1. delete /etc/X11/xorg.conf
  2. run sudo update-initramfs -u
  3. reboot

more details in this answer

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