
There some video card and drivers available and you must know which one you can need to use:
- Nvidia Nouveau driver: it is the open source implementation of the Nvidia driver. It's not on par with the official drivers but the speed of development and advancements gives confidence that this is an option to have and promote. For every new release the drivers get better and better but the updates are available less frequently than a PPA
- Ubuntu Default Recommended Driver: Ubuntu does an amazing job of figuring out which Nvidia driver you need depending on the card you are using. But it's not up to date when compared with the official site or a PPA.
- Nvidia PPA driver: it offers some great Performances and works out of the box for most cards by using the driver included in the PPA. It also offers the latest driver hours/days after it's official release and the installation is either through terminal or GUI.
- Nvidia driver from official site: This is the official drivers such as the ones in the PPA but the difference is that they do not upgrade automatically and you can face some issues when updating, uninstalling and installing.
Detect nvidia graphic card model
It's important to detect the model of your Nvidia graphic card in order to install the required driver. To do that, there is a simple method in your terminal:
$ ubuntu-drivers devices == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == model : GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] vendor : NVIDIA Corporation modalias : pci:v000010DEd00001140sv0000103Csd000021BBbc03sc02i00 driver : nvidia-340 - distro non-free recommended driver : xserver-xorg-video-nouveau - distro free builtin
You can see the model of your Nvidia card and the recommended driver is nvidia-340.
Install the Nvidia driver using PPA
Now that you can which card to install, you can now install it through the PPA. First, if you have already installed an old Nvidia driver, remove it
# apt purge nvidia*
Now you can add the PPA on your Ubuntu 18.04, notice that adding a PPA on Ubuntu 18.04 doesn't require the update command as for the previous version. You will see some useful information
# add-apt-repository ppa:graphics-drivers/ppa Fresh drivers from upstream, currently shipping Nvidia. ## Current Status Current short-lived branch release: `nvidia-396` (396.24) Dropped support for Fermi series (https://nvidia.custhelp.com/app/answers/detail/a_id/4656) Current long-lived branch release: `nvidia-390` (390.48) Old long-lived branch release: `nvidia-384` (384.130) For G8x, G9x and GT2xx GPUs use `nvidia-340` (340.106) For NV4x and G7x GPUs use `nvidia-304` (304.137) End-Of-Life! ... ...
and now install the recommended driver
# apt install nvidia-340 Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: bbswitch-dkms gnome-screensaver indicator-session lib32gcc1 libaccount-plugin-1.0-0 libaccount-plugin-generic-oauth libaccount-plugin-google libc6-i386 libcgmanager0 libcuda1-340 libjansson4 libnih-dbus1 lightdm mountall nvidia-opencl-icd-340 nvidia-prime nvidia-settings ocl-icd-libopencl1 screen-resolution-extra signon-keyring-extension signon-plugin-oauth2 unity-control-center-signon unity-greeter upstart Suggested packages: bumblebee bindfs lightdm-remote-session-freerdp lightdm-remote-session-uccsconfigure remote-login-service graphviz upstart-monitor
Now you have the driver installed. You can see all the latest Nvidia drivers if you want to try installing manually.
Install and choose Nvidia driver for hybrid card
You can see computers which have two graphics cards: Intel and Nvidia. In this case, you install the two and switch to choose the one to use. NVIDIA Optimus is the codename for the dual graphics card split enjoyed by a wide variety of "gaming" laptops with "dedicated" graphics. To check if you have a hybrid card, you can use the command below:
lspci | egrep 'VGA|3D' 00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) 01:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] (rev a1)
You can see the Intel and Nvidia cards presents. To easily manage the two cards, you can install Nvidia-prime or Bumblebee. You should notice that when you have a hybrid card, even if you install the Nvidia driver, it's not the one that is used by your system, you need Nvidia-prime or Bumblebee to switch on Nvidia and use it by default. The Nvidia-prime and Bumblebee packages didn't work together. You need to choose one of the two:
- Nvidia-prime: it is NVIDIA's solution to implementing Optimus usability on Linux. That being said, NVIDIA Prime is closed-source. It also has an annoying tendency to drain laptop batteries, as the discrete card usually stays enabled due to the lack of per-application switching found on Windows.
# apt install nvidia-prime Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: bbswitch-dkms gnome-screensaver indicator-session libaccount-plugin-1.0-0 .........
It is able to decide on which card to use at profile level, i.e. when the user logs in. This decision is adjustable at NVIDIA X Server Settings control panel
- Bumblebee: it is the open-source software community attempted to fix this with the creation of the Bumblebee project. Instead of using the always-on or always-off mode of Prime, Bumblebee created a utility called
optirun
that allows you to specify whether a program should be loaded with the discrete graphics card or not.
# apt install bumblebee linux-headers-generic Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: bbswitch-dkms libbsd0:i386 libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libedit2:i386 libelf1:i386 libffi6:i386 libgl1-mesa-dri:i386 .............
Now to launch your application with Nvidia use the command as below
# optirun playonlinux
Read also :
How to Remove and Add PPA on Ubuntu 18.04
How to Install NVIDIA Drivers using Debian Repository
Now you know the different ways to install and use your Nvidia drivers on Ubuntu. The latest versions bring more fixes and correct issues related to graphics corruption, HDMI support, thermal support and more for the latest Nvidia cards. Normally, updating the video drivers solves many issues.
This does not work on 18.04. It used to work on 16.04 where you goto additional drivers and select the proprietary driver. Now all they have are the metadata drivers. I tried your tutorial and I still get GLX issues. I have GTX960M (optimus) and I also installed Prime. The nvidia-settings wont open, and I don't have glx working either.
The new 18.04 sucks and is super buggy and gives so many issues on the ASUS ROG laptops.
It works just fine on Ubuntu 18.04, what's the problem?
got the ppa and tried to install nvidia-304 (yes, ancient) but ...
The following packages have unmet dependencies:
nvidia-304 : Depends: xorg-video-abi-11 but it is not installable or
xorg-video-abi-12 but it is not installable or
xorg-video-abi-13 but it is not installable or
xorg-video-abi-14 but it is not installable or
xorg-video-abi-15 but it is not installable or
xorg-video-abi-18 but it is not installable or
xorg-video-abi-19 but it is not installable or
xorg-video-abi-20 but it is not installable or
xorg-video-abi-23
Depends: xserver-xorg-core but it is not going to be installed
Recommends: nvidia-settings (>= 331.20) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
oh boy, another mystery ...
Hi,
You can see the mention in the tutorial " For NV4x and G7x GPUs use `nvidia-304` (304.137) End-Of-Life! " which can help to understand why you probably have those dependencies errors.
please notice the end of life indicating that it is out of support
I had some issue when I was installing:
error: paste subprocess was killed by signal (Broken pipe)Errors were encountered while processing:/var/cache/apt/archives/xserver-xorg-video-nvidia-410_410.57-0ubuntu0~gpu18.04.1_amd64.deb
Well, if someone else is encountering this same issue, here is how to solve it:
(This issue happens because the algorithm can't overwrite some files/derectories)
run this on terminal as root:
sudo dpkg -i --force-overwrite /var/cache/apt/archives/
𝘵𝘩𝘦 .𝘥𝘦𝘣 𝘧𝘪𝘭𝘦𝘴 𝘵𝘩𝘦 𝘰𝘶𝘵𝘱𝘶𝘵 𝘴𝘢𝘺𝘴 (𝘪𝘯 𝘵𝘩𝘪𝘴 𝘥𝘪𝘳𝘳𝘦𝘵𝘰𝘳𝘺) 𝘪𝘴 𝘵𝘳𝘺𝘪𝘯𝘨 𝘵𝘰 𝘰𝘷𝘦𝘳𝘸𝘳𝘪𝘵𝘦)
after running the previous command, run this other one:
𝘴𝘶𝘥𝘰 𝘢𝘱𝘵 -𝘧 𝘪𝘯𝘴𝘵𝘢𝘭𝘭 -𝘺 && 𝘴𝘶𝘥𝘰 𝘢𝘱𝘵 𝘪𝘯𝘴𝘵𝘢𝘭𝘭 -𝘺 𝘯𝘷𝘪𝘥𝘪𝘢-𝘥𝘳𝘪𝘷𝘦𝘳-'𝘵𝘩𝘦_𝘥𝘳𝘪𝘷𝘦𝘳_𝘷𝘦𝘳𝘴𝘪𝘰𝘯_𝘺𝘰𝘶_𝘸𝘪𝘴𝘩_𝘵𝘰_𝘪𝘯𝘴𝘵𝘢𝘭𝘭'
This solved the problem (to me).
Well, guys, I've included a really simple workaround that works for machines, running a Quadro graphics card (like mine K2100M for example) .
Link to askubuntu: https://bit.ly/2QhBSb3
Thanks Jack
Thanks for this article. I had tried maybe a year ago to get Nvidia drivers to work on Ubuntu 18.04 & had failed back then. I can't remember what I tried back then but I was surprised at how easy it was with your instruction!
Hi Vance,
Glad to hear that installation for Nvidia drivers went pretty well on Ubuntu 18.04. Soon we will test on Ubuntu 20.04.