• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 297
  • Last Modified:

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.
0
Rajat Sehgal
Asked:
Rajat Sehgal
  • 7
  • 5
  • 3
1 Solution
 
dfkeCommented:
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
0
 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
Output :-
[root@119 ~]# echo $DISPLAY

[root@119 ~]#

There is nothing output
0
 
dfkeCommented:
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
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
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 ~]#
0
 
dfkeCommented:
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
0
 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
no i didn't, there is configured only IPV4.
0
 
dfkeCommented:
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
1
 
serialbandCommented:
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
0
 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
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:
0
 
serialbandCommented:
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.
0
 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
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:
0
 
serialbandCommented:
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.
0
 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
Hi,
It's working after reinstall CentOS 7.4

Cool Thanks Everyone
0
 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
I didn't get solution after a long discussion, after that i'd to reinstall OS. Now its working fine.
0
 
dfkeCommented:
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
1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

  • 7
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now