Link to home
Start Free TrialLog in
Avatar of Rajat Sehgal
Rajat SehgalFlag for India

asked on

Failed to parse arguments: Cannot open display:

Hello Experts,

Getting following error while execute cmd from ssh :-

[root@200 ~]# separateBod
ENTER SERVER IP LAST 1 QUADRANT WHICH YOU WANT TO BOD:
119
Option "-t" is deprecated and might be removed in a later version of gnome-terminal.
Option "-t" is deprecated and might be removed in a later version of gnome-terminal.
Failed to parse arguments: Cannot open display:

separateBod Code:-
#!/bin/bash
printf "ENTER SERVER IP LAST 1 QUADRANT WHICH YOU WANT TO BOD"
 read IPNAME
 for i in $IPNAME
 do
  ssh user@192.168.1.$i BOD & pid=$!
 done

BOD Code:-
#!/bin/bash
gnome-terminal \
        --tab -t "Exchange" -e " sh -c 'sleep 1s; ./startapp Exchange' "\
        --tab -t "Dragon" -e " sh -c 'sleep 10s; ./startapp Dragon' "\

startapp code:-
ulimit -c unlimited
export LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH}
./$1 $2 $3 $4 $5

After giving execution cmd from server (ssh) it should be displayed on other server vnc (user@192.168.1.119), it was working properly till last week suddenly i got this error, we have following versions of CentOS 64bit (6.7, 6.8, 6.9, 7.4), getting issue only with 7.4 64bit.

please suggest.
Avatar of dfke
dfke

Hi,

it seems you have an issue with your display setting.

What output do you get if you issue 'echo $DISPLAY'?

The output should be something like - :0 or 0:0

Cheers
Avatar of Rajat Sehgal

ASKER

Output :-
[root@119 ~]# echo $DISPLAY

[root@119 ~]#

There is nothing output
Hi,

Okay can you check if the particular user has an ~/.Xauthority file? This file is needed as it contains the MIT-MAGIC-COOKIE.

If not then probably xorg-x11-xauth is not installed or not correctly installed with the minimal package set.

When using MIT-MAGIC-COOKIE-1, the client sends a 128 bit “cookie” along with the connection setup information. If the cookie presented by the client matches one that the X server has, the connection is allowed access.

If ~/.Xauthority is not present then try to install xorg-x11-xauth
yum -y install xorg-x11-xauth

Open in new window


Then close the ssh connection to your remote server and give it another try.

Cheers
Xauthority file already available in system

[root@119 ~]# yum -y install xorg-x11-xauth
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package 1:xorg-x11-xauth-1.0.9-1.el7.x86_64 already installed and latest version
Nothing to do
[root@119 ~]#
Hi,

now that's interesting!

Another thing that just crossed my mind is that when IPV6 is disabled , then any ssh client that connects to it and tries to use X11 forwarding will fail to set the DISPLAY variable and thus X11 forwarding will not work. Unless the server is explicitly configured to listen only to IPV4.

The reason is because the default setting is to listen to both IPV4 and IPV6 at the same time.

So did you by any means disable IPV6?

Cheers
no i didn't, there is configured only IPV4.
Hi,

sad to say that I'm out of options at this point. I will give it some more thought when I'm not too busy working.

You forgot to mention if you had a ~/.Xauthority file by the way. Is it even there?

Cheers
Option "-t" is deprecated and might be removed in a later version of gnome-terminal.
Failed to parse arguments: Cannot open display:
Maybe change your script and replace the -t with --title
No improvement after implementation --title

Option "--title" is deprecated and might be removed in a later version of gnome-terminal.
Option "--title" is deprecated and might be removed in a later version of gnome-terminal.
Failed to parse arguments: Cannot open display:
The error is that it failed to pars arguments, and the suspect argument is identified in the messages above.  Then try removing the --title section to see if that fixes it.
nope, after removing we get following:-

[root@200]# separateBod
ENTER SERVER IP LAST 1 QUADRANT WHICH YOU WANT TO BOD:
119
Failed to parse arguments: Cannot open display:
Ok, then one of your other lines of code is bad.  I'd put back the gnome lines and take out one of the other lines to see which one it  might be.
ASKER CERTIFIED SOLUTION
Avatar of Rajat Sehgal
Rajat Sehgal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I didn't get solution after a long discussion, after that i'd to reinstall OS. Now its working fine.
Hi,

good that things worked out :)  The issue however must have been the fact that the display variable at some point wasn't set for some reason. Sometimes it's better to reinstall like you did. it saves alot of time.

Cheers