Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


Search this Thread
Old 11-30-2009, 03:19 AM   #1
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware 10.1
Posts: 101

Rep: Reputation: 17
VLC + sudo = "cannot find any file in directory" error

I actually posted this in the forum, but since it's possible my problem may be caused by something system-related as opposed to VLC-related, I figured I'd post it here too to get a different opinion/perspective. I apologize if "cross posting" this is considered bad form or doesn't belong in this specific forum. I'll be happy to delete/move it if necessary.

I'm trying to run vlc's http interface on my server to stream music and movies on my local network. I have two instances of vlc loading- one for video, one for music. To help differentiate between them, I've copied the files from /usr/local/share/vlc/http into two separate directories (say, /var/www/vlcstream1 & /var/www/vlcstream2) and have made minor changes to the stylesheet definitions.

I have created a user on my server, called 'media', which is a user account that I want to run the vlc media servers under, which has access to specific directories containing media to stream, since vlc cannot (and I don't really want to) run as root. User 'media' belongs to group 'media', which is the group (with r-x privileges) for the /var/www/stream1 and /var/www/stream2 directories mentioned above.

I am trying to get these vlc servers to start when the system boots. I'm doing this by executing the vlc commands I need, using sudo for my 'media' user, from within a script written by myself called, and is called by rc.local. This all works.

The problem is that when I execute the sudo vlc command:
sudo -s -b -u media /usr/local/bin/cvlc -vvv --color --sout "#transcode{acodec=vorb,ab=192}:std{access=shout,mux=ogg,dst=source:mypass@}" -I http --http-src "/var/www/stream1" --http-continuous --http-host &> /var/log/streams/vlc-14990-stream1.log root, manually (not by running rc.mediad) from within a terminal, it works fine!
But when I run rc.mediad, I'm encountering this error in the logs:
[0x8a056e8] http interface error: cannot find any file in directory "/var/www/stream1"
I have no idea why. Obviously there is something different between running vlc in a terminal versus running it from a script, but can't figure out what it is.
I've even examined some of the code in vlc/modules/control/http/util.c and vlc/modules/control/http/http.c to try and pinpoint where things are failing, but I've only been able to go so far as I don't do a lot with C and debugging. What I have found that in function ParseDirectory, a call to utf8_opendir is causing it to return value VLC_EGENERIC (or int value -666), which makes me suspect some kind of UTF8 filesystem problem (?), but I'm not sure exactly how to proceed.

I have done the usual checks: permissions on the /var/www/stream1 & /var/www/stream2 directories, ensured they each have a .hosts file (with proper permissions & configuration), and nothing makes a difference. When I remove the --http-src argument in the command (forcing it to use the files in /usr/local/share/vlc/http/), it works fine... from the rc.mediad script.

So I suspect either I'm missing something extremely obvious that I'm oblivious to, or dare I say I may have found a 'bug' with vlc itself (unless this is somehow intentional)??

I'm using vlc 1.0.3, compiled from source on the same system I'm trying to run it on.

Does anyone have any ideas? Perhaps someone know something I don't?

Any help would be greatly appreciated.

- skubik
Old 11-30-2009, 08:13 AM   #2
Senior Member
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 82
does the user media belong to the http or www or www-data group, whichever is relevant to and owns your /var/www webroot?
Old 11-30-2009, 01:29 PM   #3
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware 10.1
Posts: 101

Original Poster
Rep: Reputation: 17
Originally Posted by irishbitte View Post
does the user media belong to the http or www or www-data group, whichever is relevant to and owns your /var/www webroot?
User 'media' belongs to a group called 'media', but not 'www'.
Permissions look like this:
drwxrwxr-x www www /var/www
drwxr-sr-x root media /var/www/stream1

I have tried setting perms for /var/www/stream1 to 777, but did not resolve anything.
The setuid bit is set for the group on /var/www/stream1 because it is set on the /usr/local/share/vlc/http directory (granted, it's gid is 1000, whereas my 'media' group is not). This was more a desperation move on my part to try and replicate the original directory in it's entirety.
I have also tried changing the gid to 1000 and still doesn't seem to work.

What I don't understand is how it /will/ work when I copy-and-paste the command from my script and run it from my terminal, yet when I run the script itself from the same terminal, I get the error??

Old 11-30-2009, 01:52 PM   #4
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware 10.1
Posts: 101

Original Poster
Rep: Reputation: 17

So I've resolved the problem, thanks to a solution from the other forum I posted this too. I'll post the solution here for completeness.

Turns out the problem was with the QUOTES around the directory argument to the --http-src flag. That is:

sudo -s -b -u media /usr/local/bin/cvlc -vvv --color --sout "#transcode{acodec=vorb,ab=192}:std{access=shout,mux=ogg,dst=source:mypass@}" -I http --http-src "/var/www/stream1" --http-continuous --http-host &> /var/log/streams/vlc-14990-stream1.log"
sudo -s -b -u media /usr/local/bin/cvlc -vvv --color --sout "#transcode{acodec=vorb,ab=192}:std{access=shout,mux=ogg,dst=source:mypass@}" -I http --http-src /var/www/stream1 --http-continuous --http-host &> /var/log/streams/vlc-14990-stream1.log
Let this be a lesson: watch your quotation marks kids!
Sorry to have wasted a thread over a simple scripting fail. Hope this gets someone else out of a bind in the future.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
VLC error: VLC could not open the file "/usr/share/vlc/skins2/text.bmp". brjoon1021 Ubuntu 1 01-14-2009 10:48 PM
Error: " cannot open shared object file: No such file or directory" ESC201 Linux - Software 4 11-01-2008 08:38 PM
New and upgraded packages give "No such file or directory" error. Lickwid Arch 3 09-03-2008 12:52 PM
"mount: not a directory" pmount error when file system is out kaz2100 Linux - General 0 12-18-2007 02:10 PM
error while trying to install program: "X11/Xlib.h: No such file or directory" nate1 Linux - Newbie 3 05-21-2004 08:08 AM

All times are GMT -5. The time now is 10:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration