Nvidia drivers on Linux Mint 17.2

Hello everybody, I come here begging for help after trying everything I could think of. My problem is simple: I have a dual monitor setup (laptop + external monitor) and I would like to install nvidia drivers to make use of my GeForce GTX 950M. I have added the PPA graphics-drivers and the easy solution would be

sudo apt-get install nvidia-378 nvidia-settings
sudo reboot

At the moment, this leaves me with a black screen after the grub. It’s a known problem, so I tried the usual solutions: logging in a console session and running

sudo nvidia-xconfig
sudo reboot

or also adding nomodeset to the GRUB parameters. Everything with no success at all: either the screen remains black or cinnamon crashes just after logging in (and only the external monitor works in this case).
I have also tried installing older versions of the drivers, using the driver manager, etc. but could not make it work. At some point (and honestly I don’t know how) I had managed to install the nvidia 378 drivers but the external monitor was not working: the image was completely distorted and frozen.
Can someone help me out with this? I believe it should not be too complicated but, for some reason, I can’t seem to be able to figure this out.

Here is some information about my system. Please ask if you need more:

~ > uname -r
3.19.0-80-generic
~ > 
~ > inxi -Gx
Graphics:  Card: Intel 4th Gen Core Processor Integrated Graphics Controller bus-ID: 00:02.0 
           X.Org: 1.15.1 drivers: intel (unloaded: fbdev,vesa) FAILED: nouveau Resolution: 1920x1080@60.0hz, 1600x900@60.0hz 
           GLX Renderer: Mesa DRI Intel Haswell Mobile GLX Version: 3.0 Mesa 11.0.1 Direct Rendering: Yes
~ > 
~ > dpkg -l | grep -i nvidia   
~ > 
~ > dpkg -l | grep -i nouveau
ii  libdrm-nouveau2:amd64                                       2.4.67-1ubuntu0.14.04.1                                amd64        Userspace interface to nouveau-specific kernel DRM services -- runtime
ii  libdrm-nouveau2:i386                                        2.4.67-1ubuntu0.14.04.1                                i386         Userspace interface to nouveau-specific kernel DRM services -- runtime
ii  xserver-xorg-video-nouveau                                  1:1.0.11+git20141030.3fb97d78-0ubuntu0sarvatt~trusty2  amd64        X.Org X server -- Nouveau display driver
~ > 
~ > lsmod | grep -i nvidia                             
~ > 
~ > lsmod | grep -i nouveau
nouveau              1368064  1 
mxm_wmi                16384  1 nouveau
ttm                    94208  1 nouveau
i2c_algo_bit           16384  2 i915,nouveau
drm_kms_helper        131072  2 i915,nouveau
drm                   344064  8 ttm,i915,drm_kms_helper,nouveau
video                  20480  3 i915,nouveau,asus_wmi
wmi                    20480  3 mxm_wmi,nouveau,asus_wmi

I will also add other details that could be interesting: I was trying to hack my way into a working configuration and I typed the command

prime-switch

Here is the output:

Warning: writing to /var/log/gpu-manager.log failed (Permission denied)
log_file: /var/log/gpu-manager.log
last_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
new_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
can't access /run/u-d-c-fglrx-was-loaded file
Looking for fglrx modules in /lib/modules/3.19.0-80-generic/updates/dkms
Looking for nvidia modules in /lib/modules/3.19.0-80-generic/updates/dkms
Is nvidia loaded? yes
Was nvidia unloaded? no
Is nvidia blacklisted? no
Is fglrx loaded? no
Was fglrx unloaded? no
Is fglrx blacklisted? no
Is intel loaded? yes
Is radeon loaded? no
Is radeon blacklisted? no
Is amdgpu loaded? no
Is amdgpu blacklisted? no
Is nouveau loaded? no
Is nouveau blacklisted? yes
Is fglrx kernel module available? no
Is nvidia kernel module available? no
Detected LTS < 14.04.5. Forcing Intel/SNA
Vendor/Device Id: 8086:416
BusID "PCI:0@0:2:0"
Is boot vga? yes
Vendor/Device Id: 10de:139a
BusID "PCI:1@0:0:0"
Is boot vga? no
Skipping "/dev/dri/card1", driven by "nvidia-drm"
Skipping "/dev/dri/card0", driven by "i915"
Skipping "/dev/dri/card1", driven by "nvidia-drm"
Skipping "/dev/dri/card0", driven by "i915"
Skipping "/dev/dri/card1", driven by "nvidia-drm"
Skipping "/dev/dri/card0", driven by "i915"
Skipping "/dev/dri/card1", driven by "nvidia-drm"
Found "/dev/dri/card0", driven by "i915"
output 0:
	card0-HDMI-A-2
output 1:
	card0-eDP-1
Number of connected outputs for /dev/dri/card0: 2
Does it require offloading? yes
last cards number = 2
I couldn't open /var/lib/ubuntu-drivers-common/last_gfx_boot for writing.
Error: can't write to /var/lib/ubuntu-drivers-common/last_gfx_boot

So it seems it somehow recognises both screens, but then I can’t manage to make the system work with the nvidia drivers installed.
Thanks for the help!

More details (I keep them coming :D)

I tried updating to a new kernel:

~ > uname -r 
4.4.0-72-generic

Then I installed nvidia drivers:

sudo apt-get install nvidia-378 nvidia-settings

At reboot, the screen was completely black but typing my password blindfolded and hitting Enter did produce some activity on the disk, so I guess the problem is “just” the display part. Then I rebooted and added nomodeset to GRUB parameters: the login screen appeared only on the external monitor but cinnamon failed to start after logging in, while the built-in display remained completely black.

I grabbed the opportunity for generating a bug report, which is attached to this message.

In the end, I logged in via console, purged both nvidia packages and restarted, and now everything works again, but with nouveau drivers.
nvidia-bug-report.log.gz (129 KB)

Important update: I managed to install the nvidia 378 driver but this broke my dual monitor setup.
First, I used the command

sudo apt-get install nvidia-378 nvidia-settings nvidia-prime nvidia-prime-applet bumblebee bumblebee-nvidia

and rebooted. Now this is the situation:

~ > uname -r
4.4.0-72-generic
~ >
~ > inxi -Gx
Graphics:  Card: Intel 4th Gen Core Processor Integrated Graphics Controller bus-ID: 00:02.0 
           X.Org: 1.15.1 driver: nvidia Resolution: 1920x1080@60.0hz, 1920x1080@60.0hz 
           GLX Renderer: GeForce GTX 950M/PCIe/SSE2 GLX Version: 4.5.0 NVIDIA 378.13 Direct Rendering: Yes
~ > 
~ > glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 950M/PCIe/SSE2
OpenGL core profile version string: 4.3.0 NVIDIA 378.13
OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5.0 NVIDIA 378.13
OpenGL shading language version string: 4.50 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
~ > 
~ > lsmod | grep -i nvidia
nvidia_drm             53248  5 
nvidia_modeset        806912  3 nvidia_drm
nvidia              12271616  59 nvidia_modeset
drm_kms_helper        151552  2 i915,nvidia_drm
drm                   360448  6 i915,drm_kms_helper,nvidia_drm
~ > 
~ > dpkg -l | grep -i nvidia 
ii  bbswitch-dkms                                               0.7-2ubuntu1                                           amd64        Interface for toggling the power on nVidia Optimus video cards
ii  bumblebee                                                   3.2.1-9~gpu14.04.1                                     amd64        NVIDIA Optimus support for Linux
ii  bumblebee-nvidia                                            3.2.1-9~gpu14.04.1                                     amd64        NVIDIA Optimus support using the proprietary NVIDIA driver
ii  nvidia-378                                                  378.13-0ubuntu0~gpu14.04.3                             amd64        NVIDIA binary driver - version 378.13
ii  nvidia-prime                                                0.6.2.1linuxmint1                                      amd64        Tools to enable NVIDIA's Prime
ii  nvidia-prime-applet                                         1.0.3                                                  all          An applet for NVIDIA Prime
ii  nvidia-settings                                             346.72-0ubuntu1                                        amd64        Tool for configuring the NVIDIA graphics driver

So the driver seems to work perfectly well. But now if I go to Nvidia X server settings > X server display configuration, I see one big screen, instead of two separate monitors. Also, the image on the external monitor is completely wrong and frozen.
Here is my xorg.conf file:

/etc/X11 > less xorg.conf
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0@0:2:0"
    Option "AccelMethod" "None"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1@0:0:0"
    Option "ConstrainCursor" "off"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "on"
    Option "IgnoreDisplayDevices" "CRT"
EndSection

Does someone have any idea? I feel the solution might be close… :)

There are two linux drivers for nvidia, one is called nouveau and other is nvidias official binary blob and two ways offloading (optimus) is done: DRI_PRIME and bumblebee.

You have to make a conscious choice between them and setup stuff accordingly, from random stuff you posted it seems that at various times (specifically 2 hour intervals) you tried using random variations of both drivers (nvidia, nouveau) and offloading options (DRI_PRIME, bumblebee). More than likely leaving your system inconsistent state and definitely leaving your posts here inconsistent with each other.

I’m happy that I’m not payed to do support on this forum because you, sir, are a nightmare of anyone who deals with support issue tracker.

Hi tpruzina,

Leaving aside the nightmares, I tried many combinations because

  1. I was trying to make my system work and, above all,
  2. I have the time and the curiosity to experiment

That being said, please find attached the report produced with nvidia-bug-report.sh
I will no longer touch the system because, at least, I have nvidia drivers working on one screen. The other, for the moment, is just attracting dust on my desk. :)
nvidia-bug-report.log.gz (147 KB)

Also bumblebee uses client side model, e.g. it will only offload single GL application (client) via fake xorg-server, that’s why you can’t use nvidia-settings with it (“one big screen problem”), if you want your whole desktop to run off nvidia then you need to take a look at DRI_PRIME/randr offloading options.

Undo all the crap you did so far - notably bbswitch (which comes with bumblebee) will break non-bumblebee setups and so will random xorg.conf files and nouveau driver loaded prior to nvidia driver.

Supporting a “moving target” bug is pretty hard, even if somebody responds to your post, by that time this response might not even be valid. Most QA/support people intentionally delay their responses just to save them work if user a) fixes his/hers problem b) introduces a new one, or dozen more.

I perfectly understand what you say. In fact, from now on, I will stop making experiments and wait for competent help. You can consider my situation as stable.

I am totally happy to follow your advice, but would you mind guiding me along the way? For the “Undo all the crap”-part, I guess I can just do something like

sudo apt-get purge nvidia* bumblebee* bbswitch*
sudo reboot

But then I do not know how to configure things in the right way. On my way here, I read (and learnt) many new things about this topic but sadly I still miss a working solution.

And finally, let me say I really do appreciate you taking time to answer my questions.

UP

Does anyone know of a solution for this issue? I have also tried nvidia-381 but the result is always the same: I cannot use the external monitor. I have discovered that my HDMI port is connected to the intel card (and not the nvidia one): is there a way I can use it anyway with the nvidia drivers?

I don’t really know what you achieved to this point but your final goal will be to configure your laptop for PRIME:
https://devtalk.nvidia.com/default/topic/957814/linux/prime-and-prime-synchronization/
https://devtalk.nvidia.com/default/topic/957814/linux/prime-and-prime-synchronization/post/5122543/#5122543

But
for multi-monitor prime you have a showstopper right now, you’re runnnig an old xserver (1.15). From my experience, this doesn’t work, you have to have at least xserver 1.17.4. So your first task is to upgrade your distro.

@generix Thank you for your comment: this explains a lot of things! In fact I am able to configure everything correctly on the built-in monitor, but I cannot make the external monitor work. So for the moment I think I’ll keep using nouveau (which makes both monitors work perfectly) and, when I will have a bit more time, I will update the distro entirely.