Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have two screens and sometimes I just want the 27" to display. So far I have tried to run the nvidia-settings as

sudo -s
nvidia-settings 

But every time I reboot I have to redo my preferences.. My laptop is asus g75vw nvidia driver version is: 331.38 Ubuntu 14.04

I have tried with new drivers, nothing changed exept now the standard settings make the screen duplicate...

Is there any alternative simple way I can set settings to persists after reboot?

the nvidia settings

The x configuratior file

   # nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 337.12  (buildd@charichuelo)  Wed Apr  9 12:25:02 UTC   
2014

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 331.38  (buildmeister@swio-display-x64-rhel04-15)  Wed 
Jan  8 19:53:14 PST 2014

Section "ServerLayout"
Identifier     "Layout0"
Screen      0  "Screen0" 0 0
InputDevice    "Keyboard0" "CoreKeyboard"
InputDevice    "Mouse0" "CorePointer"
Option         "Xinerama" "0"
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"

# HorizSync source: edid, VertRefresh source: edid
Identifier     "Monitor0"
VendorName     "Unknown"
ModelName      "Samsung S27C590"
HorizSync       30.0 - 81.0
VertRefresh     50.0 - 75.0
Option         "DPMS"
EndSection

Section "Device"
Identifier     "Device0"
Driver         "nvidia"
VendorName     "NVIDIA Corporation"
BoardName      "GeForce GTX 670M"
Option         "RegistryDwords" "PowerMizerEnable=0x1;  PerfLevelSrc=0x3322;    
PowerMizerDefault=0x2; PowerMizerDefaultAC=0x2"

EndSection

Section "Screen"
Identifier     "Screen0"
Device         "Device0"
Monitor        "Monitor0"
DefaultDepth    24
Option         "Stereo" "0"
Option         "nvidiaXineramaInfoOrder" "DFP-2"
Option         "metamodes" "HDMI-0: nvidia-auto-select +0+0"
Option         "SLI" "Off"
Option         "MultiGPU" "Off"
Option         "BaseMosaic" "off"
SubSection     "Display"
    Depth       24
EndSubSection
EndSection

Xrand gives me

    $ sudo xrandr
    Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 16384 x 16384
   VGA-0 disconnected (normal left inverted right x axis y axis)
   LVDS-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 382mm x 
   215mm
    1920x1080      60.0*+   40.0  
    DP-0 disconnected (normal left inverted right x axis y axis)

   HD MI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 
   598mm  
   x 336mm
   1920x1080      60.0*+   59.9     50.0  
   1680x1050      60.0  
   1600x900       60.0  
   1440x900       59.9  
   1280x1024      75.0     60.0  
   1280x800       59.8  
   1280x720       60.0     59.9     50.0  
   1152x864       75.0  
   1024x768       75.0     70.1     60.0  
   800x600        75.0     72.2     60.3     56.2  
   720x576        50.0  
   720x480        59.9  
   640x480        75.0     72.8     59.9  
   DP-1 disconnected (normal left inverted right x axis y axis)
share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted
+50

The simplest way is to run nvidia-settings as root:

sudo nvidia-settings

You will now be able to use the "Save to X Configuration File" button.

Alternatively, you can simply save the file generated as /etc/X11/xorg.conf but don't use the file in your question. That one is incomplete, presumably because you did not copy the entire thing.


It seems as though something is overwriting your xorg.conf file. As an (inelegant) workaround, you can use xrandr (without sudo) to activate/deactivate your screen:

  1. To deactivate the second screen and use only your primary monitor:

    xrandr --output LVDS-0 --off 
    
  2. To activate it:

    xrandr --output HDMI-0 --auto --primary --output LVDS-0 --mode 1920x1080 --right-of HDMI-0
    

    IMPORTANT: I'm not sure from your xrandr output if your screen's identifier is MI-0 or HD MI-0. I've never seen an identifier that includes a space which is why I used the former, but you might need to use xrandr --output "HD LVDS-0" --auto --right-of MI-0 instead.

If these commands successfully switch between your desired layouts (if not, let me know and we can tweak them), you can turn them into a simple script:

#!/usr/bin/env bash

if [[ $1 = "off" ]]; then
    xrandr --output LVDS-0 --off 
else
    xrandr --output HDMI-0 --auto --primary --output LVDS-0 --mode 1920x1080 --right-of HDMI-0
fi

Save that as switch_screens.sh and make it executable (chmod +x switch_screens.sh). You can now go into settings from the GUI, go to "Keyboards" => "Shortcuts" and create a custom shortcut for each command:

enter image description here

and for turning it off, set the Command to ~/switch_screens.sh off:

enter image description here

Choose whatever shortcut key combination you want and you can then activate/deactivate the screens at will.

You can also activate it directly from the terminal with:

~/switch_screens.sh

And deactivate it with

~/switch_screens.sh off
share|improve this answer
    
I have tried this, unfortunately it doesn’t work, when I restart always both screens are running.. –  54N1 May 2 at 12:24
    
@54N1 could you edit your question and show the settings that turn off the second monitor? Are you using "Resolution: Off"? WHere are you saving the xorg.conf file? Also, please add the output of xrandr with both screens on and I'll edit this to post a workaround using the xrandr command to activate or deactivate as needed. –  terdon May 2 at 12:27
    
I have done it now, thank you in advance.. –  54N1 May 2 at 12:49
1  
@54N1 see updated answer. –  terdon May 2 at 13:03
1  
@54N1 this will need some minor debugging. Can you come into this chat room? –  terdon May 2 at 13:10
show 2 more comments

When you click 'Save to X configuration file' does it give an error?

Do this:

Copy/paste the text from the generated X file to a file on your desktop named xorg.conf

Then in terminal, do:

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old
sudo mv /home/%user/Desktop/xorg.conf /etc/x11/xorg.conf

where %user is your user name.

If this breaks anything, drop to a TTY (by pressing CTRL+ALT+F1) and do:

sudo rm /etc/X11/xorg.conf
sudo cp /etc/X11/xorg.conf.old /etc/X11/xorg.conf

This will at least put you back to where you are now.

share|improve this answer
    
when I restart the computer the file on /etc/X11/xorg.conf is empty as a white sheet again...:( –  54N1 Apr 29 at 17:43
    
It could be a few different things then. I think sudo nvidia-xconfig could help, but I no longer use nVidia graphics so I can't test. You may also receive more help by looking here: askubuntu.com/questions/379483/nvidia-x-server-settings-lost-on-every-reboot –  lbaile200 Apr 29 at 17:50
    
Tried stuff on that link, but did not succeed. Tell me what to do, if it works I will give you 50credits lol :) –  54N1 May 1 at 8:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.