nvidia-settings creates invalid files

I want to use nvidia-settings to set my brigtness when I start an X session, but the file created by this tool (.nvidia-settings-rc) cannot be read, because the display identifier contains hostname of the machine. I get the following error when trying to read the file (using nvidia-settings -V -l):

ERROR: Cannot open display ‘miro2:0’.

miro2 is hostname of my computer. The reason for this is that in the .nvidia-settings-rc file, some lines start with “miro2:0”, while that should only start with “0”. Once the hostname is stripped, the file is fine.

So what I want to know is if this is indeed a bug affecting every user of nvidia-settings, in which case it should be fixed. I only found a few old references on the internet about this problem, I would expect more.

I am using Gentoo Linux and NVIDIA driver version is 304.64

Several references to this problem can be found on the internet from around 2008 or 2010, such as nvidia-settings not holding? [SOLVED] / Applications & Desktop Environments / Arch Linux Forums

In the “nvidia-settings Configuration” page, is the “Include X Display Names in the Config File” option checked?

No, that option is off. In my file, most of the lines are fine, it is only the bottom nine lines giving brightness, contrast and gamma that start with hostname.

What could be wrong?

Is it so difficult to solve this problem?
All the latest drivers are unusable on many laptops because of the file .nvidia-settings.rc.
Last working driver 304.51

ERROR: Cannot open display 'linux-2nwn:0'.
ERROR: Unable to assign attribute RedBrightness specified on line 42 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
ERROR: Unable to assign attribute GreenBrightness specified on line 43 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
ERROR: Unable to assign attribute BlueBrightness specified on line 44 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
ERROR: Unable to assign attribute RedContrast specified on line 45 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
ERROR: Unable to assign attribute GreenContrast specified on line 46 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
ERROR: Unable to assign attribute BlueContrast specified on line 47 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
ERROR: Unable to assign attribute RedGamma specified on line 48 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
ERROR: Unable to assign attribute GreenGamma specified on line 49 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
ERROR: Unable to assign attribute BlueGamma specified on line 50 of
       configuration file '/home/ralph/.nvidia-settings-rc' (no Display
       connection).
WARNING: Failed to find display 0 assigned to X screen  0.
WARNING: Failed to find display 2 assigned to X screen  0.
WARNING: Failed to find display 3 assigned to X screen  0.

My .nvidia-settings.rc

#
# /home/ralph/.nvidia-settings-rc
#
# Configuration file for nvidia-settings - the NVIDIA X Server Settings utility
# Generated on Mon Jan 21 23:53:18 2013
#

# ConfigProperties:

RcFileLocale = C
ToolTips = Yes
DisplayStatusBar = Yes
SliderTextEntries = Yes
IncludeDisplayNameInConfigFile = No
ShowQuitDialog = Yes
Timer = PowerMizer_Monitor_(GPU_0),Yes,1000
Timer = Thermal_Monitor_(GPU_0),Yes,1000
Timer = Memory_Used_(GPU_0),Yes,3000

# Attributes:

0/CursorShadow=0
0/CursorShadowAlpha=64
0/CursorShadowRed=0
0/CursorShadowGreen=0
0/CursorShadowBlue=0
0/CursorShadowXOffset=4
0/CursorShadowYOffset=2
0/SyncToVBlank=1
0/LogAniso=0
0/FSAA=0
0/TextureSharpen=0
0/TextureClamping=1
0/FXAA=0
0/AllowFlipping=1
0/FSAAAppControlled=1
0/LogAnisoAppControlled=1
0/OpenGLImageSettings=1
0/FSAAAppEnhanced=0
0/DigitalVibrance[CRT-1]=0
0/XVideoSyncToDisplay=2
linux-2nwn:0[dpy:1]/RedBrightness=0.000000
linux-2nwn:0[dpy:1]/GreenBrightness=0.000000
linux-2nwn:0[dpy:1]/BlueBrightness=0.000000
linux-2nwn:0[dpy:1]/RedContrast=0.000000
linux-2nwn:0[dpy:1]/GreenContrast=0.000000
linux-2nwn:0[dpy:1]/BlueContrast=0.000000
linux-2nwn:0[dpy:1]/RedGamma=1.000000
linux-2nwn:0[dpy:1]/GreenGamma=1.000000
linux-2nwn:0[dpy:1]/BlueGamma=1.000000

the problem also hits me.
the problem is, that the reverse lookup of the hostname often fails.
and then nvidia-settings won’t load because the display couldn’t be found.
a solution would be to use localhost instead of hostname or get rid of it at all.

Thanks for reporting this. I filed bug 1222450 to track it.

I have encountered the same issue, GeForce GT630M on Lubuntu 12.10 x86_x64 edition with the 310.04 GPU drivers for my card. The drivers work fine, I’ve had no issues with them, totally rock solid like the windows ones (I dual boot) but the nvidia-settings app seems not to function correctly.

I did a few tests and it seems that nvidia-settings loads the “.nvidia-settings-rc” file from “~/” without issue but seems incapable of writing the chosen settings to it or any other ‘saved’ configuration files. By manually modifying the settings file I got the app to boot with the correct settings and pass them off to the X-Server, and was able to build and run my game project with FXAA settings enabled via the GPU.

Might be a good idea to double check the file writing code chunk?

319.12 reports

Updated the nvidia-settings command line interface to accept display device names, as well as optional target qualifiers, e.g.

nvidia-settings -q [DVI-I-0]/RefreshRate
nvidia-settings -q [GPU-1.DVI_I-1]/RefreshRate

In my case, no changes; the problem is still here.

319.12 creates an invalid .nvidia-settings-rc and then takes about one minute to read it.