nvidia-settings Failed to connect to Mir

I want to use nvidia-settings in terminal by SSH and i have this error :

>>> DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 nvidia-settings

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.

on Ubuntu Server 16.04, same for 18.04

Where to find the displays? I would like to understand why on some other posts DISPLAY=:0 solves the problem and not for me

If you’re running Ubuntu SERVER, you’ll likely have no xserver running. Start a xserver, then try again.

The xserver is already running

>>> sudo startx

X.Org X Server 1.18.4
Release Date: 2016-07-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-97-generic x86_64 Ubuntu
Current Operating System: Linux USERNAME 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.4.0-116-generic root=UUID=1eea0b8c-a690-4553-928c-10470ba5d755 ro text
Build Date: 13 October 2017  01:57:05PM
xorg-server 2:1.18.4-0ubuntu0.7 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.33.6
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Thu Jul 12 20:51:19 2018
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Type "ONE_LEVEL" has 1 levels, but <RALT> has 2 symbols
>                   Ignoring extra symbols
Errors from xkbcomp are not fatal to the X server
xinit: connection to X server lost

waiting for X server to shut down ..........
xinit: X server slow to shut down, sending KILL signal

waiting for server to die ...
xinit: X server refuses to die

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.

Here nvidia-bug-report.sh
nvidia-bug-report.log (1.07 MB)

Ok, an xserver is running with 13 gtx 1070s as seperate screens. To get the correct setting for XAUTHORITY, please run and post the output of

ps a | grep X

The path that comes after -auth is what XAUTHORITY has to be set to.
Since you have 13 screens you might want to try to set DISPLAY=:0.0 for testing. If the screen number is not given, nvidia-settings should apply to all screens (gpus) but you never know if a bug is involved.
BTW you’re using the wrong nvidia-settings parameters to set memory clocks, those have been changed for pascal gpus:

>>> ps a | grep X
5102 pts/0    S+     0:00 grep --color=auto X

Usually I typed

XAUTHORITY=/var/run/lightdm/root/:0 DISPLAY=:0.0 nvidia-settings

but the path /var/run/lightdm doesn’t exists and the package lightdm is already installed

>>> sudo apt-get install lightdm
Reading package lists... Done
Building dependency tree
Reading state information... Done
lightdm is already the newest version (1.18.3-0ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 130 not upgraded.


>>> sudo dpkg-reconfigure lightdm
insserv: warning: current start runlevel(s) (empty) of script `lightdm' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `lightdm' overrides LSB defaults (0 1 6).

I’m going to look here, I think that’s the problem