NVIDIA Drivers – Fix Xserver Not Starting in Ubuntu 15.10 After Playing with NVIDIA Drivers

driversgraphicsnvidianvidia-geforcexorg.conf

I am kinda new to linux when it comes to debugging,

I do understand this might just be another repetition, but I've tried out almost every probable solutions out there for a month now, hence new question.

I have ASUS Q550LF with Windows 10 and Ubuntu 15.10 dual boot with integrated Intel HD graphics and Nvidia Geforce [GT 745M] 2GB dedicated graphics.

It all started when I tried installing nvidia drivers from there website and uninstalled nouveau drivers.

So current problem is whenever I boot into Ubuntu, the error comes system is running on low graphics mode. xorg log shows following error

[    51.287] 
X.Org X Server 1.17.2
Release Date: 2015-06-16
[    51.288] X Protocol Version 11, Revision 0
[    51.288] Build Operating System: Linux 3.13.0-68-generic x86_64 Ubuntu
[    51.288] Current Operating System: Linux jitesh 4.3.0-040300-generic #201511020949 SMP Mon Nov 2 14:50:44 UTC 2015 x86_64
[    51.288] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.3.0-040300-generic root=UUID=69910f62-d547-4968-868d-382bd929acff ro quiet splash vt.handoff=7
[    51.288] Build Date: 12 November 2015  05:33:29PM
[    51.288] xorg-server 2:1.17.2-1ubuntu9.1 (For technical support please see http://www.ubuntu.com/support) 
[    51.288] Current version of pixman: 0.32.6
[    51.288]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[    51.288] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    51.288] (==) Log file: "/var/log/Xorg.0.log", Time: Thu Feb 25 08:01:58 2016
[    51.288] (==) Using config file: "/etc/X11/xorg.conf"
[    51.288] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    51.289] Data incomplete in file /etc/X11/xorg.conf
    Undefined Screen "nvidia" referenced by ServerLayout "layout".
[    51.289] (EE) Problem parsing the config file
[    51.289] (EE) Error parsing the config file
[    51.290] (EE) 
Fatal server error:
[    51.290] (EE) no screens found(EE) 
[    51.290] (EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
[    51.290] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[    51.290] (EE) 
[    51.290] (EE) Server terminated with error (1). Closing log file.

As I see it, my xorg.conf file is being rewritten on every boot, and the rewritten file looks like below:

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

I've tried installing, reinstalling, uninstalling nvidia drivers and xserver-xorg, but nothing seems to work.

after installing nvidia-current or bumblebee-nvidia , xconfig sometimes gives error on being able to connect to server saya xorg-xserver is not found in pkg path.

When I try deleting xorg.conf, nvidia-xconfig does creates new xorg.conf, which looks like

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 304.131  (buildmeister@swio-display-x64-rhel04-16)  Sun Nov  8 22:48:17 PST 2015

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 "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

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

But it's again rewritten to the earlier one with incomplete data.
I tried completely removing nvidia drivers and using default drivers by installing xserver-xorg and other stuff again and again and reinstalling ubuntu-desktop, but nothing seems to work.

I also changed my display manager from lightdm to gdm, but no effect.

Ctrl+Al+f7 always goes into black screen once the lightdm is restarted from tty1

Any help or a pointer will be really useful.

Best Answer

I just knew about this, but hopefully.. it can help.

http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu/pool/main/p/prime-indicator/

Prime-Indicator helps you to easily switch from INTEL to NVIDIA or vise versa.

Also, try using nvidia-355 + nvidia-prime these works best.

sudo apt-get purge nvida-*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-355 nvidia-prime
sudo service lightdm restart

If your VCARD is not well compatible with nvidia-355, try the lower version.

Another thing, nvidia is sometimes painful for dual-boot (randomly freezes), you might want to add this line to your GRUB (/etc/default/grub)

nouveau.modeset=0

then reload the grub configuration

sudo update-grub