ssh -Y, gedit, Could not connect, cannot open display

Issues related to applications and software problems and general support
jchen1
Posts: 8
Joined: 2019/12/06 20:43:32

ssh -Y, gedit, Could not connect, cannot open display

Post by jchen1 » 2019/12/06 21:06:43

I have two Dell PowerEdge T30 servers (named T30 and T302). I installed CentOS 8 (Server with GUI) on both of them. I am testing ssh -Y to see if I can run graphical application through the network. I am getting the following error messages. I have read quite a bit of online articles and still cannot resolve the problem. So I post my problem here. Thanks for any help. I am thinking that I may not have an X server running on my T30 server. But I don't know how to tell and what packages I need to install. And how do I run the X server automatically each time I boot the box?

[root@T30 ~]# ssh -Y T302
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Fri Dec 6 14:29:50 2019 from 192.168.x.x
[root@T302 ~]# gedit
Unable to init server: Could not connect: Connection refused

(gedit:5592): Gtk-WARNING **: 14:53:23.991: cannot open display:
[root@T302 ~]#

tunk
Posts: 634
Joined: 2017/02/22 15:08:17

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by tunk » 2019/12/07 16:02:44

You could try to add the "-v" option to see if that gives you
more info, and to (temporarely) disable both firewalls.
Also check if X11Forwarding is enabled in /etc/ssh/sshd_config.

jchen1
Posts: 8
Joined: 2019/12/06 20:43:32

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by jchen1 » 2019/12/07 17:38:32

I temporarily disabled the firewalls on both client and server. X11Forwarding is enabled in /etc/ssh/sshd_config. Below is the verbose output of connect. gedit still gives the same error message. What should I do next? Thanks.

[root@T30 ~]# ssh -v T302
OpenSSH_7.8p1, OpenSSL 1.1.1 FIPS 11 Sep 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 8: Applying options for *
debug1: Connecting to t302 [192.168.x.x] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type 0
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.8
debug1: match: OpenSSH_7.8 pat OpenSSH* compat 0x04000000
debug1: Authenticating to t302:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256@libssh.org need=32 dh_need=32
debug1: kex: curve25519-sha256@libssh.org need=32 dh_need=32
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:gA8AM6PP4dZmcx+1joiOvpcO01P4epxSHcsfD5HXsoU
debug1: Host 't302' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,null>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: KCM:)


debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: KCM:)


debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:CMV0BufuwlFlm6Bhvr5AwKGlnGuJwUVqhsY9UvijmzA /root/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-256 blen 279
debug1: Authentication succeeded (publickey).
Authenticated to t302 ([192.168.x.x]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Remote: /root/.ssh/authorized_keys:2: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /root/.ssh/authorized_keys:2: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Sat Dec 7 11:29:04 2019 from 192.168.x.x

tunk
Posts: 634
Joined: 2017/02/22 15:08:17

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by tunk » 2019/12/07 21:54:27

I don't know if it will make any difference, but you could try "ssh -X" instead of "ssh -Y".

jchen1
Posts: 8
Joined: 2019/12/06 20:43:32

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by jchen1 » 2019/12/07 23:06:38

Thanks for the suggestion. I tried. Same error when I tried to launch gedit.

User avatar
TrevorH
Forum Moderator
Posts: 27414
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by TrevorH » 2019/12/08 01:18:57

yum install xorg-x11-xauth
CentOS 6 will die in November 2020 - migrate sooner rather than later!
CentOS 5 has been EOL for nearly 3 years and should no longer be used for anything!
Full time Geek, part time moderator. Use the FAQ Luke

jchen1
Posts: 8
Joined: 2019/12/06 20:43:32

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by jchen1 » 2019/12/08 01:34:52

Thanks for the suggestion. Here is the result:

[root@T30 ~]# yum install xorg-x11-xauth
Last metadata expiration check: 2:54:03 ago on Sat 07 Dec 2019 04:32:23 PM CST.
Package xorg-x11-xauth-1:1.0.9-12.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@T30 ~]#

Tried ssh -Y T302 and gedit. Same error message:


[root@T30 ~]# ssh -Y T302
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Sat Dec 7 17:04:26 2019 from 192.168.x.x
[root@T302 ~]# gedit
Unable to init server: Could not connect: Connection refused

(gedit:20996): Gtk-WARNING **: 19:28:07.512: cannot open display:
[root@T302 ~]#

Tried yum install xorg-x11-xauth on T302:

[root@T302 ~]# yum install xorg-x11-xauth
Last metadata expiration check: 0:38:27 ago on Sat 07 Dec 2019 06:53:12 PM CST.
Package xorg-x11-xauth-1:1.0.9-12.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

pjsr2
Posts: 439
Joined: 2014/03/27 20:11:07

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by pjsr2 » 2019/12/08 15:47:14

What is the value of $DISPLAY on T30 and on T302 ?
I am thinking that I may not have an X server running on my T30 server.
The following sequence of commands assumes you are working from a graphical desktop on T30:
[root@T30 ~]# ssh -Y T302
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Fri Dec 6 14:29:50 2019 from 192.168.x.x
[root@T302 ~]# gedit
Unable to init server: Could not connect: Connection refused

(gedit:5592): Gtk-WARNING **: 14:53:23.991: cannot open display:
[root@T302 ~]#
Where is the message ¨Activate the web console with: systemctl enable --now cockpit.socket¨ comming from?

jchen1
Posts: 8
Joined: 2019/12/06 20:43:32

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by jchen1 » 2019/12/08 19:33:24

Value of $DISPLAY on T30:

[root@T30 ~]# echo $DISPLAY
:0

ssh to T302 and value of $DISPLAY:

[root@T30 ~]# ssh -Y T302
Warning: No xauth data; using fake authentication data for X11 forwarding.
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Sun Dec 8 13:11:37 2019 from 192.168.1.101
[root@T302 ~]#
[root@T302 ~]# echo $DISPLAY
localhost:10.0

This time, gedit works, though it takes about 25 seconds for the gedit window to show up.
Supprise me. I have not make any actual changes to the system and now it is working.


Yes, I am working from a graphical desktop on both T30 and T302. I don't know
Where is the message ¨Activate the web console with: systemctl enable --now cockpit.socket¨ comming from.
I am newbie to Linux. : )

jchen1
Posts: 8
Joined: 2019/12/06 20:43:32

Re: ssh -Y, gedit, Could not connect, cannot open display

Post by jchen1 » 2019/12/08 19:50:40

A question from my other post,which is not receiving any reply yet.

I am trying to install screen, but is receiving the following error messages:
[root@T30 ~]# yum -y install screen
Last metadata expiration check: 0:38:28 ago on Sun 08 Dec 2019 01:09:55 PM CST.
No match for argument: screen
Error: Unable to find a match
Any suggestions? Thanks a lot.

Post Reply

Return to “CentOS 8 - General Support”