37

I am running a GeForce GTX 770 on a Z87 Gigabyte mobo and dual-boot Windows 8.1 Pro and Ubuntu 12.04.3 LTS. The setup runs smoothly overall except for when it comes to video and 3D performance in Ubuntu. I had the infamous flickering issue at one point and found a way to fix it. It has to do with the NVidia card going into low-power mode and then videos and 3D effects suffer from tearing and stuttering. The fix is to go to nvidia-settings and change the power-mode from 'Auto' to 'Prefer Maximum Performance'. The problem is this only works until I reboot. After the reboot the setting is cleared and the problems still persist, so I have to manually set it again for the current session. I tried gksu-ing and setting it, but it didn't work. I tried to edit the etc/X11/xorg.conf, but it's empty - there are zero lines in that file... I read all the related articles, but mainly people complain about brightness being reset or dual-monitor configs, which solutions involve some specific app that doesn't help me in any way.

TL;DR: NVidia settings are reset after reboot and tried everything I could find on the Internet to no good.

If someone knows what to do in this situation, please share!

Thank you!

EDIT [1]: I did some further digging and it seems there is no obvious or safe solution. Some people have tried to set the performance level manually, but report it's unsafe and may kill the GPU. There is still hope though. I think this could be done through the NVidia profiles option provided from nvidia-settings. The problem is that one needs to know the key in question and the value this key accepts.

I could have put a screenshot here, but I need rep => 10...

I couldn't find a list of the possible keys nor any key values... No luck I guess.

Can someone provide a link or list some useful ones?

Thanks!

EDIT [2]: Finally! Thanks to everybody for the help! I found the solution with the help of vegard torvund and this thread. And thanks to the Ubuntu Google+ Community for spreading the word!

kgizdov
  • 540
  • Hopefully I can help a few people in 2020 and onward: I had the issue where changes in the Nvidia X Server program did not get persisted, but I found out changes made in the standard Settings program were persisted. Just make them there.

    [Somehow the 'primary screen' setting also appears to be persisted, though I don't know how. I needed the proprietary driver to get dual 4K monitors working on my MSI GeForce GTX 1050 2G on Ubuntu 18.04.4, Nouveau would screw up as soon as two monitors were connected]

    – jack Mar 17 '20 at 19:31

12 Answers12

22
  1. Create a xorg.conf file by:

    sudo nvidia-xconfig
    
  2. Look for the Section "Device" part in the xorg.conf file And add this line inside the section:

    Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x3322"
    

Save and reboot your machine.

PS. If you add more parameters, add ; after 0x3322

ubuntico
  • 2,802
  • 1
    Thanks! That works, but only with a few adjustments to Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x3322; PowerMizerDefault=0x2; PowerMizerDefaultAC=0x2" found here – kgizdov Dec 03 '13 at 17:23
  • running sudo nvidia-xconfig does not open any file and gives me this error: Using X configuration file: "/etc/X11/xorg.conf". Backed up file '/etc/X11/xorg.conf' as '/etc/X11/xorg.conf.backup' New X configuration file written to '/etc/X11/xorg.conf' – Alex Jones Mar 22 '15 at 11:21
  • 1
    @edwardtorvalds This only saves things to xorg.cong I think. You still have to do sudo gedit /etc/X11/xorg.conf and add the line provided – ubuntico May 11 '15 at 17:13
  • @kgizdov The line provided helped in my case. Did not have to add anything extra. – ubuntico May 11 '15 at 17:14
  • @ubuntico I have two device sections (one for intel and one for nvidia) where to put the code? – Alex Jones May 11 '15 at 17:22
  • @edwardtorvalds Hmm I have only one. I guess you have onboard graphic card. I would put it on nvidia section and reboot the device. In case you end up with a message that something's wrong with xorg.cong file, simply mv /etc/X11/xorg.conf.backup /etc/X11/xorg.conf and start all over. This means that you wrongly entered Option line in the file – ubuntico May 11 '15 at 17:28
  • @ubuntico I am already using nvidia graphics as default – Alex Jones May 11 '15 at 17:36
  • @edwardtorvalds Then simply add to nvidia section. – ubuntico May 11 '15 at 18:11
  • 1
    You will also need to change monitor setup in Display part of Ubuntu http://askubuntu.com/a/377169/13207 – ubuntico Nov 02 '15 at 10:45
  • unfortunately in ubuntu18.04 this does not work any more. The driver simply ignore the xorg.conf it had generated again. I think ubuntu people did some bad thing there. Since on the same setup, the xserver setting persistent in F28 an Arch. I think ubuntu try to do something smarter but fucked up. – Wang Apr 14 '19 at 13:39
  • agreed with Wang, on 20.04 LTS it doesn't work either, even worse, the xorg.conf created as thorwald wrote does not switch to gdm and hangs. – Thomas Covenant Jan 02 '21 at 08:48
18

From the official user guide:

"4. Loading Settings Automatically

The NVIDIA X driver does not preserve values set with nvidia-settings
between runs of the X server (or even between logging in and logging
out of X, with xdm, gdm, or kdm).  This is intentional, because
different users may have different preferences, thus these settings
are stored on a per user basis in a configuration file stored in
the user's home directory.

The configuration file is named "~/.nvidia-settings-rc".  You can
specify a different configuration file name with the "--config"
commandline option.

After you have run nvidia-settings once and have generated a
configuration file, you can then run:

    nvidia-settings --load-config-only

at any time in the future to upload these settings to the X
server again.  For example, you might place the above command in
your ~/.xinitrc file so that your settings are applied automatically
when you log in to X.

Your .xinitrc file, which controls what X applications should
be started when you log into X (or startx), might look something
like this:

    nvidia-settings --load-config-only &
    xterm &
    evilwm

or:

    nvidia-settings --load-config-only &
    gnome-session

If you do not already have an ~/.xinitrc file, then chances are that
xinit is using a system-wide xinitrc file.  This system wide file
is typically here:

    /etc/X11/xinit/xinitrc

To use it, but also have nvidia-settings upload your settings,
you could create an ~/.xinitrc with the contents:

    nvidia-settings --load-config-only &
    . /etc/X11/xinit/xinitrc

System administrators may choose to place the nvidia-settings load
command directly in the system xinitrc script.

Please see the xinit(1) manpage for further details of configuring
your ~/.xinitrc file.

"

falconer
  • 15,026
  • 3
  • 48
  • 68
  • Figured as much, but I was looking to setup profiles in a config file. Anyway, I found a better solution. Thanks – kgizdov Dec 03 '13 at 17:18
  • So if I run nvidia-settings --load-coffig-only it will apply my xorg.conf? If that is the case where can I add that command to so it runs on start automatically? – Michael Paccione Jul 22 '20 at 18:05
  • You can add nvidia-settings --load-config-only to the Startup applications on your default DE (Gnome, lxqt, plasma, etc) to load the settings on login. This should be the accepter answer – Emilio Jan 21 '22 at 22:37
8

What you can do is create a script like the following and run it on startup.

#!/bin/bash
nvidia-settings --assign CurrentMetaMode=<display_settings>

You replace <display_settings> with your display-settings. The display-settings could look like this:

"DVI-D-0: nvidia-auto-select +0+0, DP-0.1: nvidia-auto-select +1920+0, DP-0.8: nvidia-auto-select +0+0, HDMI-0: nvidia-auto-select +1920+0" 

You get the display settings out of the 'X Configuration File'.

You can run it on startup via the program 'Startup Applications Preferences'.

You can launch 'Startup Applications Preferences' via gnome-session-properties in the terminal.

Ini
  • 430
6

I was able to solve this problem on my system:

  1. Navigate to "nvidia-settings Configuration" tab.
  2. Uncheck "Include X Display Names in the Config File"
  3. Save Current Configuration

It turns out the settings were getting loaded, but the display names (which looked right) were preventing them from being set. This was on a basic dual display system.


enter image description here

4

On Linux Mint 18 Cinnamon go to the little config app named monitors. When pressing "apply" a file ~/.config/monitors.xml is saved which serves the same purpose than the xfce displays.xml - it saves all those settings, that in nvidia settings are not persistent. You have to play around to change something (to trigger the availability of the apply button) if you happen to have configured your display layout in NVIDIA graphic settings panel. I did this AND added the load-settings from above to xinitrc.

I wil check if my window-reordering problem after the screen lock was active is gone now All windows reordered to main monitor

1

If your are running a Gnome desktop (and I assume al Gnome based). Looks like Gnome always tries to put their config on top of the nvidia settings. I've tried this: https://forums.developer.nvidia.com/t/persist-nvidia-x-server-settings/158102

Basically having the display resolution configured from the nvidia-setting are constantly overwritten by Gnome's own config.

Shei Pi
  • 11
1

The system doesn't rewrite parameters on reboot. In fact nvidia-settings is the one that does that. Open a Terminal and edit the "Exec=" line in nvidia-settings with this:

"optirun /usr/bin/nvidia-settings -c :8 --config=~/.nvidia-settings-rc"

without quotes if you use bumblebee, or if you don't, the command probably is:

"/usr/bin/nvidia-settings --config=~/.nvidia-settings-rc".

Also before saving your settings uncheck: "Include X Display Names in the Config File". The system holds your settings from one session to another but, in my case (Ubuntu Gnome 14.04.1 amd64) I have some errors about vdpau and prime. They may be normal considering that I don't use nvidia-prime. These errors could also make nvidia-settings to override the settings.

gman
  • 2,276
  • 4
  • 27
  • 39
0

You need to run nvidia-settings as superuser so that you have rights to save the config file.

opena terminal and type: sudo nvidia-settings make your changes and save the config this works for ubuntu 20.04

0

I'm using Ubuntu 12.04 and I was experimenting with my video card and to tell you the thing I had similar problem that you had or have after restart my nvidia settings couldn't be applied and actually my xorg.conf file was empty too! But all of this happened when I downgraded my nvidia drivers and so after all of this problems what I did is ran a simple command in Terminal:

sudo apt-get --reinstall nvidia-settings && sudo apt-get install nvidia-settings
gksudo nvidia-settings

Only what I won't tell you if I did reboot my system or not after reinstalling, just don't remember but after this procedure I got everything working fine. I could access my nvidia settings and apply any stuff there like maximizer and so on, it also replaced my xorg.conf file with complete lines due to my hardware, it even recreates it when it's deleted or lost. But all of this I did at my own risk, maybe it depends on ones hardware.

d a i s y
  • 5,511
-1

Alt+F2 and on the command type gksu nvidia-settings Save X Configuration /etc/X11/xorg.conf

Braiam
  • 67,791
  • 32
  • 179
  • 269
Kayman
  • 11
  • Tried this and doesn't work... Isn't Ctrl + Alt + T for a terminal? – kgizdov Nov 23 '13 at 00:42
  • 2
    Why the downvotes? This works. First you need to issue sudo nvidia-xconfig and then open nvidia-settings with sudo as well. Then set what you want, save to xorg. It WILL work. – Apache Dec 02 '13 at 07:45
  • 4
    Yes, but there is no mention of the command sudo nvidia-xconfig in his answer... – kgizdov Dec 03 '13 at 17:20
-1

I found a solution with Linux Mint 17.2; you have to edit the file /home/$user/.config/xfce4/xfce-perchannel-xml/displays.xml.

You will see your displays in it and there you can set the X and Y axis of them; simply adjust them and it will stay each time when you reboot.

kos
  • 35,891
-1

For linux mint 18.2 menu > administration > x server settings. Make all the changes you want. Then menu > preferences > display. Press APPLY button. It worked for me. ASUS F1A75 V-Pro with EVGA GeForce GTX 950.

Sam
  • 1