Nvidia configs overwritten on reboot

So this issue rather, bothers me where if I’ve configured in the

nvidia-settings

specific start up settings and config parameters it gets lost on reboot every time no matter what changes you have done and saved into the Xorg Conf file. I did my researched and it’s not always come up with answers that can fix this. But from what I’ve found is that upon every boot nvidia-settings overwrites the Xorg Conf file. Now some people have posted solutions on how to prevent it from being overwritten on boot, however those solutions don’t work at all.

From what I’ve read this too is also in the official documentation;

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.

While that may be true, not all setups have multiple user accounts on one system that have different desktop managers. My desktop manager is MDM, a modified version of GDM made for Linux Mint distro, therefore only 1 desktop manager is installed.

One user I read on a post somewhere suggested adding to the xinitrc file;

nvidia-settings --load-config-only

but this hasn’t worked for me. It looks like it either completely ignores it or it just overwrites the xorg.conf file anyway even if it was ran or not. I don’t know which of those might be true… but anyway, because my system is sorta running 2 different graphic setups Intel HD Graphics + Nvidia it does create some conflicts due to the limitation of X Server’s code not being readily supportive for dual-graphic card setups of different types running on one system.

a small snippet from my xorg.conf file of what I got for my Nvidia setup.

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option         "RegistryDwords" "PowerMizerEnable=0x1"
    Option         "RegistryDwords" "PerfLevelSrc=0x2222"
    Option         "RegistryDwords" "PowerMizerDefault=0x2"
    Option         "RegistryDwords" "PowerMizerDefaultAC=0x2"
EndSection

Those options I put in there was some things others have suggested to stop it from being overwritten, but again this doesn’t do any good which xorg.conf gets overwritten by nvidia-settings instead of just loading what’s already there.

The issue here is it’s not the fact that it’s being overwritten, but that it takes the xorg.conf that already exists and turns into a backup and writes a new xorg.conf file, and re-writes the settings nvidia-settings uses that were previously set. So if I set PowerMizer to Prefer Maximum Performance, and OpenGl Settings to High Performance, I lose these settings on reboot as a result and have to keep setting them again.

I do have my own .xinitrc file in my home directory too to try set them automatically on login, but these are completely ignored and so completely useless to me. I do hope that future development of X Server is better improved for dual-graphic card setups, and Nvidia decides to show some better support towards Linux so people know how to make them work more better and efficiently under Linux. I do happen to know a few who work on the unofficial drivers of nvidia drivers, much which has been reverse engineered to have decent usability for average Linux users, but far from perfect with the fancy tricks and gimmicks that are in the official drivers.

I’m not sure much half of the time that nvidia-settings do actually work or make much difference at all. But I do know that when the PowerMizer setting in particular isn’t running at it’s Max Performance level some applications fail to run properly, or just unexpectedly crash when it runs on Auto mode which sets it to lowest possible performance mode.

extra info:

Graphics:  Card-1: Intel 3rd Gen Core processor Graphics Controller bus-ID: 00:02.0
           Card-2: NVIDIA GF108M [GeForce GT 630M] bus-ID: 01:00.0
           Display Server: X.Org 1.18.4 driver: nvidia Resolution: 1366x768@60.03hz
           GLX Renderer: GeForce GT 630M/PCIe/SSE2 GLX Version: 4.5.0 NVIDIA 367.57 Direct Rendering: Yes

I need answers for this.

That “~/.xinitrc” file is only run by the “startx” command, meaning it’s only used if you boot to a text console and log in there, then start X from the command line manually. It’s not run if you use a display manager and boot to a graphical login screen.

You need to find out what your display manager is doing at login. For me here, I know it starts a script “~/.xprofile”. That’s where I put that “nvidia-settings --load-config-only” line. An example file would look like this:

#!/bin/sh
nvidia-settings --load-config-only

I guess the file has to be set executable.

Another thing are .desktop autostart files. Gnome and KDE and other desktops look at the .desktop files in “/etc/xdg/autostart/” and in your home in “~/.config/autostart/” to know what things to run at login. A file in there looks like for example this here:

[Desktop Entry]
Name=Steam-Autostart
Comment=Application for managing and playing games on Steam
Exec=/usr/bin/steam -silent
Icon=steam
Terminal=false
Type=Application
Categories=Network;FileTransfer;Game;

For Gnome, you would have to create a file similar to this for “nvidia-settings” in “~/.config/autostart/”. I think KDE has a configuration screen for startup commands somewhere in its settings program. If you use that KDE tool, it creates a .desktop file for you behind the scenes.

About the xorg.conf file, I would edit it manually, never with a tool like nvidia-settings. You might want to only use the tool to save an example xorg.conf file, then copy’n’paste the settings you are interested in to your real xorg.conf file.

The X config files work like this: X looks for all files in “/etc/X11/xorg.conf.d/” and for the single file “/etc/X11/xorg.conf” and combines their contents into one, and that’s the config. This means you do not have to use a single large xorg.conf file. You can instead use just that small snippet you mentioned earlier and save it in a file “/etc/xorg.conf.d/my-nvidia.conf”. Afterwards delete the large xorg.conf file as X can very likely create the missing contents by itself automatically.

I don’t know what kind of system you have but there is no ~/.xprofile on mine. There are only ~/.bashrc and ~/.profile and neither of those have settings that affects xorg.conf being overwritten or the way nvidia-settings interacts with the file. There is however a .nvidia-settings-rc file but this doesn’t really help me much as it only sets some things in the config properties for nvidia, but doesn’t seem to be the one triggering the overwrite of the xorg.conf file.

You’ve pretty much presented what I already know, and doesn’t really contribute much to the solution I’m looking for. The xinitrc I’m talking about is in the systemwide xinitrc file within /etc/X11/xinit/

as for the ~/.config/autostart/ you mentioned, there’s nothing in there for nvidia either besides the PRIME indicator applet. Again doesn’t affect xorg.conf.

Once again I already know this about X config stuff. In my system there is only /etc/X11/xorg.conf, but when I’ve rebooted or started up the system, nvidia-settings overwrites this and throws my config as backup instead of using my config that I want to use. This is the only xorg.conf I need, I have no need for creating multiple ones there. You have to be root level to be able to change xorg.conf, and because nvidia-settings has this temporary root it can modify the file on its own. I don’t even need to of opened nvidia-settings for it to do this, it does this automatically by itself which is what I’m trying to get it to stop doing. It just needs to be only loading config only, not overwrite and replace with a new one.

I have to keep removing and re-writing my own xorg.conf back after it does it’s stupid nonsense.