Tuning nvidia-settings over SSH error

I read a lot on the subject and tried every solution proposed. For example, this thread seemed helpful: https://thebravestatistician.wordpress.com/2017/08/13/tweaking-your-nvidia-gpu-via-ssh-using-nvidia-settings/

However, I keep having this error:

>$ nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=70"
No protocol specified
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused

ERROR: The control display is undefined; please run `nvidia-settings --help` for usage information.

and my xorf.conf:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 1080 Ti"
    Option         "Coolbits" "28"
    Option         "AllowEmptyInitialConfiguration" "True"
EndSection

There are two monitors plugged to my 1080ti and I surely can tune the nvidia-settings with the GUI driver application or by CLI when I log in on the machine, but I cannot do it remotely.

Use either

DISPLAY=:0 nvidia-settings

or

nvidia-settings -c :0

or

nvidia-settings --display :0

Of course, you’ll have to set :0 to the right value and the user has to have access to the xserver.

@generix, as mentionned (see post link) I already tried those proposed solutions but it keeps failing

Ok, there’s mighty little info so far. What kind of distro are you running? What kind of DM/DE? Are you sure there’s an Xserver running on the nvidia gpu and not a wayland session on an igpu?
Please run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post will reveal a paperclip icon.

I’m using a Ubuntu 16.04

I’m not sure that a Xserver runs on the GPU if I dont X forward. However, I dont want to X forward because the nvidia-settings will be for my local machine and not the remote one.

Here the result of the bug report

I also tried to run a virtual xserver (xvfb) but got another error

ERROR: Unable to load info from any available system

nvidia-bug-report.log.gz (116 KB)

Ok, you’re using GDM/Gnome, so when you start your system GDM spawns its own Xserver. You’ll need the right XAUTHORITY set, as mentioned in the link you gave but that was for lightdm.
Run

ps a |grep X

should return something like

4104 tty7     Sl+    0:00 /usr/bin/X vt7 -displayfd 3 -auth /run/user/111/gdm/Xauthority -background none -noreset -keeptty -verbose 3

Note the path that comes after -auth, that’s what XAUTHORITY has to be set to.
Then you’ll need to run nvidia-settings as root:

sudo -s
DISPLAY=:0 XAUTHORITY=/run/user/111/gdm/Xauthority nvidia-settings [youroptions]

Awesome ! I missed the right Xauthority file (as I did not know how to get its path)
Thank you so much !

I am unable to set memory offset values to my graphic card. I am able to set fan speed but nothing else. Here’s the error it gives:-

XAUTHORITY=/run/user/1000/gdm/Xauthority nvidia-settings -a “[gpu:4]/GPUMemoryTransferRateOffset[3]=600”

ERROR: Error assigning value 600 to attribute ‘GPUMemoryTransferRateOffset’ (raj-rig:0[gpu:4]) as specified in assignment ‘[gpu:4]/GPUMemoryTransferRateOffset[3]=600’ (Unknown Error).