Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
xrdb: can't open display ''
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
bluedot951
n00b
n00b


Joined: 31 Mar 2012
Posts: 11

PostPosted: Sat Mar 31, 2012 12:34 am    Post subject: xrdb: can't open display '' Reply with quote

Hey guys,

First time on the forums, so I apologize if I post this in the wrong place. Anyway, I recently updated my .xinitrc file, to include the following:

if [ -f $HOME/.Xdefaults ]; then
xrdb -merge $HOME/.Xdefaults
fi
xset +fp /usr/share/fonts/corefonts
exec gnome-session

Everything is fine when I use gnome-terminal, but whenever I log in using a tty, it says "xrdb: can't open display ' ' ". How can I fix this? Is there a way to mute xrdb? If not, what can I do? Please feel free to ask for any logs / more information (though please give detailed information on how to get it). Thanks in advance for your help!

~bluedot951
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Sat Mar 31, 2012 1:18 am    Post subject: Reply with quote

Quote:
Everything is fine when I use gnome-terminal, but whenever I log in using a tty, it says "xrdb: can't open display ' ' ".

There is no display in a console. The reason you can execute that merge from a gnome-terminal is because X is running.
Code:
bill@gentoo-gateway ~ $ env | grep DISPLAY
DISPLAY=:0

Hope that helps :wink:
Back to top
View user's profile Send private message
bluedot951
n00b
n00b


Joined: 31 Mar 2012
Posts: 11

PostPosted: Sat Mar 31, 2012 1:23 am    Post subject: Reply with quote

Thanks for the reply! But is there a way to make it not show up? I mean it's not a big problem, but it's a slight eyesore. Thanks for your help!
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Sat Mar 31, 2012 1:37 am    Post subject: Reply with quote

bluedot951,
Code:
xrdb -merge $HOME/.Xdefaults >/dev/null
should do it :wink:
Back to top
View user's profile Send private message
bluedot951
n00b
n00b


Joined: 31 Mar 2012
Posts: 11

PostPosted: Sat Mar 31, 2012 1:40 am    Post subject: Reply with quote

I think I got it! I'm yet to actually try it out, but just doing [ -n "${DISPLAY+x}" ] should tell me if display is set. I'll just run the command if it is set
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Sat Mar 31, 2012 1:51 am    Post subject: Reply with quote

Try this

Code:
[[ -n ${DISPLAY} ]] && echo "yes" || echo "no"

Just paste it to a cl to try it then change DISPLAY to a non existent variable to get 'no"
Back to top
View user's profile Send private message
bluedot951
n00b
n00b


Joined: 31 Mar 2012
Posts: 11

PostPosted: Sat Mar 31, 2012 3:52 am    Post subject: Reply with quote

Hey Bill,

Thanks for all your help so far! I tried echoing the output into /dev/null, but that didn't work. Also, when I inserted the other statements you said, they worked in the shell, but when I put them into the file they seemed to make no difference. Do you think that this problem could be originating from a different file?

Thanks!

Update: I tried just doing xrdb -merge .Xdefaults > /dev/null directly from the CLI and that also gave the same error...
Update 2: Got it! Me being the genius I am (not) put the xrdb command in my bashrc. I removed it from there and the problem's gone! Thanks again for all your help!
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Sat Mar 31, 2012 4:29 am    Post subject: Reply with quote

bluedot951,

This should do it
Replace
Code:
if [ -f $HOME/.Xdefaults ]; then
xrdb -merge $HOME/.Xdefaults
fi

with
Code:
[[ -e $HOME/.Xdefaults ]] && [[ -n ${DISPLAY} ]] && xrdb -merge $HOME/.Xdefaults  >/dev/null 2>&1

It will execute the merge if the file exists and DISPLAY is non-zero length which means it will not execute from the console.

I tried the same thing you did just now and got the error, but adding 2>&1 took care of that.

Let me know how you do with it - Good luck :wink:
Back to top
View user's profile Send private message
bluedot951
n00b
n00b


Joined: 31 Mar 2012
Posts: 11

PostPosted: Sat Mar 31, 2012 5:02 am    Post subject: Reply with quote

Yeah, I got it to work! Thanks for all your help! BTW, I didn't end up using your last tip, because the problem was in .bashrc, there was nothing wrong with your original script (the one I used). I just had an xrdb -merge line in my bashrc and I didn't realize that. Thanks for all your help with this! Is there anyway I can thank you on the forum ("Solution, " "Kudos," etc.)? Please let me know if there is.

Thanks,
bluedot951
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Sat Mar 31, 2012 5:15 am    Post subject: Reply with quote

bluedot951,

Glad it worked for you, you can buy me a virtual beer - enjoy 8)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum