I had a very similar problem and spent several days trying to get my card working.
I have an ASUS X550LN which has an Intel Graphics Driver on the CPU and a dedicated NVIDIA GEFORCE GT 840M.
First, installing the nvidia-340 drivers would cause Unity and Gnome to fail when launching. I could drop to a shell Ctrl + Alt + F1
and remove the driver sudo apt-get remove nvidia*
to get things back to running solely on the Intel Graphics Driver.
After some research, I discovered that having both these interfaces made the system an NVIDIA Optimus (which is actually good just not well supported on Linux yet). Luckily, there is a project called Bumblebee which will help. More info here: https://wiki.ubuntu.com/Bumblebee
Here is what finally worked for me:
Install bumbleebee
- Add bumblebee repository:
add-apt-repository ppa:bumblebee/stable
- Update repository information:
apt-get update
- Install packages:
apt-get install bumblebee bumblebee-nvidia virtualgl linux-headers-generic
- Reboot
For me, at this point bumblebee was installed but the nvidia-304
package was installed as this is what is installed with nvidia-current
. Looking online I found that I needed Driver 337+. At the time of writing this, the best driver for me was nvidia-340
. This however is not in the default repo so you will need to add another one.
Install correct nvidia driver
- Add xorg-edgers repository:
add-apt-repository ppa:xorg-edgers/ppa
- Update repository information:
apt-get update
- Install nvidia-xxx drivers (for 840m it was nvidia-340):
apt-get install nvidia-xxx
For me I got an error message the first time I ran apt-get install nvidia-xxx
. However, simply running it again worked fine. I'm not 100% sure what happened.
Configure bumblebee to use latest driver
- Using your favorite text editor open
/etc/bumblebee/bumblebee.conf
- Find the line starting with
Driver
and change it to Driver=nvidia
- Find the line starting with
KernelDriver
and change it to KernelDriver=nvidia-xxx
- Find the line starting with
LibraryPath
and change it to LibraryPath=/usr/lib/nvidia-xxx:/usr/lib32/nvidia-xxx
- Find the line starting with
XorgModulePath
and change it to XorgModulePath=/usr/lib/nvidia-xxx/xorg,/usr/lib/xorg/modules
Basically, replace all of the nvidia bits with the nvidia driver you installed in step 2.
- Reboot
After rebooting, hopefully you are able to access Unity, Gnome, or whatever display manager you're using.
- Test that everything is working
- First test without using NVIDIA card:
glxspheres
- Second test with NVIDIA card:
optirun glxspheres
I hope this works for the next person!
I was having the same problem, this worked for me after a lot of struggle and research, restart ubuntu and at login screen press ctrl+alt+F1 and login using your account this will take you to a terminal
First, remove all the nvidia packages by:
sudo apt-get purge nvidia-*
sudo reboot
Again press ctrl+alt+F1 at login screen
Then, Install nvidia packages by:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo ubuntu-drivers autoinstall
sudo reboot
Next, time you boot you will get a black screen instead of login most probably if not you are done.
If you get a black screen, press ctrl+alt+F1 again and do the following:
cd /etc/X11
check whether there's a file of xorg.conf by:
ls | grep xorg.conf
It should be xorg.conf and not xorg.conf.*
If not present do the following:
sudo nvidia-xconfig
Now edit the file as follows:
sudo nano xorg.conf
Under the Section Device, Identifier intel change Driver from "intel" to "modesetting"
i.e: from
Driver "intel"
to
Driver "modesetting"
Now save the file and exit nano and do the following.
sudo chattr +i xorg.conf
sudo reboot
I hope this solves your problem, if there are any queries let my know. Thank You!
These links helped in the answers:
- Idea of changing driver to modesetting from intel
2.Modern way to install nvidia drivers
Best Answer
Uninstall the NVIDIA proprietary graphics driver. Find the file you used to install the NVIDIA graphics driver from the NVIDIA website. It's in whatever folder you downloaded it to (your Downloads folder, for example). It should be named something like NVIDIA-Linux-x86_64-340.58.run. If so, the command to uninstall it is:
If the NVIDIA-Linux-x86-XXX.XX.run file has a different name or location, then change the name and/or location in the above command. The name and location of the .run file in the above command have to match exactly to the name and location of the .run file that is in your computer.
Run the following command to identify the recommended NVIDIA proprietary graphics driver:
Install the recommended NVIDIA proprietary graphics driver and reboot.
NVIDIA Prime is a way of adding hybrid graphics support to your laptop. NVIDIA Prime allows the user to switch between NVIDIA (Performance Mode) and Intel (Power Saving Mode) graphics from the NVIDIA Settings utility.
If your computer has an NVIDIA 319 or more recent graphics driver installed, run the following command to install NVIDIA Prime packages:
Then NVIDIA Prime can be enabled/disabled from the NVIDIA X Server Settings application.