Header Shadow Image


VLC: VideoLAN video player: Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminated abnormally with the following error: No protocol specified

The VLC player is rumoured to be one of the best players to day for playing many different formats including mts and m2ts proprietary SONY formats. (Which just so happens to be the format of my Camcorder movies)  This is the way my camcorder has been saving them in and to date, there are few if any players out there capable of playing such files without first converting them (A notable exception is now Windows 7 that has this capability built in natively).

Thankfully the VLC player does the job neatly playing these two type of files well on my recent Windows 7 installation.  However, I wanted to play it on Linux where I work and would like to watch the occassional movie.  I was glad to see that VLC has copies for Linux as well.  Unfortunately, it does not run natively from the previlidged root account and requires a regular no previlidged user account.  Here is how to satisfy these conditions, run VLC from an unprevilidged account while you are logged in through the root account.

A NOTE OF CAUTION:

Running anything from the previlidged account is generally frowned upon: meaning you should NOT run things from the previlidged user unless you really, really know what it is that you're doing.  The general practice is to run non critical system software from unprevilidged users so in case of compromise, the compromise is contained to that user only.  Good network security (ie a secure firewall and/or router configuration) is also mandatory here to prevent uninvited guests.  The reader will need to judge if these instructions are appropriate for their environment, otherwise the below instructions are NOT recommended.

YOU HAVE BEEN WARNED

 

QUICK INSTRUCTIONS

To run VLC player from a non previlidged account while you are logged in using root, a previlidged account, below is a set of quick steps to accomplish this.  These steps will create a non previlidged account to run VLC from, setup a menu icon to run it at a click of a button, all while logged into the previlidged root account:

  1. Run useradd -d /home/videouser -s /bin/bash videouser  (You may change the options to suit your environment.  If you already have a user, you can substite that user instead of videouser)
     
  2. Set a password for this user: # passwd videouser
     
  3. Check the permissions of the X11 socket (You may see something like srwxrwxrwx meaning permissions are fine):
    ll /tmp/.X11-unix/X0

     

     

     

     

  4. Copy the ~/.Xauthority to the users home folder and modify ownership (A copy may also be under /var/run/kdm in case yours is empty- see below):
    # scp -rp /root/.Xauthority /home/videouser/
    # chown videouser /home/videouser/.Xauthority
    # chgrp videouser /home/videouser/.Xauthority
     
  5. (Optional) Modify the launcher icon to run the follwing command:
    # su – videouser -c 'vlc' %U
     
  6. (Optional) Create a script to run and prepare the environment so VLC Player will work after reboots.
     

 

INVESTIGATION / RESOLUTION

Having said this, here is the original issue and the eventual investigation and resolution steps:

[root@tom ~]# vlc
VLC is not supposed to be run as root. Sorry.
If you need to use real-time priorities and/or privileged TCP ports
you can use vlc-wrapper (make sure it is Set-UID root and
cannot be run by non-trusted users first).
[root@tom ~]# vlc-wrapper
Cannot determine unprivileged user for VLC!                                                                                            
[root@tom ~]#

So the natural course of action is to run it as a non privilidged user as such:

[root@tom ~] # sudo -u videouser /usr/bin/vlc
VLC media player 1.0.6 Goldeneye
[0x863d8e0] main libvlc error: cannot open config file (/root/.config/vlc/vlcrc): Permission denied
[0x876e7e8] inhibit interface error: Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminated abnormally with the following error: No protocol specified                                                                                                                                             
Autolaunch error: X11 initialization failed.                                                                                                               
                                                                                                                                                           
[0x876e7e8] main interface error: no suitable interface module
[0x863d8e0] main libvlc error: interface "inhibit,none" initialization failed
No protocol specified
[0x863de58] main interface error: no suitable interface module
[0x863d8e0] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x863d8e0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
No protocol specified
[0x863de08] qt4 interface error: Could not connect to X server
No protocol specified
[0x863de08] skins2 interface error: Cannot open display
[0x863de08] skins2 interface error: cannot initialize OSFactory
Remote control interface initialized. Type `help' for help.
quit
quit: returned 0 (no error)
[0x876a8b0] main playlist error: could not create /root/.local/share/vlc: Permission denied
status change: ( stop state: 0 )
status change: ( quit )
[0x863d8e0] main libvlc error: could not create /root/.config/vlc: Permission denied
[0x863d8e0] main libvlc error: no configuration directory
[0x863d8e0] main libvlc error: could not create /root/.cache/vlc: Permission denied
 

 

FIRST PROBLEM
[0x863d8e0] main libvlc error: cannot open config file (/root/.config/vlc/vlcrc): Permission denied

FIRST SOLUTION
[root@tom ~] # su – videouser -c '/usr/bin/vlc'

this resolved other permission problems above as well because it is now, in essence, a login shell (The dash after su and before tom).  Next I run the new command to get:

[root@tom ~] # su – videouser -c '/usr/bin/vlc'
VLC media player 1.0.6 Goldeneye
[0xa019bb0] inhibit interface error: Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminated abnormally with the following error: No protocol specified                                                                                                                                             
Autolaunch error: X11 initialization failed.                                                                                                               
                                                                                                                                                           
[0xa019bb0] main interface error: no suitable interface module
[0x9f6f088] main libvlc error: interface "inhibit,none" initialization failed
No protocol specified
[0xa014578] main interface error: no suitable interface module
[0x9f6f088] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x9f6f088] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
No protocol specified
[0xa014988] qt4 interface error: Could not connect to X server
No protocol specified
[0xa014988] skins2 interface error: Cannot open display
[0xa014988] skins2 interface error: cannot initialize OSFactory
Remote control interface initialized. Type `help' for help.
[root@tom ~] #

Bringing us to the original problem we will discuss: An X server permission problem. Need to run VLC from the same user as the one that is logged into the GUI.

The solution here was the result of a little bit of help from the VideoLAN folks though the end result was somewhat different  You need to give the user permission to read and write the X11 socket (usually /tmp/.X11-unix/X0) and read the cookie file (~/.Xauthority).

Permissions are fine for the socket file:

[root@tom ~]# ll /tmp/.X11-unix/X0
114479 srwxrwxrwx 1 root root 0 Jul  9 21:48 /tmp/.X11-unix/X0

But not the ~/.Xauthority which resides in the root folder.
 

 

FIRST SOLUTION

Note that the SECOND SOLUTION to this issue is recommended over this one.  The root account (and folder) is not accessible to any users and so cannot be changed in any secure fashion.  This is because one would need to add the user account to the root group (ie elevate the user account permissions which would open a relatively BIG security hole)

[videouser@tom .X11-unix]$ ll -d /root/
dr-xr-x—. 138 root root 20480 Jul  9 22:38 /root/
[videouser@tom .X11-unix]$

How to elevate the user account permissions?

Add user videouser to the root group (NOT recommended.  See alternative below)

[root@tom ~]# usermod -G root videouser

or edit the /etc/group file to add it there manually:

[videouser@tom ~]$ id videouser
uid=504(videouser) gid=504(videouser) groups=504(videouser),0(root)
[videouser@tom ~]$ id root
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),7(lp),10(wheel)
[videouser@tom ~]$

Don't forget to modify the .Xauthority file to give the root group read access (videouser will be able to read since videouser is in the group):

[videouser@tom ~]$ ll /root/.Xauthority
-rw——- 1 root root 1376 Jul  9 22:38 /root/.Xauthority
[videouser@tom ~]$

Followed by some modifications of the file itself from within the root account:

[root@tom ~]# ll ~/.Xauthority
2650538 -rw——- 1 root root 1376 Jul  9 22:38 /root/.Xauthority
[root@tom ~]#
[root@tom ~]# chmod 644 /root/.Xauthority
[root@tom ~]# ll /root/.Xauthority
2650538 -rw-r—– 1 root root 1376 Jul  9 22:38 /root/.Xauthority
[root@tom ~]#

Then either:

[videouser@tom ~]$ scp -rp /root/.Xauthority .

or better yet simply link the files:

[tom@tom ~]$ ln -s /root/.Xauthority
[tom@tom ~]$ ls -al
lrwxrwxrwx   1 videouser  videouser     17 Jul 10 00:04 .Xauthority -> /root/.Xauthority

And the player GUI finally worked:

[videouser@tom ~]$ vlc
VLC media player 1.0.6 Goldeneye
[0x8e31088] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
 

VideoLAN VLC Player Player Started

 

SECOND SOLUTION

Instead of linking to the ~/.Xauthority simply copy the file instead and change ownership to the videouser:

[root@tom ~]# scp -rp /root/.Xauthority /home/videouser/
[root@tom ~]# chown videouser /home/videouser/.Xauthority
[root@tom ~]# chgrp videouser /home/videouser/.Xauthority
[root@tom ~]#

[videouser@tom ~]$ ls -al
total 340
drwxr-xr-x  30 tom  tom   4096 Jul 10 01:10 .
drwxr-xr-x. 12 root root  4096 Oct  1  2009 ..
-rw——-   1 tom  tom      0 Jun  4  2006 .ICEauthority
-rw-r—–   1 tom  tom   1376 Jul  9 22:38 .Xauthority
.
.
.

Then ran VLC and it ran smoothly again.  This is a slightly safer approach as it doesn't expose the root account to such a degree as before (Through elevation of a regular user account by assigning the user to the root group).  This will allow the player to work for this session but upon reboot, the player won't work again.  See below to counter this issue. 

 

VLC GUI LAUNCHER MODIFICATION

To get the VLC player to work from the Gnome Menu's, you can change the command line of the icon it installs under to call:

Command: su – videouser -c 'vlc' %U

instead of:

Command: vlc %U

by editing the icon properties from System -> Preferences -> Main Menu.   The words Main Menu is short for the Alacarte GNOME Menu Editor (No idea why why the menu icon doesn't use this name. ).  The complete panel with the new VLC settings appears like this:

/VideoLAN VLC Player Alacarte Gnome Menu Editor.jpg


I don't have that menu editor?

If you are missing the icon/utility, you can install it in the following manner:

[root@tom ~]# yum install alacarte

after checking that you can find it using:

[root@tom ~]# yum search alacarte
.
.
.
alacarte.noarch : Menu editor for the GNOME desktop
Repo        : fedora
Matched from:
Description : Alacarte is a graphical menu editor that lets you edit, add, and delete
            : menu entries. It follows the freedesktop.org menu specification and
            : should work with any desktop environment that uses this specification.

 

POST PROBLEMS / SOLUTIONS

Why is the video choppy and I see "computer too slow ?" when running VLC from the command line?

The reason why I got this in this case was because, as the message says, my computer is too slow.  Once the player is working, when I try to play mts/m2ts files, I get:

[root@tom ~]# su – videouser -c 'vlc'
VLC media player 1.0.6 Goldeneye
[0x84be088] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 256
[0xb73b6a90] a52 decoder: A/52 channels:6 samplerate:48000 bitrate:448000
[0x87b9640] pulse audio output: No. of Audio Channels: 6
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
illegal short term buffer state detected
No accelerated IMDCT transform found
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::begin: Paint device returned engine == 0, type: 1
[0xb7379810] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
[0xb7379810] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
[0xb7379810] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
QPainter::begin: Paint device returned engine == 0, type: 1
libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 256
[0xb48f66f0] a52 decoder: A/52 channels:6 samplerate:48000 bitrate:448000
[0x87b9640] pulse audio output: No. of Audio Channels: 6
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
No accelerated IMDCT transform found
illegal short term buffer state detected
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::begin: Paint device returned engine == 0, type: 1
[0xb48f6f70] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
[0xb48f6f70] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
[0xb48f6f70] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
number of reference frames exceeds max (probably corrupt input), discarding one
number of reference frames exceeds max (probably corrupt input), discarding one
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::begin: Paint device returned engine == 0, type: 1
[root@tom ~]#

Checking with top while VLC is running, I do see that:

[root@tom ~]# top

top – 00:33:06 up  2:47,  5 users,  load average: 0.93, 1.04, 0.69
Tasks: 200 total,   2 running, 197 sleeping,   0 stopped,   1 zombie
Cpu(s): 96.0%us,  2.6%sy,  1.3%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2062152k total,  1644200k used,   417952k free,    56312k buffers
Swap:  2530196k total,        0k used,  2530196k free,   957984k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                       
 7707 tom       20   0  258m  95m  58m S 88.5  4.8   0:08.81 vlc                                                                                           
 7769 tom       20   0  149m 3192 2684 S  4.6  0.2   0:00.47 pulseaudio                                                                                    
 1913 root      20   0  106m  22m  10m S  3.0  1.1   2:50.24 X       

so it looks like my computer is indeed too slow because VLC alone is using 88.5% of the entire systems CPU time just to play one video.  8^(

 

The player doesn't work again after I reboot?  What's going on?

The only problem with the second method is that you may have to recopy the ~/.Xauthority file when you relogin again because it will change:

[root@tom ~]# su – videouser -c 'vlc' %U
VLC media player 1.0.6 Goldeneye
[0x9ba6f18] inhibit interface error: Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminated abnormally with the following error: Invalid MIT-MAGIC-COOKIE-1 keyAutolaunch error: X11 initialization failed.

something that of course can be scripted, since, after all, you are logging into the root account anyway.  A short script that is essentially the steps from the second approach, can be called before launching the VLC Player of the GUI icon command line:

[root@tom ~]# cat /usr/bin/vlc-root
#!/bin/bash
uuser="videouser";

# Newer configurations store a custom Xauthority file under /var/run/kdm, if you use KDM login
# manager. (See one of the issues below for this.)
lxa=$(ls /var/run/kdm/.Xauth*|tail -1)
if [[ $lxa != “” ]]; then
        xaa=$(diff ~/.Xauthority $lxa);
        if [[ $xaa != “” ]]; then                                                                 
                /usr/bin/scp -rp $lxa /root/.Xauthority;
        fi
fi

# Now handle the individual user based .Xauthority file.
dax=$(diff ~/.Xauthority /home/$uuser/.Xauthority);
if [[ $dax != “” ]]; then
        /usr/bin/scp -rp /root/.Xauthority /home/$uuser/;
        chown $uuser /home/$uuser/.Xauthority;
        chgrp $uuser /home/$uuser/.Xauthority;
fi
su – $uuser -c 'vlc' %U;
[root@tom ~ ]#

Then modify the Launcher Icon to call the new script:

Command: /usr/bin/vlc-root

 

 

My .Xauthority file is empty and I still get the error?

Try to create the .Xauthority file using this:

[videouser@htpc ~]$ mkxauth -c
adding key for htpc.localhost to /home/videouser/.Xauthority … done
[videouser@htpc ~]$

Alternately, follow this post on to enable a different Desktop Manager instead of the default GNOME manager which doesn't automatically generate a .Xauthority file.

A third option is to look in the /var/run/kdm folder for a .Xauth* file (Once you enable the KDM login manager above):

[root@htpc videouser]# xauth
Using authority file /var/run/kdm/.XauthrCyKna
xauth> list
(list of keys follows)
xauth> quit
[root@htpc videouser]# scp /var/run/kdm/.XauthrCyKna /root/.Xauthority
[root@htpc videouser]# ll /root/.Xauthority
-rw——- 1 root root 218 Jul 25 02:01 /root/.Xauthority
[root@htpc videouser]# scp /root/.Xauthority .
[root@htpc videouser]# pwd
/home/videouser
[root@htpc videouser]#

And there you have it.  Your VLC player should now start. 

 

 

My DVD disks don't play in VLC media player?

So I pop in my Bourne Identity DVD into the DVD Player of my Fedora HTPC expecting to see a movie but get this instead:

libdvdnav: Using dvdnav version 4.1.4
libdvdread: Encrypted DVD support unavailable.
libdvdnav: DVD Title: THE_BOURNE_IDENTITY
libdvdnav: DVD Serial Number: 2d760f14
libdvdnav: DVD Title (Alternative):
libdvdnav: Unable to find map file '/home/videouser/.dvdnav/THE_BOURNE_IDENTITY.map'
libdvdnav: DVD disk reports itself with Region mask 0x00fe0000. Regions: 1
[0xb7302198] main input error: ES_OUT_RESET_PCR called
[0xb7302198] main input error: ES_OUT_RESET_PCR called
[0xb7302198] main input error: ES_OUT_RESET_PCR called
[0xb7302198] main input error: ES_OUT_RESET_PCR called

It appears I'm missing the livdvdcss and libdvdcss2 libraries as noted on the VideoLAN site.  However the instructions there point to using the subversion repositories which might mean some fancy compiling.  I'd rather use RPM / YUM so off I went searching for a suitable RPM of the packages.  Sure enough, the folks at the ATrpms site had what I was looking for.  After spending a few minutes configuring my yum /etc/yum.conf file according to their instructions I was greeted with a proper list of RPM's related (at least seemingly) to what I needed:

# yum search libdvdcss
libdvdcss2.i686 : Shared libraries for package libdvdcss
Repo        : atrpms
Matched from:
Description : This package provides the shared libraries libdvdcss.so.2* for
            : the package libdvdcss. Shared libraries are required at
            : runtime for software built against libdvdcss. Keeping shared
            : libraries in a separate package enables their use as
            : forward/backward compatibility packages.
URL         : http://www.videolan.org/libdvdcss/

libdvdcss.i686 : A portable abstraction library for DVD decryption
Repo        : atrpms
Matched from:
URL         : http://www.videolan.org/libdvdcss/

Strangely enough, the URL for the libdvdcss had a link back to videolan.org yet I couldn't locate a suitable RPM on the videolan.org site.  Nontheless, I proceeded to install the libraries trying to add libbluray along with it (Maybe I'll get one of these in the future) but it looks like libbluray is a tougher find.

# yum install libdvdcss2.i686 libdvdcss.i686 libdvdcss-devel.i686
.
.
Complete!

#

Trying again, I get my movie.

 

 

When playing movies under the root account I get no sound.  What do I do now?

This is what I get when I try running from the root account using an unprivilidged user:

# /usr/bin/vlc-root
.
[0xb71013e0] pulse audio output error: Failed to connect to server: Connection refused
.
.
ALSA lib conf.c:4633:(snd_config_expand) Evaluate error: Permission denied
.
[0xb71013e0] oss audio output error: cannot open audio device (/dev/dsp)
.
.
.

Turns out that I needed to edit the /etc/group file and add videouser user to the audio user group of users who are allowed to have audio while the root login is in session.  The line should like like this:

# cat /etc/group|egrep -i "audio|pulse"
audio:x:63:videouser,root
pulse:x:474:videouser,root
pulse-access:x:473:videouser,root

after editing from:

# cat /etc/group|egrep -i "audio|pulse"
audio:x:63:
pulse:x:474:
pulse-access:x:473:

and sure enough, there was sound.  However, the pulseaudio still showed the error.  Appears a reboot is in order.

 

I still have issues?

Feel free to leave me a comment below.  🙂

Cheers!
TK
 

7 Responses to “VLC: VideoLAN video player: Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminated abnormally with the following error: No protocol specified”

  1. […] as I had the same question. In essence, you would still have some security in this manner: http://www.microdevsys.com/WordPress…col-specified/ Good Luck! […]

  2. […] would still be logged in with the root account), but it should be usable for your purposes: VLC: VideoLAN video player: Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminat… HAOF Reply With Quote + Reply to […]

  3. Hi TK,

    I´m trying to stream a video file without graphic interface using cvlc, and i have the error that u describe in the post. I don´t have any graphic package instaled. I tryed what you said but I can find /tmp/.X11-unix/X0, I´m using centos and installed vlc without errors. Do u have some hint?
    thanks in advance
    Luis

    [00000391] inhibit interface error: Failed to connect to the D-Bus session daemon: Failed to execute dbus-launch to autolaunch D-Bus session
    [00000391] main interface error: no suitable interface module

  4. Hi Luis,

    Could you post some lines before and after the Failed to connect to the D-Bus session daemon:” error above? Also, what is the command line that you are running that is resulting in the above error?

    Thanks,
    TK

  5. Hi i have done same thing for videouser add in groups also as u said

     

    but even then me getting same error alsa refused etc.. wat to do from root is vlc working fine but not from video user

  6. Also can u update me wat important command line i need to pass with ./configure for vlc source configuation like –enable-alsa etc wat else total pls specisy

  7. Would you be able to list the contents of the files as I had above and provide some CLI output here?

    Cheers,
    TK

Leave a Reply

You must be logged in to post a comment.


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License