Setting up uPnP with minidlna on the freenas nightlies post-09/25/2011

Status
Not open for further replies.

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Has anyone had any luck with getting minidlna to update it's database properly/periodically? I can only get the update done if I reboot the NAS. This is not very optimal. I guess I'll take a look on Google to see if there are any other forums having minidlna issues and maybe I'll be lucky enought o stumble across something helpful. If someones does update, maybe I have my directories setup incorrectly.

Thanks,
Mark
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Has anyone had any luck with getting minidlna to update it's database properly/periodically? I can only get the update done if I reboot the NAS. This is not very optimal. I guess I'll take a look on Google to see if there are any other forums having minidlna issues and maybe I'll be lucky enought o stumble across something helpful. If someones does update, maybe I have my directories setup incorrectly.

Thanks,
Mark

Mark,

Does the 'inotify' key in the minidlna.conf file need to be 'yes'? Mine is 'no' and the description says set to no to disable automation discovery of files??

edit - From what I've been reading minidlna uses inotify to determine when files are added.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
I hope that is the fix. I've changed the value in my system, I'll know more once I've added something and given it a little time to update.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
I hope that is the fix. I've changed the value in my system, I'll know more once I've added something and given it a little time to update.

I'm just not sure if FreeNAS has inotfiy enabled (which is in the Kernel if I understood what I read).
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
I hope that is the fix. I've changed the value in my system, I'll know more once I've added something and given it a little time to update.

Did you have any luck getting the database to update?

I was unable to get minidlna to auto-update the database. I really want to get it working properly, but I'm held back by my limited FreeBSD skills (Linux/Unix). I can however share some things I found.

I did:

Code:
pw user add dlna


but could not find the 'dlna' user listed in the web gui or with:

Code:
cat /etc/passwd


I'm not sure how important having the 'dlna' user is but it is listed in the minidlna script as the user. Also, while looking at the minidlna script I noticed there is a 'required dir' and mine was set to the default db directory. I changed it to what I used for 'db_dir' from minidlna.conf.

As mentioned before I changed the 'inotify' value found in minidlna.conf to 'yes'. I was reading that inotify is something in the Linux kernel. I thought from what I read on FreeBSD it is now available, but got confused in there somewhere. I also read that FreeBSD can use kqueue as an event notification interface. I have no idea how to determine if FreeNAS is using inotify or kqueue and if not, how to get one working.

The only success I had in updating the directory was with the following commands:

Code:
pkill minidlna
minidlna -f /usr/local/etc/minidlna.conf -R


It was recommended by this article to use debug mode to know when the update has completed.

It seems the version packaged when using "MULTIMEDIA" is behind the minidlna version, but doubt that matters.

Hopefully you have/had better luck than me.
 
G

gcooper

Guest
I'm just not sure if FreeNAS has inotfiy enabled (which is in the Kernel if I understood what I read).

inotify is a Linux specific feature. Someone should code up an equivalent in libevent2 for inotify so more OSes other than Linux would benefit from directory/file based notification.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
inotify is a Linux specific feature. Someone should code up an equivalent in libevent2 for inotify so more OSes other than Linux would benefit from directory/file based notification.

What about kqueue? I'm assuming however the FreeNAS notification system is updated minidlna source would have to be changed as well??
 
G

gcooper

Guest
What about kqueue? I'm assuming however the FreeNAS notification system is updated minidlna source would have to be changed as well??

libevent is a portable means of doing inotify and kqueues and is preferred instead of building in a bunch of hacks for multiple versions of kqueues (unfortunately the source for kqueues has diverged over the years between the BSDs, so it's not guaranteed to act the same way between all of the BSD variants). It's better to focus on libevent because it has a lot better visibility..
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Yea, I have been completely unsuccessful in getting minidlna to automatically update the library when you add a new item later down the road. So as a temporary patch we will have to reboot the machine if you add a new item. It's not that bad right now for me as I only add a new movie every few weeks or so. I'll update the music when my daughter buys something new. Hopefully in a few months this will be rectified.

@gcooper,
Any idea when you will be able to devote some time to this? I know there are bigger problems in FreeNAS which need to be taken care of first (IMO), I'm just asking.
 
G

gcooper

Guest
Yea, I have been completely unsuccessful in getting minidlna to automatically update the library when you add a new item later down the road. So as a temporary patch we will have to reboot the machine if you add a new item. It's not that bad right now for me as I only add a new movie every few weeks or so. I'll update the music when my daughter buys something new. Hopefully in a few months this will be rectified.

@gcooper,
Any idea when you will be able to devote some time to this? I know there are bigger problems in FreeNAS which need to be taken care of first (IMO), I'm just asking.

Rebooting the machine isn't required... yowch. Just add '/usr/local/etc/rc.d/minidlna restart' to a periodic cronjob as a hack for now..

I'd have to look and see how long it'd take to add libevent support b/c I don't know how long it would take today.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Would it be worth looking into the latest minidlna port, I noticed it has been updated recently to 1.0.22. Not sure if it will fix the database update issue, but I'm not sure how to update it on the trunk before building. I'm willing to try it after it is updated in the nightly, or if you can point me to a help guide for updating it on the trunk.

edit - also, does the script understand start, stop, and/or restart? I noticed the Linux version has a minidlna.init but we don't have that in the freebsd port.
 
G

gcooper

Guest
Would it be worth looking into the latest minidlna port, I noticed it has been updated recently to 1.0.22. Not sure if it will fix the database update issue, but I'm not sure how to update it on the trunk before building. I'm willing to try it after it is updated in the nightly, or if you can point me to a help guide for updating it on the trunk.

It looks like a weekend project based on the CVS code I just peeked at. If the patch doesn't apply out of the box for minidlna, I'll have to update the port.. but unless there are relevant bugfixes, etc, it's not worth it to update the port by itself.

edit - also, does the script understand start, stop, and/or restart? I noticed the Linux version has a minidlna.init but we don't have that in the freebsd port.

Yes. Look for minidlna.sh.in in the port itself, then look at /etc/rc.subr / man 5 rc if you're curious about how the magic happens.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
The script doesn't work for me. Your "/usr/local/etc/rc.d/minidlna restart" does restart minidlna. I'm such a noob I'll be learning how to add a cronjob to FreeNAS now. Don't tell me, I'll figure it out and if I don't, I'll ask how. It's a good learning experience for me.

The only problem I see with the cronjob is when to schedule it. I certainly wouldn't want it to restart when I'm watching a movie. I wish the -R parameter worked to update the database. If I could manipulate the GUI, I'd place a restart button on the main page until this is all figured out.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
The only problem I see with the cronjob is when to schedule it. I certainly wouldn't want it to restart when I'm watching a movie. I wish the -R parameter worked to update the database. If I could manipulate the GUI, I'd place a restart button on the main page until this is all figured out.

Did you try stopping minidlna before using??

Code:
minidlna -f /usr/local/etc/minidlna.conf -R


I wasn't able to perform:

Code:
minidlna stop


but maybe it will work like this:

Code:
/usr/local/etc/rc.d/minidlna stop


I'm such a noob as well, but willing to try things and help if I can.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Okay, I'm looking a little harder and although I can stop, start, and restart minidlna, it doesn't appear to scan the drives at all. My drives are in the standby state and never leaves that state, even when I restart minidlna. Sounds fishy to me. I did verify the service is removed and loads again in memory.

What next?
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Okay, I'm looking a little harder and although I can stop, start, and restart minidlna, it doesn't appear to scan the drives at all. My drives are in the standby state and never leaves that state, even when I restart minidlna. Sounds fishy to me. I did verify the service is removed and loads again in memory.

What next?

only thing I can think of is try running in debug mode during the rebuild (or command that is supposed to rebuild :) )

Code:
minidlna -f /usr/local/etc/minidlna.conf -R -d


I'm not at home so can't try it again until later tonight.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Well it appeared to rebuild but it was a one time deal. I could not get it to repeat. Again, until it actually works correctly I will reboot the NAS to rebuild the database. It's no big deal.
 

imy300

Cadet
Joined
Oct 10, 2011
Messages
1
i'm new to all this but willing to learn. Can someone give me instructions to installing and configuring minidlna on 8.0.2 ? thanks
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
i'm new to all this but willing to learn. Can someone give me instructions to installing and configuring minidlna on 8.0.2 ? thanks

Not sure if anyone has done this yet and I tried but met with failure. I'm sure it can be done but you could do like the rest of us and build using the trunk. Read the thread from the start to finish and if you have any questions about the instructions feel free to ask. If you haven't built a FreeNAS program then you have the option to build it yourself (very easy to do) or ask someone for a custom build with MULTIMEDIA=1 inserted at the proper location. Go to 'How-To Guides', 'Installation' and you will find a two part guide that will enable you to build FreeNAS. Once there you need to download the FreeNAS program (I have a nice script, use option -s), alter one file (in this thread) and then build FreeNAS (my script option -b). Once you have installed this new version of FreeNAS you will have to configure it IAW the instructions in this thread. There is no simple GUI at this time but I suspect minidlna will be part of the core 8.1 release but that is many months away.
 
Status
Not open for further replies.
Top