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

Discussion in 'Configuration' started by gcooper, Sep 27, 2011.

  1. gcooper New Member

    Member Since:
    Sep 23, 2011
    Message Count:
    416
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Former iXsystems Software Developer
    gcooper, Sep 27, 2011

    NOTE: Here are complete semi-official directions for how to set things up with uPnP with minidlna (it will be added to the GUI eventually).

    1. Login as root to FreeNAS box.
    2. Execute the following commands:

    Code (text):
    1.  
    2. mount -wu /
    3. # There's a bug in either FreeNAS or the port that prevents this from being done automatically.
    4. pw user add dlna
    5. # Preserve the sample minidlna.conf file
    6. test -f /usr/local/etc/minidlna.conf.sample || cp /usr/local/etc/minidlna.conf.sample /usr/local/etc/minidlna.conf
    7.  
    3. Copy the following to /usr/local/etc/minidlna.conf (replace the parameters below with something more useful for your install.. see /usr/local/etc/minidlna.conf.sample for hints on what you can change):

    Code (text):
    1.  
    2. port=8200
    3. media_dir=/mnt/tank
    4. friendly_name=freenas
    5. db_dir=/var/db/minidlna
    6. album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
    7. inotify=no
    8. enable_tivo=no
    9. strict_dlna=no
    10. notify_interval=300
    11. serial=12345678
    12. model_number=1
    13.  
    4. Test out your settings

    Code (text):
    1.  
    2. minidlna -f /usr/local/etc/minidlna.conf
    3.  
    Things should be served up properly now -- otherwise, the console will output one or more relevant failure messages.

    5. Making the change permanent

    Code (text):
    1.  
    2. echo 'minidlna_enable="YES"' >> /conf/base/etc/rc.conf
    3.  
    6. Cleanup

    Code (text):
    1.  
    2. # DO NOT FORGET THIS!
    3. mount -ru /
    4.  
    Notes:

    • I've gotten things to play properly with my Xbox 360.
    • minidlna crashes on VLC (is most likely a bug with VLC) under FreeBSD and OSX.
    • This won't work with all Samsung TVs as noted by JoeSchmuck on the forums.
    • Sony BlueRay/PS3s are picky and won't play certain MIME types under the "All Media" Section (you might have to pick the appropriate media section in order for this to work properly). I know this for a fact with my Sony BlueRay player (detects the share, but won't let me play media under all media); but I can't confirm with a PS3. MP3s work for sure, but m4as won't work with some Sony BlueRay players.

    • Based on the above compatibility list, something seems fishy with the player support (I can play Xvid on my 360, but not one the Sony BlueRay player; I can't play non-copyright protected iTunes mp4 media on my Sony BlueRay player and Xbox 360; mp3s work on the BlueRay and the 360 after manually rescanning the directory).
    • If one of the other media players plays your device better than minidlna -- please let me know and I'll see if I can port support to minidlna or fix support in FreeBSD! Please note what media type you're having issues with as well as what codec you're having issues with (GSpot is recommended if you're using Windows).
    • Auto-rescanning seems broken because I have to issue minidlna with -R in order for it scan for new files.
  2. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Sep 27, 2011

    On step 6, did you mean to say 'mount -ro /' ?
  3. gcooper New Member

    Member Since:
    Sep 23, 2011
    Message Count:
    416
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Former iXsystems Software Developer
    gcooper, Sep 27, 2011

    Yeah.. thanks!
  4. cubix Moderator

    Member Since:
    May 30, 2011
    Message Count:
    82
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    New Zealand
    cubix, Sep 27, 2011

    @gcooper: Any luck getting the nightly builds functioning again for the lazy users? Aka me.
  5. gcooper New Member

    Member Since:
    Sep 23, 2011
    Message Count:
    416
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Former iXsystems Software Developer
    gcooper, Sep 27, 2011

    I'll talk to jpaetzel about it. With any luck we will have something going by the end of the week.
  6. Emad Member

    Member Since:
    Jun 2, 2011
    Message Count:
    35
    Likes Received:
    0
    Trophy Points:
    6
    Emad, Sep 27, 2011

    Where exactly this nightly build available? I cannot seems to find anywhere on sourceforge.
  7. gcooper New Member

    Member Since:
    Sep 23, 2011
    Message Count:
    416
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Former iXsystems Software Developer
    gcooper, Sep 28, 2011

    I'm going to add nightly images soon which can be downloaded via torrents, because getting the sourceforge infrastructure up and going again appears to have fallen a bit lower on the priority list here.
  8. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    51
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 1, 2011

    EDIT: Deleted content because people were not reading the rest of this thread and missing the correct way to incorporate minidlna.
  9. jerrybme Member

    Member Since:
    Sep 28, 2011
    Message Count:
    33
    Likes Received:
    7
    Trophy Points:
    8
  10. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    51
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 2, 2011

    Thanks, sure would be nice to consolidate all this into a single thread.
  11. jerrybme Member

    Member Since:
    Sep 28, 2011
    Message Count:
    33
    Likes Received:
    7
    Trophy Points:
    8
  12. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 2, 2011

    I could merge the threads, but I think the OP can also do that and I'm not sure how he wants to handle it. We could close one thread and put a link to the other...
  13. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    51
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 2, 2011

    Appreciate the offer, think I'll just include the data in this thread on my next posting or I'll just edit my previous posting and include it all.
  14. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    51
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 2, 2011

    Okay, I've been able to retain the setting after a reboot, here's the fix...

    Edit the minidlna.conf file at /conf/base/etc/local vice /usr/local/etc.

    This brings me to another problem, minidlna will not start automatically on bootstrap, it fails with the following message...

    Code (text):
    1. Oct  2 16:30:46 freenas root: /etc/rc: WARNING: /var/db/minidlna is not a directory.
    2. Oct  2 16:30:46 freenas root: /etc/rc: WARNING: failed precmd routine for minidlna
    I can get past the /var/db/minidlna easy enough but it still fails to start up. It does start by CLI by just typing minidlna. I think the problem is it is not compatible with the rc scripting, meaning it doesn't have a start, stop, etc... command so it fails.

    I could be wrong in my above statement, I've been reading a lot today but not sure if I learned it correctly. I did learn how to create an rc compatible script today but have no idea where to put it so it runs at startup.

    Any ideas?
  15. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 2, 2011

    Normally... There's /etc/rc.local (file), or just put your script in /etc/rc.d (folder), but I think with FreeNAS it needs to be /conf/base/etc/rc.d/ or /conf/base/etc/rc.local (rc.local is usually for custom stuff).
  16. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    51
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 2, 2011

    I did that already, /conf/base/etc/local/rc.d/ seems to be the right location which gets loaded into /usr/local/etc/rc.d during boot. I stuffed that script in many places and it never started up. I can run the script providing I'm in the proper directory and enter "./minidlnascript start" and I do have minidlnascript="YES" in rc.conf. It would be nice if minidlna just started like it should.

    Time to call it quits for the evening, getting late on this coast. Thanks for the info, I'm sure I'm doing something wrong. More testing tomorrow and I don't mind provided I'm learning something.
  17. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 2, 2011

    Did you make the owner/group the same as the other scripts and chmod 555 ?
    Does it have ". /etc/rc.subr" at the beginning?
  18. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    51
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 3, 2011

    Fixed !

    I traced down the original problem of why minidlna would not start on bootstrap. In the file /conf/base/etc/local/rc.d/minidlna the line
    Code (text):
    1. command_args="-P $pidfile -u $minidlna_uid"
    is invalid. Change it to
    Code (text):
    1. command_args=""
    .

    You also need to create the directory minidlna in "/conf/base/var/db/".
  19. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    51
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 3, 2011

    Cleaned up installation instructions

    DISCLAIMER : This is not all my work, far from it so I'm not taking credit. I have consolidated the info here.

    This is a cleaned up look of the work required to get minidlna to be operational.

    NOTE: You should be able to download one of the nightly builds and skip step 1. The nightly builds should have MULTIMEDIA already set during the build processes. You will have to do the remaining steps until minidlna in incorporated into the GUI.

    1) Replace the following line in build/nano_env:

    SW_FEATURES="DEBUG"

    with this:

    SW_FEATURES="DEBUG MULTIMEDIA"

    And call build/do_build.sh as you normally would to produce a build image.

    It would be a good idea to have media destinations identified before hand as you will need that info in this procedure.

    2) Once you have loaded your system it's time to modify a few things...

    Code (text):
    1. mount -wu /
    2. mkdir /conf/base/var/db/minidlna
    3. pw add user dlna
    4. echo 'minidlna_enable="YES"' >> /conf/base/etc/rc.conf
    5. cd /conf/base/etc/local
    6. ee minidlna.conf
    7.  
    Now edit the media_dir lines to reflect your Video, Audio, and Photos (my test drive is peanuts as you can tell)

    Code (text):
    1. media_dir=V,/mnt/peanuts/movies
    2. media_dir=A,/mnt/peanuts/music
    3. media_dir=P,/mnt/peanuts/pictures
    Edit the db_dir line if you like. The default will exist but I placed mine on the actual hard drive like so hoping the database will not need to be recreated in full each time.
    Code (text):
    1. db_dir=/mnt/peanuts/minidlnadb
    You don't need to change any other values unless you desire to.
    Press ESC and save your file.

    3) Now we need to fix the minidlna script file.
    Code (text):
    1. cd rc.d
    2. ee minidlna
    3.  
    4. Modify
    5. command_args="-P $pidfile -u $minidlna_uid"
    6.  
    7. to
    8.  
    9. command_args="-R"
    10.  
    Press ESC to save the modification.

    Save all your work properly
    Code (text):
    1. mount -ro /
    And type reboot. Minidlna should start up without issue (as of build 8104).

    To rebuild your database you can either reboot your NAS or while logged on as root or SU enter 'service minidlna restart'.

    UPDATE: Minidlna (as of 11/18/2011) does not refresh the media automatically. The -R in the command_args will force an update every time minidlna is started. If you do not want the database rebuilt each time then place a '#' (hash) mark before the value '#command_args="-R"' or delete it all together.
  20. jerrybme Member

    Member Since:
    Sep 28, 2011
    Message Count:
    33
    Likes Received:
    7
    Trophy Points:
    8
    jerrybme, Oct 7, 2011

    Nice job figuring out why minidlna won't load properly on reboot! Now if I could figure out the same issue for transmission I won't have to ssh in to start those processes after every reboot. ;-)

Share This Page