View previous topic :: View next topic |
Author |
Message |
alexaltair n00b
Joined: 12 Jun 2003 Posts: 24
|
Posted: Mon Aug 18, 2003 6:53 pm Post subject: mplayer: ... vo: couldn't open the X11 display (:0.0)! |
|
|
I did emerge mplayer and now when I try to play video file it fails with message:
====
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
vo: couldn't open the X11 display (:0.0)!
Error opening/initializing the selected video_out (-vo) device.
====
Please help. |
|
Back to top |
|
|
hensan l33t
Joined: 26 Jun 2003 Posts: 868 Location: Sweden
|
Posted: Mon Aug 18, 2003 7:04 pm Post subject: |
|
|
Did you try running mplayer as root while being logged into X as regular user?
As default only the user who logged into X can open new windows. To allow other users (like root) to open windows you must run 'xhost + localhost'.
The easiest sollution is of course to just run mplayer as the user that logged into X. |
|
Back to top |
|
|
grant.mcdorman Apprentice
Joined: 29 Jan 2003 Posts: 295 Location: Toronto, ON, Canada
|
Posted: Mon Aug 18, 2003 7:06 pm Post subject: Re: mplayer: ... vo: couldn't open the X11 display (:0.0)! |
|
|
alexaltair wrote: | I did emerge mplayer and now when I try to play video file it fails with message:
====
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
vo: couldn't open the X11 display (:0.0)!
Error opening/initializing the selected video_out (-vo) device.
====
Please help. | This sounds like an authorization error.
Are you running mplayer using the same user you signed on to X (or, if you're using startx, the same user that started it)?
If not, that's why. If you have to run as a different user, the secure way of fixing it is to do something like (running as the user in X, and _user_using_mplayer_ is the user that wants to run mplayer): Code: | xauth extract $DISPLAY - | su _user_using_mplayer_ -c 'xauth merge -' | The less secure way is and the no-security way is Look at xauth and xhost man pages for more details. |
|
Back to top |
|
|
alexaltair n00b
Joined: 12 Jun 2003 Posts: 24
|
Posted: Mon Aug 18, 2003 10:24 pm Post subject: |
|
|
Yes, I was running MPlayer as 'root'. BTW not only MPlayer reports such error. I was installing Enemy Territory and it failed to gain access to X.
I did "xhost +localhost" and everything works now. Thanks for help. |
|
Back to top |
|
|
grant.mcdorman Apprentice
Joined: 29 Jan 2003 Posts: 295 Location: Toronto, ON, Canada
|
Posted: Mon Aug 18, 2003 11:59 pm Post subject: |
|
|
alexaltair wrote: | Yes, I was running MPlayer as 'root'. BTW not only MPlayer reports such error. I was installing Enemy Territory and it failed to gain access to X.
I did "xhost +localhost" and everything works now. Thanks for help. | For applications running as root, the following bash fragment will give them access to the display (since root can read your private files): Code: | if [ -if /var/run/console.lock]; then
# this weirdness is so ~username gets expanded properly
XAUTHORITY="`eval echo ~\`cat /var/run/console.lock\`/.Xauthority`"
export XAUTHORITY
fi |
An alterative is to set up sudo; it preserves your display access permissions (i.e. sudo mplayer will run mplayer as root, but allow access to the display, if you've set up the sudo configuration correctly; to do so, do visudo as root).
Another alternative is, if - as the user logged into X - you do: Code: | XAUTHORITY=~/.Xauthority;export XAUTHORITY | then PAM will properly copy your authentication when you su to root.
However, why do you need to run mplayer (or other X apps) as root? That shouldn't be necessary. |
|
Back to top |
|
|
|