OOps. Something went wrong and the system can't recover

I’m getting the above message after instaling any version of the nvidia driver - both when trying to install the driver manually and through apt-get install nvidia-kernel-dkms.

I’m on a laptop which has 2 video cards - the only way to run a GUI is by blacklisting the nouveau driver and let the kernel choose my second (Intel) GPU.

My GPUs from lspci:
0:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)

Here’s the log from Xorg.0. Please note that I’m on an ultra hd laptop

96.943] (II) modeset(0): EDID vendor “SDC”, prod id 49999
[ 96.943] (II) modeset(0): Printing DDC gathered Modelines:
[ 96.943] (II) modeset(0): Modeline "3840x2160"x0.0 524.40 3840 3888 3920 4000 2160 2162 2168 2185 +hsync -vsync (131.1 kHz eP)
[ 96.943] (II) modeset(0): Modeline "3840x2160"x0.0 524.40 3840 3888 3920 4320 2160 2162 2168 2529 +hsync -vsync (121.4 kHz e)
[ 128.210] (II) modeset(0): EDID vendor “SDC”, prod id 49999
[ 128.210] (II) modeset(0): Printing DDC gathered Modelines:
[ 128.210] (II) modeset(0): Modeline "3840x2160"x0.0 524.40 3840 3888 3920 4000 2160 2162 2168 2185 +hsync -vsync (131.1 kHz eP)
[ 128.210] (II) modeset(0): Modeline "3840x2160"x0.0 524.40 3840 3888 3920 4320 2160 2162 2168 2529 +hsync -vsync (121.4 kHz e)
[ 407.549] () Option “fd” “34”
[ 529.862] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is tagged by udev as: Touchscreen
[ 529.863] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is a touch device
[ 2136.352] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is tagged by udev as: Touchscreen
[ 2136.352] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is a touch device
[ 2163.365] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is tagged by udev as: Touchscreen
[ 2163.365] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is a touch device
[ 2277.340] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is tagged by udev as: Touchscreen
[ 2277.340] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is a touch device
[ 2394.426] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is tagged by udev as: Touchscreen
[ 2394.426] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is a touch device
[ 2881.858] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is tagged by udev as: Touchscreen
[ 2881.858] (II) input device ‘G2Touch Multi-Touch by G2TSP’, /dev/input/event14 is a touch device
[ 5434.911] (
) Option “fd” “24”
[ 5434.911] () Option “fd” “27”
[ 5434.911] (
) Option “fd” “28”
[ 5434.911] () Option “fd” “29”
[ 5434.911] (
) Option “fd” “30”
[ 5434.911] () Option “fd” “31”
[ 5434.911] (
) Option “fd” “32”
[ 5434.911] () Option “fd” “33”
[ 5434.911] (
) Option “fd” “35”
[ 5434.911] () Option “fd” “36”
[ 5434.911] (
) Option “fd” “37”
[ 5434.911] () Option “fd” “38”
[ 5434.911] (
) Option “fd” “39”
[ 5434.911] () Option “fd” “32”
[ 5434.911] (
) Option “fd” “33”
[ 5434.912] (II) UnloadModule: “libinput”
[ 5434.912] (II) systemd-logind: releasing fd for 13:78
[ 5434.992] (II) UnloadModule: “libinput”
[ 5434.992] (II) systemd-logind: not releasing fd for 13:67, still in use
[ 5434.992] (II) UnloadModule: “libinput”
[ 5434.992] (II) systemd-logind: not releasing fd for 13:66, still in use
[ 5434.992] (II) UnloadModule: “libinput”
[ 5434.992] (II) systemd-logind: releasing fd for 13:69
[ 5435.024] (II) UnloadModule: “libinput”
[ 5435.024] (II) systemd-logind: releasing fd for 13:77
[ 5435.048] (II) UnloadModule: “libinput”
[ 5435.048] (II) systemd-logind: releasing fd for 13:68
[ 5435.100] (II) UnloadModule: “libinput”
[ 5435.615] (II) systemd-logind: releasing fd for 13:64
[ 5435.720] (II) UnloadModule: “libinput”
[ 5435.720] (II) systemd-logind: releasing fd for 13:79
[ 5435.788] (II) UnloadModule: “libinput”
[ 5435.788] (II) systemd-logind: releasing fd for 13:67
[ 5435.848] (II) UnloadModule: “libinput”
[ 5435.848] (II) systemd-logind: releasing fd for 13:66
[ 5435.900] (II) UnloadModule: “libinput”
[ 5435.900] (II) systemd-logind: releasing fd for 13:65
[ 5435.932] (II) UnloadModule: “libinput”
[ 5435.932] (II) systemd-logind: releasing fd for 13:70
[ 5435.948] (II) UnloadModule: “libinput”
[ 5435.948] (II) systemd-logind: releasing fd for 13:71
[ 5435.968] (II) UnloadModule: “libinput”
[ 5435.968] (II) systemd-logind: releasing fd for 13:76
[ 5435.984] (II) UnloadModule: “libinput”
[ 5435.984] (II) systemd-logind: releasing fd for 13:75
[ 5436.000] (II) UnloadModule: “libinput”
[ 5436.000] (II) systemd-logind: releasing fd for 13:73
[ 5436.346] (WW) xf86CloseConsole: KDSETMODE failed: Input/output error
[ 5436.346] (WW) xf86CloseConsole: VT_GETMODE failed: Input/output error
[ 5436.346] (WW) xf86CloseConsole: VT_ACTIVATE failed: Input/output error
[ 5437.402] (II) Server terminated successfully (0). Closing log file.

and then gdm spits out the message from the subject (graphically). I reviewed tons of threads regarding this issue and couldn’t find a solution. Is there a workaround? Seems like many people with dual GPU graphics are having this issue.

already tried the patches provided on this thread → https://devtalk.nvidia.com/default/topic/982052/linux/-latest-nvidia-driver-340-101-builds-compiles-properly-but-fails-to-load-has-errors-with-linux-kernels-4-9-0-4-9-7-resolved-with-patch-/

You will have to setup PRIME:
[url]PRIME and PRIME Synchronization - Linux - NVIDIA Developer Forums
[url]http://us.download.nvidia.com/XFree86/Linux-x86_64/370.23/README/randr14.html[/url]
[url]NVIDIA Optimus - ArchWiki
Other than that, what distro?
Always run nvidia-bug-report.sh and attach output.

generix, thank you for paying attention to this issue.

I’m running Kali (Debian-based)

4.9.0-kali1-amd64 #1 SMP Debian 4.9.6-3kali2 (2017-01-30) x86_64 GNU/Linux

I also tried installing bumblebee from its repositories, its a thing meant to do what you described automatically - didn’t work either. I will check out the links you provided tomorrow.

Well, got it to work (technically), but not as expected. Now I’m writing this from a Gnome GUI with a 640x480 resolution without the option to change it.

My xorg.conf:

Section “ServerLayout”
Identifier “Layout0”
Screen 0 “Screen0”
InputDevice “Keyboard0” “CoreKeyboard”
InputDevice “Mouse0” “CorePointer”
EndSection

Section “Files”
EndSection

Section “InputDevice”

# generated from default
Identifier     "Mouse0"
Driver         "mouse"
Option         "Protocol" "auto"
Option         "Device" "/dev/psaux"
Option         "Emulate3Buttons" "no"
Option         "ZAxisMapping" "4 5"

EndSection

Section “InputDevice”

# generated from default
Identifier     "Keyboard0"
Driver         "kbd"

EndSection

Section “Monitor”
Identifier “Monitor0”
VendorName “Unknown”
ModelName “Unknown”
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option “DPMS”
EndSection

Section “Module”
Load “modesetting”
EndSection

Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce GTX 960M”
BusID “PCI:2:0:0”
Option “AllowEmptyInitialConfiguration”
EndSection

Section “Screen”
Identifier “Screen0”
Device “Device0”
Monitor “Monitor0”
DefaultDepth 24
SubSection “Display”
Depth 24
EndSubSection
EndSection

xrandr providers:
xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x1e0 cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x44 cap: 0x2, Sink Output crtcs: 3 outputs: 2 associated providers: 1 name:modesetting

lsmod | grep nvidia
nvidia_drm 45056 4
nvidia_modeset 790528 8 nvidia_drm
nvidia 12144640 147 nvidia_modeset
drm_kms_helper 155648 2 i915,nvidia_drm
drm 360448 8 i915,nvidia_drm,drm_kms_helper

Output from xrandr

xrandr

Screen 0: minimum 8 x 8, current 640 x 480, maximum 16384 x 16384
eDP-1-1 connected primary 640x480+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
640x480 59.94*
320x240 60.05
HDMI-1-1 disconnected (normal left inverted right x axis y axis)

SOLVED ! After putting the second configuration for older xorg servers from Chapter 32. Offloading Graphics Display with RandR 1.4

X started smoothly at a nice Ultra HD Resolution. Please note that most important thing through the whole journey was to put the correct BusID in the driver section exlicitly in xorg.conf

Steps to fix the Ooops. Something went wrong and the system can’t recover issue

  1. Install the appropriate nvidia linux driver from nvidia
  2. Put the appropriate autostart entries for your Display Manager, as descripted on the archlinux nvidia optimus wiki tutorial: NVIDIA Optimus - ArchWiki

In my case, for GDM
cat >> /usr/share/gdm/greeter/autostart/optimus.desktop

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c “xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto”
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
:ctrl+c

  1. Put the SECOND configuration from the above url in xorg.conf
    *** Please note that you have to point to the correct BusID in the driver section.
    One way to find the correct BusID for your card in the format as the x server expects it is by typing

nvidia-xconfig --query-gpu-info

You may also use lspci | grep “3D”. Please note the lspci format of the BusID differs from the above. For more information refer to Chapter 7. Frequently Asked Questions

  1. Reboot

In case you get any kind of screen flickering, gdm session loop or x is unable to start for some reason make sure you have set the correct BusID as explained in Section 3.

The BusID of the device must be provided, otherwise X will fail to start.

Thanks to generix,
After trying to figure this out for about 2 weeks already I’m glad that I’m now on a nice ultra HD resolution using both of my GPUs.

So now you can find out how to setup PRIME sync to get rid of tearing. Ha!
Hints: you need a xserver-1.19 and nvidia-drm.modeset=1
The xorg.conf for ‘older’ xservers is always the right one.
Edit: if you have problems with e.g. wine you can add to the ‘Screen’ section
SubSection “Display”
Virtual 1920 1080
EndSubSection
with your monitor resolution instead of 1920 1080

Will have this in mind, thanks. X server version is: X Server 1.19.1
Where should nvidia-drm.modeset=1 be put? Could you elaborate on this one?

Either nvidia-drm.modeset=1 to kernel command line, i.e. grub config
or a .conf file in /etc/modprobe.d containing options nvidia-drm modeset=1

Thanks

I just made an automatic bash script to automatize the whole procedure of setting up nvidia-prime on dual-gpu systems:

Has to be run after the driver bundle has been installed. Should work on all Display managers (tested with GDM and lightdm)

[url]http://bugfixes.promisedev.com/download/nvidia_prime/nvidia_prime.tar.gz[/url]

Please note that after the last debian updates you will also have to copy the optimus.desktop file to your ~/.config/autostart directory as the gnome session reinitializes the x server after the login screen and xrandr needs to be re-run.

cp /usr/share/gdm/greeter/autostart/optimus.desktop ~/.config/autostart

The required change has already been applied to the nvprime script provided above.