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.
LinuxLinux SecurityLinux NetworkingLinux OS DevLinux Distributions

Avatar of undefined
Last Comment
dfke
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
Rajat Sehgal
Flag of India image

ASKER

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

[root@119 ~]#

There is nothing output
Avatar of dfke
dfke

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
Avatar of Rajat Sehgal
Rajat Sehgal
Flag of India image

ASKER

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 ~]#
Avatar of dfke
dfke

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
Avatar of Rajat Sehgal
Rajat Sehgal
Flag of India image

ASKER

no i didn't, there is configured only IPV4.
Avatar of dfke
dfke

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
Avatar of serialband
serialband
Flag of Ukraine image

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
Avatar of Rajat Sehgal
Rajat Sehgal
Flag of India image

ASKER

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:
Avatar of serialband
serialband
Flag of Ukraine image

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.
Avatar of Rajat Sehgal
Rajat Sehgal
Flag of India image

ASKER

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:
Avatar of serialband
serialband
Flag of Ukraine image

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Rajat Sehgal
Rajat Sehgal
Flag of India image

ASKER

I didn't get solution after a long discussion, after that i'd to reinstall OS. Now its working fine.
Avatar of dfke
dfke

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
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

70K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo