I Cannot run a program in a specific screen with export DISPLAY

Hello,

I’m trying to config dual screen in RHEL8 but when I try export DISPLAY=redhat8:0.1 and then run a program (nvidia-settings for example) it says:

"Unable to init server: Could Not connect: Connection refused

ERROR: The control display is undefined; please run ‘nvidia-settings --help’ for usage information"

When I run xrandr (after expor display) says “Can’t open display redhat8:0.1”

If I run xrandr without export Display this happened:

[root@redhat8 ~]# xrandr
Screen 0: minimum 8 x 8, current 1280 x 1024, maximum 32767 x 32767
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-6 disconnected (normal left inverted right x axis y axis)
DP-7 connected primary 1280x1024+0+0 (normal left inverted right x axis y axis) 380mm x 300mm
1280x1024 60.02*+ 75.02
1024x768 75.03 70.07 60.00
800x600 75.00 72.19 60.32
640x480 75.00 72.81 59.94

As you can see, it skips “DP-5” and it’s the second monitor (I can see it in nvidia-settings and my main monitor is DP-7 but it’s says connected).

I’ve tried unable the noveau drivers, I’m using lightdm, and this is my xorg.conf:

[root@redhat8 X11]# cat xorg.conf

nvidia-xconfig: X configuration file generated by nvidia-xconfig

nvidia-xconfig: version 525.85.05

Section “ServerLayout”
Identifier “Layout0”
Screen 0 “Screen0” 0 0
Screen 1 “Screen0 (1)” RightOf “Screen0”
Screen 2 “Screen0 (2)” RightOf “Screen0 (1)”
Screen 3 “Screen0 (3)” RightOf “Screen0 (2)”
Inactive “InactiveDevice1”
InputDevice “Keyboard0” “CoreKeyboard”
InputDevice “Mouse0” “CorePointer”
EndSection

Section “Files”
FontPath “/usr/share/fonts/default/Type1”
EndSection

Section “InputDevice”

# generated from default
Identifier     "Mouse0"
Driver         "mouse"
Option         "Protocol" "auto"
Option         "Device" "/dev/input/mice"
Option         "Emulate3Buttons" "no"
Option         "ZAxisMapping" "4 5"

EndSection

Section “InputDevice”

# generated from default
Identifier     "Keyboard0"
Driver         "kbd"

EndSection

Section “Monitor”
Identifier “Monitor0”
VendorName “Unknown”
ModelName “Unknown”
Option “DPMS”
EndSection

Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “Quadro P2200”
BusID “PCI:33:0:0”
Screen 0
EndSection

Section “Device”
Identifier “Device0 (1)”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “Quadro P2200”
BusID “PCI:33:0:0”
Screen 1
EndSection

Section “Device”
Identifier “Device0 (2)”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “Quadro P2200”
BusID “PCI:33:0:0”
Screen 2
EndSection

Section “Device”
Identifier “Device0 (3)”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “Quadro P2200”
BusID “PCI:33:0:0”
Screen 3
EndSection

Section “Device”
Identifier “InactiveDevice1”
Driver “modesetting”
VendorName “Unknown”
EndSection

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

Section “Screen”
Identifier “Screen0 (1)”
Device “Device0 (1)”
Monitor “Monitor0”
DefaultDepth 24
Option “AllowEmptyInitialConfiguration” “True”
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Screen”
Identifier “Screen0 (2)”
Device “Device0 (2)”
Monitor “Monitor0”
DefaultDepth 24
Option “AllowEmptyInitialConfiguration” “True”
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Screen”
Identifier “Screen0 (3)”
Device “Device0 (3)”
Monitor “Monitor0”
DefaultDepth 24
Option “AllowEmptyInitialConfiguration” “True”
SubSection “Display”
Depth 24
EndSubSection
EndSection

I’ve dualscreen.conf too:

[root@redhat8 X11]# cat xorg.conf.nvidia.dualscreen

nvidia-settings: X configuration file generated by nvidia-settings

nvidia-settings: version 460.73.01

nvidia-xconfig: X configuration file generated by nvidia-xconfig

nvidia-xconfig: version 460.73.01

Section “ServerLayout”
Identifier “Layout0”
Screen 0 “Screen0” 0 0
Screen 1 “Screen1” RightOf “Screen0”
InputDevice “Keyboard0” “CoreKeyboard”
InputDevice “Mouse0” “CorePointer”
Option “Xinerama” “0”
EndSection

Section “Files”
FontPath “/usr/share/fonts/default/Type1”
EndSection

Section “InputDevice”

# generated from default
Identifier     "Mouse0"
Driver         "mouse"
Option         "Protocol" "auto"
Option         "Device" "/dev/input/mice"
Option         "Emulate3Buttons" "no"
Option         "ZAxisMapping" "4 5"

EndSection

Section “InputDevice”

# generated from default
Identifier     "Keyboard0"
Driver         "kbd"

EndSection

Section “Monitor”
Identifier “Monitor0”
VendorName “Unknown”
ModelName “HP LP1965”
HorizSync 30.0 - 80.0
VertRefresh 50.0 - 60.0
Option “DPMS”
EndSection

Section “Monitor”
Identifier “Monitor1”
VendorName “Unknown”
ModelName “Acer EK240Y”
HorizSync 30.0 - 80.0
VertRefresh 50.0 - 60.0
EndSection

Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “Quadro P2200”
BusID “PCI:33:0:0”
Screen 0
EndSection

Section “Device”
Identifier “Device1”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “Quadro P2200”
BusID “PCI:33:0:0”
Screen 1
EndSection

Section “Screen”
Identifier “Screen0”
Device “Device0”
Monitor “Monitor0”
DefaultDepth 24
Option “UseEdidFreqs” “True”
Option “UseEdid” “True”
Option “Stereo” “0”
Option “metamodes” “DP-7: nvidia-auto-select +0+0”
Option “SLI” “Off”
Option “MultiGPU” “Off”
Option “BaseMosaic” “off”
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Screen”
Identifier “Screen1”
Device “Device1”
Monitor “Monitor1”
DefaultDepth 24
Option “Stereo” “0”
Option “metamodes” “DP-5: nvidia-auto-select +0+0 {AllowGSYNC=Off}”
Option “SLI” “Off”
Option “MultiGPU” “Off”
Option “BaseMosaic” “off”
SubSection “Display”

    Depth       24
EndSubSection

EndSection

Here you are the monitors in nvidia settings:

Could you help me? please

Here you are the second image:

By the way, this is the cursor in the second monitor:

Are you sure you actually want multiple X screens? Most users just use multiple display devices on a single X screen, partly because no modern Linux desktop environment supports more than a single X screen.

That said, I think DISPLAY=redhat8:0.1 isn’t working because that syntax causes it to try to use TCP to connect to the server, and modern X servers don’t listen on TCP sockets anymore for security reasons. Please give DISPLAY=:0.1 a try: that will make it use a local UNIX socket instead that the server should actually be listening to.

1 Like

Oh, I forgot to mention that your xrandr command without changing DISPLAY probably actually is working. It’s just that xrandr only queries one screen by default, and it’s the one returned by DefaultScreen. You can change that with DISPLAY=:0.x like you mentioned but you can also use xrandr --screen 1, xrandr --screen 2, etc. to query individual screens.

1 Like

Hello, thanks for your reply, we have a program in a Server (NIS server) not in local, so, we loggin with a user allocated on that server and then we can run the program, the program needs to connect to the second monitor, in RHEL 7.5 it works properly but now in RHEL8 it doesn’t, since the program is allocated in a server not in local I guess the program needs to connect with the monitor via TCP, you’ve told me that now we cannot do that anymore for security, is there a way to resolve it or another way to connect that monitor with the program?

Which computer is running the Xorg server, and which is running the nvidia-settings or xrandr clients? It might help to check the value of $DISPLAY before you changed it. Based on what you wrote about xrandr without changing DISPLAY it does sound like it’s able to connect.

1 Like

Hello,

The computer with the nvidia-settings and xorg is the same (that’s I think), when I run cat $DISPLAY it says “cat: ‘0:’ No such file or directory” , any idea to solve it please? Happy new year by the way!

Here you are more data about display:

[root@redhat8 ~]# DISPLAY=:0.1
[root@redhat8 ~]# xrandr --sc
–scale --scale-from --screen
[root@redhat8 ~]# xrandr --screen 1
Screen 1: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
DP-5 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
1920x1080 60.00*+ 75.00 59.94 50.00 60.05 60.00 50.04
1680x1050 59.95
1440x900 59.89
1440x576 50.00
1440x480 59.94
1280x1024 75.02 60.02
1280x960 60.00
1280x800 59.81
1280x720 60.00 59.94 50.00
1152x864 75.00
1024x768 75.03 70.07 60.00
800x600 75.00 72.19 60.32 56.25
720x576 50.00
720x480 59.94
640x480 75.00 72.81 59.94 59.93
[root@redhat8 ~]# xrandr --screen 2
Screen 2: minimum 8 x 8, current 640 x 480, maximum 32767 x 32767
DP-0 disconnected primary (normal left inverted right x axis y axis)
[root@redhat8 ~]#

Thank you so much!! It works using only export DISPLAY=:0.1

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.