Can't save nvidia settings for screens after reboot

Solution 1:

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 "Keyboard" => "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

Solution 2:

This worked for me on Ubuntu 17.04:

  1. sudo nvidia-settings and change whatever settings you want,
  2. save nvidia xorg configuration in /etc/X11/xorg.conf
  3. go to ubuntu Settings -> Displays and click the Apply button (if the button is disabled, try to do some dummy modifications).

Number 3 may sound really silly, but that was what saved me.

Solution 3:

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.