Nvidia-settings returns 'Connection refused. ERROR: The control display is undefined'

I have been unable to use nvidia-settings assign settings to my GPUs, so I must be missing something fundamental that I think is related to xorg.conf settings. I need some pointers:

  1. nvidia-settings returning ‘control display is undefined’
  2. Headless operation?
  3. Starting a dummy xserver for an ssh session.

Operating system: Ubuntu Server 20.04 LTS
GPUs (2): Nvidia GTX1080 and Nvidia GTX1080ti
Nvidia Driver Version: 460.39 ← not the latest
Nvidia bug report gz - attached

I get the impression from reading the forums that ‘headless operation’ is something I should go for to run CUDA compute workloads and do my admin remotely.

I have not been able to get mobo on-board graphics to work - the mobo will not POST. I know this should be simple - the ASUS desktop mobo BIOS I am stuck with is stupidly complex (gamer heaven for tweaking perhaps, but useless for an enterprise). I will experiment further, although I have to be there in person to recover from a non-post state. I have instead connected an HDMI display to GPU:1

  • I have started driver persistence successfully from SSH command line with: sudo nvidia-smi -pm 1
  • Gnome desktop installed successfully, local logins work
  • lspci returns both Nvidia GPU ‘VGA’ devices ok

I have run: sudo nvidia-xconfig -a --allow-empty-initial-configuration --cool-bits=28 --enable-all-gpus

The xorg.config files looks plausible. nvidia-settings is not happy however, when I run and of the following:

sudo nvidia-settings -q all
sudo nvidia-settings -q gpus
sudo nvidia-settings -q screens
sudo nvidia-settings -q framlocks
sudo nvidia-settings -q fans
sudo nvidia-settings -q thermalsesors
sudo nvidia-settings -q svps
sudo nvidia-settings -q dpys
sudo nvidia-settings -q anyting-you-like

I get the same result (so there is a fundamental common failure):
Unable to init server: Could not connect: Connection refused

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

I have studied the --help output, but it does not give me enough hints to understand why I get ‘connection refused’ or ‘control display is undefined’.

Output from ‘lspci -nnk’, shows the nvidia driver is used; I note that nouveau is referenced too however (I read that nouvaeu is not desirable, but unclear why. I have amended my grub options to disable nouveau, perhaps not correctly?).

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] [10de:1b06] (rev a1)
Subsystem: Gigabyte Technology Co., Ltd GP102 [GeForce GTX 1080 Ti] [1458:374c]
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
02:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104 [GeForce GTX 1080] [10de:1b80] (rev a1)
Subsystem: ASUSTeK Computer Inc. GP104 [GeForce GTX 1080] [1043:85aa]
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

I have read this post: nvidia-settings: unable to init server
This described most of what I need to do, noting that SSH terminals have the issue of no DISPLAY, and the response from the ‘top contributor’ was “not possilble, start a dummy xserver”. So do I need to figure out how to start a dummy xserver?

Any pointers you can offer are very welcomenvidia-bug-report.log.gz|attachment (665.4 KB)

You will have to run an xserver on the gpus and properly set the DISPLAY variable.

Hi genrix, yes I see. Can you direct me to any sources so I can learn how to run an xserver on the gpu?

Have you figured this out yet? I spent a lot of time on this same issue. There’s not a lot of easily found info around.

If you just want access to the cards via command line and have a dummy X server on that machines local display (basically blank with no desktop manager) and then control the settings remotely. This might not be all the details, but it should be enough to get you on the right track. You must have a display attached to at least one card.

#ssh in
# "Start a new X server"

X :0 &
export DISPLAY=:0

Then try your commands

If you want to load settings on boot/reboot or via command line without booting into a desktop on that machine:

Set grub to runlevel 3 at boot.

in grub set
LINUX_CMDLINE_LINUX=3

then grub-install

In Ubuntu to disable gnome from running its own xserver
systemctl disable gdm

To have a working /etc/rc.local on boot ( notice it’s a dash in the following systemctl command)

touch /etc/rc.local
chmod 755 /etc/rc.local
systemctl enable rc-local

then add your needed scripts/programs

After that if you want it to automatically create the dummy on reboot then
create a script that starts with the following or pick what you need. This isnt my actual script. Just snippets here as an example

=========================

#reset persist
nvidia-smi -pm 0

/usr/bin/sleep 3

# kill existing X server
# create empty X server with no desktop on machines attached display
echo "Killing any exisitng X server"
cd /home/simon/myappdir
kill -15 $(ps -C Xorg -o pid=)

echo "Sleeping 5"
/usr/bin/sleep 5

echo "Start a new X server"
X :0 &

export DISPLAY=:0

sleep 15

#### start your settings here. 
#### You can use both 'nvidia-smi' and 'nvidia-settings'

#RESET script examples
#presistence
nvidia-smi -i 0 -pm 1
nvidia-smi -i 1 -pm 1
nvidia-smi -i 2 -pm 1
nvidia-smi -i 3 -pm 1

echo "Reset GPU Clocks"
echo "GPU0"
nvidia-smi -i 0 -rgc
nvidia-smi -i 1 -rgc
nvidia-smi -i 2 -rgc
nvidia-smi -i 3 -rgc

#fan speed
echo .
echo "Set fans"

nvidia-settings -a [gpu:0]/GPUFanControlState=1 -a [fan:0]/GPUTargetFanSpeed=80 -a [fan:1]/GPUTargetFanSpeed=80
nvidia-settings -a [gpu:1]/GPUFanControlState=1 -a [fan:2]/GPUTargetFanSpeed=80 -a [fan:3]/GPUTargetFanSpeed=80
nvidia-settings -a [gpu:2]/GPUFanControlState=1 -a [fan:4]/GPUTargetFanSpeed=80 -a [fan:5]/GPUTargetFanSpeed=80
nvidia-settings -a [gpu:3]/GPUFanControlState=1 -a [fan:6]/GPUTargetFanSpeed=80 -a [fan:7]/GPUTargetFanSpeed=80

#To change the GPU core clock speed, you use
#nvidia-settings -a '[gpu:index_of_GPU]/GPUGraphicsClockOffset[3]=+or-offset'

echo .
echo "Set clocks to 0"
nvidia-settings -a [gpu:0]/GPUGraphicsClockOffset[3]=-1 -c :0
nvidia-settings -a [gpu:1]/GPUGraphicsClockOffset[3]=-1 -c :0
nvidia-settings -a [gpu:2]/GPUGraphicsClockOffset[3]=-1 -c :0
nvidia-settings -a [gpu:3]/GPUGraphicsClockOffset[3]=-1 -c :0


=======================================
 start your app
=======================================

# another script example to change settings from defaults

# Set clock setting to unrestricted
nvidia-smi -acp 0

# Set max performance
nvidia-settings -a [gpu:0]/GpuPowerMizerMode=1
nvidia-settings -a [gpu:1]/GpuPowerMizerMode=1
nvidia-settings -a [gpu:2]/GpuPowerMizerMode=1
nvidia-settings -a [gpu:3]/GpuPowerMizerMode=1

# set max power level in watts

nvidia-smi -i 0 -pl 145
nvidia-smi -i 1 -pl 145
nvidia-smi -i 2 -pl 145
nvidia-smi -i 3 -pl 138

# lock graphics clock ( cards will auto restrict watts )
nvidia-smi -i 0 -lgc 1290
nvidia-smi -i 1 -lgc 1290
nvidia-smi -i 2 -lgc 1290
nvidia-smi -i 3 -lgc 1290

# Set memory clock
# To set the GPU memory speed you would use
# 6800 + (offset / 2) = Mem speed

nvidia-settings -a [gpu:0]/GPUMemoryTransferRateOffsetAllPerformanceLevels=3050
nvidia-settings -a [gpu:1]/GPUMemoryTransferRateOffsetAllPerformanceLevels=3050
nvidia-settings -a [gpu:2]/GPUMemoryTransferRateOffsetAllPerformanceLevels=2850
nvidia-settings -a [gpu:3]/GPUMemoryTransferRateOffsetAllPerformanceLevels=3050


=========================================

Disable nouveau driver. Search for blacklisting in /etc/modprobe.d
I beleive Nvidia installer does this

Here’s more info you might find interesting

1 Like

Here’s a confirmed working /etc/X11/xorg.conf that uses the iGPU as primary display ( intel in this case ) and then forces one of the Nvidia cards to use an EDID from file to activate the driver/GPU to be loaded by X, therefore for all 4 Nvidia GPU. You’ll have one display with a working X desktop, no spanning multi desktop and be able to use the nvidia utilities and programs on the non dektop GPUs. Set your BusID for each Device !

Configuration -
Linux Hostname 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
XServer 1.20.9 ( i915 using modesetting )
Intel Celeron iGPU
4 x Nvidia RTX 3070

You’ll see on the main iGPU I use an EDID file from a small 3" display in case I have it disconnected.

On the Nvidia GPU I use the EDID file from a DELL-S2330MX which is a 1920x1080 monitor. You can also add that to the rest of the GPUs if needed.
( NOTE: you can use nvidia-settings to dump your own EDID files if the monitor is currently connected to an nvidia card or other methods posted online )

In order to use the EDID files, you must know what port the card uses for a monitor output. In this case you’ll see HDMI-2 and DFP-5 are used. You can find that in /var/log/ in the X.org log files

I will attached the text version of the EDID ( This site wont allow me to attached BIN or txt files ) I haven’t tested the text version method. maybe you can use ‘edid-decode’ to convert them.

Note: on ubuntu disable gpu-manager:
sudo systemctl disable gpu-manager

otherwise it will continually overwrite your x configs

==== xorg.conf start ==========

Section “ServerFlags”
Option “BlankTime” “0”
Option “StandbyTime” “0”
Option “SuspendTime” “0”
Option “OffTime” “0”
EndSection

Section “ServerLayout”
Identifier “Layout0”
Screen 0 “Screen0” 0 0
Screen 1 “Screen1”
Screen 2 “Screen2”
Screen 3 “Screen3”
Screen 4 “Screen4”
InputDevice “Mouse0” “CorePointer”
EndSection

Section “Files”
EndSection

Section “InputDevice”
Identifier “Mouse0”
Driver “mouse”
Option “Protocol” “auto”
Option “Device” “/dev/psaux”
Option “Emulate3Buttons” “no”
Option “ZAxisMapping” “4 5”
EndSection

Section “InputDevice”
Identifier “Keyboard0”
Driver “kbd”
EndSection

Section “Device”
Identifier “Device0”
Driver “modesetting”
BusID “PCI:0:2:0”
Option “AllowEmptyInitialConfiguration” “True”
Option “ConnectedMonitor” “HDMI-2”
Option “CustomEDID” “HDMI-2:/etc/X11/RTK-32V3H-edid.bin”
Option “IgnoreEDID” “false”
Option “UseEDID” “true”
EndSection

Section “Monitor”
Identifier “Monitor0”
Vendorname “Unknown”
ModelName “Unknown”
EndSection

Section “Screen”
Identifier “Screen0”
Device “Device0”
Monitor “Monitor0”
DefaultDepth 24
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Device”
Identifier “Device1”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce RTX 3070”
BusID “PCI:1:0:0”
Option “ConnectedMonitor” “DFP-5”
Option “CustomEDID” “DFP-5:/etc/X11/Dell-S2330MX-edid.bin”
Option “IgnoreEDID” “false”
Option “UseEDID” “true”
Option “NoLogo” “true”
Option “ModeValidation” “NoVesaModes, NoXserverModes”
EndSection

Section “Screen”
Identifier “Screen1”
Device “Device1”
Monitor “Monitor1”
DefaultDepth 24
Option “BaseMosaic” “False”
Option “AllowEmptyInitialConfiguration” “True”
Option “Stereo” “0”
Option “MultiGPU” “Off”
Option “SLI” “Off”
Option “MetaModes” “nvidia - auto - select + 0 + 0”
Option “nvidiaXineramaInfoOrder” “DFP”
Option “Coolbits” “31”
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Monitor”
Identifier “Monitor1”
VendorName “Unknown”
ModelName “Unknown”
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option “NODPMS”
EndSection

Section “Device”
Identifier “Device2”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce RTX 3070”
BusID “PCI:3:0:0”
EndSection

Section “Screen”
Identifier “Screen2”
Device “Device2”
Monitor “Monitor2”
DefaultDepth 24
Option “BaseMosaic” “False”
Option “AllowEmptyInitialConfiguration” “True”
Option “Stereo” “0”
Option “MultiGPU” “Off”
Option “SLI” “Off”
Option “MetaModes” “nvidia - auto - select + 0 + 0”
Option “nvidiaXineramaInfoOrder” “DFP”
Option “Coolbits” “31”
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Monitor”
Identifier “Monitor2”
VendorName “Unknown”
ModelName “Unknown”
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option “NODPMS”
EndSection

Section “Device”
Identifier “Device3”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce RTX 3070”
BusID “PCI:4:0:0”
EndSection

Section “Screen”
Identifier “Screen3”
Device “Device3”
Monitor “Monitor3”
DefaultDepth 24
Option “BaseMosaic” “False”
Option “AllowEmptyInitialConfiguration” “True”
Option “Stereo” “0”
Option “MultiGPU” “Off”
Option “SLI” “Off”
Option “MetaModes” “nvidia - auto - select + 0 + 0”
Option “nvidiaXineramaInfoOrder” “DFP”
Option “Coolbits” “31”
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Monitor”
Identifier “Monitor3”
VendorName “Unknown”
ModelName “Unknown”
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option “NODPMS”
EndSection

Section “Device”
Identifier “Device4”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce RTX 3070”
BusID “PCI:7:0:0”
EndSection

Section “Screen”
Identifier “Screen4”
Device “Device4”
Monitor “Monitor4”
DefaultDepth 24
Option “BaseMosaic” “False”
Option “AllowEmptyInitialConfiguration” “True”
Option “Stereo” “0”
Option “MultiGPU” “Off”
Option “SLI” “Off”
Option “MetaModes” “nvidia - auto - select + 0 + 0”
Option “nvidiaXineramaInfoOrder” “DFP”
Option “Coolbits” “31”
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Monitor”
Identifier “Monitor4”
VendorName “Unknown”
ModelName “Unknown”
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option “NODPMS”
EndSection

======= end of xorg conf ============

==== Dell-S2330MX-edid.txt start =====
00 ff ff ff ff ff ff 00 10 ac 4a d0 54 4a 37 30 13 16 01 03 80 33 1d 78 ea 77 c5 a3 54 4f 9f 27 11 50 54 a5 4b 00 71 4f 81 80 d1 c0 01 01 01 01 01 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c 45 00 fd 1e 11 00 00 1e 00 00 00 ff 00 56 57 58 46 47 32 35 41 30 37 4a 54 0a 00 00 00 fc 00 44 45 4c 4c 20 53 32 33 33 30 4d 58 0a 00 00 00 fd 00 38 4c 1e 53 11 00 0a 20 20 20 20 20 20 00 6a
==== Dell-S2330MX-edid.txt end =====

======= RTK-32V3H-edid.txt start =====
00 ff ff ff ff ff ff 00 4a 8b 54 4c 01 00 00 00 0c 11 01 03 81 46 27 78 8a a5 8e a6 54 4a 9c 26 12 45 46 af cf 00 95 00 95 0f 95 19 01 01 01 01 01 01 01 01 01 01 01 1d 00 72 51 d0 1e 20 6e 28 55 00 b9 88 21 00 00 1e 8c 0a d0 8a 20 e0 2d 10 10 3e 96 00 b9 88 21 00 00 18 00 00 00 fd 00 32 4b 18 3c 0b 00 0a 20 20 20 20 20 20 00 00 00 fc 00 33 32 56 33 48 2d 48 36 41 0a 20 20 20 01 29 02 03 21 71 4e 06 07 02 03 15 96 11 12 13 04 14 05 1f 90 23 09 07 07 83 01 00 00 65 03 0c 00 10 00 8c 0a d0 90 20 40 31 20 0c 40 55 00 b9 88 21 00 00 18 01 1d 80 18 71 1c 16 20 58 2c 25 00 b9 88 21 00 00 9e 01 1d 80 d0 72 1c 16 20 10 2c 25 80 b9 88 21 00 00 9e 01 1d 00 bc 52 d0 1e 20 b8 28 55 40 b9 88 21 00 00 1e 02 3a 80 d0 72 38 2d 40 10 2c 45 80 b9 88 21 00 00 1e 00 00 00 00 d0
======= RTK-32V3H-edid.txt end =====