XServer fails to connect to screen after installing nvidia driver (Nvidia Optimus - GTX 675MX - UBUN

I am using Ubuntu GNOME 13.10 (development branch - I had the same problems with 13.04).
My laptop has a GT675MX.

When booting into Windows it works perfectly so I don’t think it’s a HW problem.

Description of Problem:

What I did
I installed nvidia-319 from the Ubuntu repositories.
I followed the instruction from http://us.download.nvidia.com/XFree86/Linux-x86/319.17/README/randr14.html
I set my xorg.conf file to http://www.mediafire.com/download/3n37jzoky0m38qs/xorg.conf
Instead of setting .xinitrc I set .xsessionrc as specified
And I rebooted

What happened
After the splash screen the screen goes blank.
Xserver did not crash, but did it did not connect to the screen and errors were reported
xrandr and glxinfo said that it can’t connect to screen

What I tried to fix it (and didn’t work)
I tried substituting modesetting with intel in .xsessionrc
I tried uncommenting the line that says you can uncomment (in xorg.cong)
I tried nvidia-prime (Started in 640x480 mode with lightm and a million and one crashes were report and it was unusable - I might be slightly exagerating, but there were a lot, most of them xorg related - it also has loads of dependencies like unity and lightdm that I don’t wan’t so I uninstalled it and ran ‘sudo apt-get autoremove’ to get rid of it’s dependencies)
I tried using nvidia-xconfig (Basicly just added keyboard and mouse settings to xorg.conf)
Tried various commands to start xserver (xinit startx , sudo service gdm start) non of which worked.

Logs I have collected
Xorg.0.log http://www.mediafire.com/download/s675nbokmq9batu/Xorg.0.log
nvidia-bug-report.log.gz http://www.mediafire.com/download/6eoevf3foi1ar39/nvidia-bug-report.log.gz

I am using kernel
Xrandr program version 1.4.0
pixman: 0.30.2
Xorg server version 1.14.3

I have a ROCCAT P502 4AB. http://www.roccat.org/Products/GAMING-NOTEBOOKS/ROCCAT-Gamerbook-Pro/
The specs differs slightly from that specified in the website. I have the i7-3630M instead of the i7-3610M and naturally I have the GTX 675MX instead of the GTX 675M.

Additional Info:
If I uninstall nvidia-319 and nvidia-settings-319 and remove xorg.conf then everything return to normal. If I reinstall it after that it goes haywire again.

If you require anymore information, additional logs or I left something out just ask.
nvidia-bug-report.log.gz (103 KB)
Xorg.0.log (31.8 KB)
xorg.conf.txt (666 Bytes)
xsession-errors.txt (15.4 KB)

Can you please attach these files to the post? mediafire.com is blocked here.


EDIT: I added Xorg.0.log and nvidia-bug-report.log.gz to the first post as attachments. I couldn’t add xorg.conf as is, because of the extension. So I just renamed it and attached it as xorg.conf.txt.

It looks like your X server is starting up okay, so your .xsessionrc commands to turn on the Intel display must not be working for some reason. Your X server looks like it’s new enough to contain this patch, which was going to be my first guess as to the problem. Do you have a log of the session messages (usually ~/.xsession-errors, but that is highly variable)? I wonder if one of the xrandr commands is failing. Also, can you try connecting via SSH and getting the output of “xrandr --verbose”?

What are the errors, exactly, that you refer to as, “it did not connect to the screen and errors were reported xrandr and glxinfo said that it can’t connect to screen”?

I still have the the .xsession-errors file. I’ll attach it to the first post.

I can’t risk “breaking” my system during the week as and I’ll get more logs/information during the weekend.

I got the logs/info using the tty console and if you run glxinfo and xrandr there regardless of what’s happening to the xserver it says can’t/unable to open display. (At least that what’s happening to me).

Thanks for the help so far.

I got it working (partialy).

The problem was that .xsessionrc was never run so it was never set up to use the display.

I just added those to lines to my gdm init script and viola, but now I have a different problem.

I’m not sure how to properly word this, but my buttons now look those from classic x (I’ll attach a screenshot). This isn’t strictly a nvidia error, but it came as a result from installing the driver (It wasn’t there before the driver was installed). If you can just point me in the direction where to look for the problem or where to ask for help if it isn’t covered by this forum.

The screenshot is just the preferences panel from the gnome-terminal.

EDIT: Now that I restarted my computer I also noticed that it takes a few minutes to get from where it does the xrandr calls to get to the gdm login prompt. (I can see when the calls are made since the screens light up - and it stays of if they aren’t there). I suspect it’s the xserver thats taking so long to start.