I have a Debian 10 system with a desktop environment installed and running. When I open a terminal and try to run any GUI application , such as gedit, from the command line, it fails to open with the following messages:
# gedit
Unable to init server: Could not connect: Connection refused
(gedit:3575): Gtk-WARNING **: 12:26:48.311: cannot open display:
This happens with any user, not just root.
I have tried running the following based on suggestions to no avail:
export DISPLAY=:0
export DISPLAY=:1
export DISPLAY=:2
export DISPLAY=:3
export DISPLAY=:4
export DISPLAY=:5
export DISPLAY=:6
xhost +
Anyone have any idea whats wrong here?
EDIT:
If I run export DISPLAY=:0
as a normal user, then the normal user can run GUI programs from the command line, however whenever I try the same with root it fails with the messages:
No protocol specified
Unable to init server: Could not connect: Connection refused
No protocol specified
Unable to init server: Could not connect: Connection refused
No protocol specified
Unable to init server: Could not connect: Connection refused
(gedit:3609): Gtk-WARNING **: 12:33:16.307: cannot open display: :0