How to: Install MiniDLNA into iocage (FreeNAS 11.2)

valesan

Patron
Joined
Dec 12, 2011
Messages
233
I also tested this procedure on TrueNAS 12.0 and everything works perfectly.
Thanks
 

ThomasGK

Cadet
Joined
Jan 8, 2020
Messages
3
I just followed the guide and can see the server in the network but no media are visible.
I mounted a folder from the NAS which contains videos (in subfolders, different formats). How can I check if the minidlna can access this mounted folder?
Thanks
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
How can I check if the minidlna can access this mounted folder?
Open a terminal windows/shell in the running jail and type ls /media/ and if you shared the media properly then it will show up there. Another thing to do, if you haven't already, stop and start the jail again, give MiniDLNA a few minutes to scan your media and hope it shows up.

If your files do not show up in the /media folder then you didn't share the data with the jail setup, revisit the instructions.
 

ThomasGK

Cadet
Joined
Jan 8, 2020
Messages
3
I just followed the guide and can see the server in the network but no media are visible.
I mounted a folder from the NAS which contains videos (in subfolders, different formats). How can I check if the minidlna can access this mounted folder?
Thanks
Just took a look into the Log:
right after "Scanning /media" I get
"Error scanning /media [Permission denied]"
So I assume the minidlna server has no permission to scan the mounted folder?
Thanks
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
"Error scanning /media [Permission denied]"
Does sound like a permission issue. I'm not sure what you have set for your permissions but maybe test it out with 777 and see where that takes you, I'll bet it works.
 

wanstronian

Dabbler
Joined
Aug 26, 2015
Messages
27
I successfully created a jail and added MiniDLNA. I needed to enable vnet in the basic properties. My TV could see the server and play the media.

After restarting my NAS, the TV now can't see the MiniDLNA server. The server is up, and nothing's changed in the config.

Any idea why it would be visible on my network (TV) when first set up, but not visible since restarting?
 

wanstronian

Dabbler
Joined
Aug 26, 2015
Messages
27
I successfully created a jail and added MiniDLNA. I needed to enable vnet in the basic properties. My TV could see the server and play the media.

After restarting my NAS, the TV now can't see the MiniDLNA server. The server is up, and nothing's changed in the config.

Any idea why it would be visible on my network (TV) when first set up, but not visible since restarting?

Ok, I found the problem. MiniDLNA, set up as described in this thread, will not auto start when the jail starts.

The solution to this is to update /etc/rc.conf to include the line minidlna_enable="YES"
 

hervon

Patron
Joined
Apr 23, 2012
Messages
353
This is in the tutorial on page one:
Make MiniDLNA starts when the jail is started (edit the rc.conf file)
Type "echo minidlna_enable="YES" >> /etc/rc.conf"
Type "exit"
Type "exit" which will close the shell.
 

wanstronian

Dabbler
Joined
Aug 26, 2015
Messages
27
This is in the tutorial on page one:
Make MiniDLNA starts when the jail is started (edit the rc.conf file)
Type "echo minidlna_enable="YES" >> /etc/rc.conf"
Type "exit"
Type "exit" which will close the shell.
Whoops - you're absolutely right. I even went back and read the OP a few times before posting, can't imagine how I kept missing this.

Apologies to you. My New Year's Resolution is to stop being so fecking stupid. :smile:
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Whoops - you're absolutely right. I even went back and read the OP a few times before posting, can't imagine how I kept missing this.

Apologies to you. My New Year's Resolution is to stop being so fecking stupid. :smile:
It happens to the best of us.
 

stakanov

Cadet
Joined
Jan 10, 2021
Messages
5
I have also an issue with permissions and miniDNLA. But as it is somewhat random, for a time all worked, I do wish to fully understand the permission issue.
Currently I followed the instructions at the beginning at the thread, and also did given the options as of indication. But I cannot see the files should be presented by miniDLNA.
My iocage is in the pool "A" (simple stripe), my media files are on a raidz2 pool "B". this Pool is also a sambashare, with permissions set to user "kino", guest access activated and mounted with /mnt/B/cinema (and subfolders). The samba share works as expected, both, if accessing via "Kino" with the password, or as guest without password.

I have set to run the minidlna in the minidlna.conf with:
user=nobody
Understanding that this will run the whole program with that credentials, and since I did read that this is the default of minidlna in a lot of assets.
I gave then:
media_dir=/media (I also tried media_dir=/media/ and media_dir=/mnt/B/cinema (which is the full path of the shared pool).

Before this I had no problem with media_dir=/media, but now suddenly I have a problem.

I see that, when I scan for ls /media in the shell of minidlna, I get nothing at all as result, that means: it just goes back to promt with empty result. Hence this could be a permission problem, but it does not complain.
In the thread there was the suggestion to run the minidlna with the -d parameter. But I do not understand how to achieve this, since:
a) when the jail is started, minidlna is also started.
b) To access the program the jail has to be running.
So I do not know how o pass the -d parameter to minidlna and then to start the jail. I would appreciate a lot if somebody could give me the information how to get this done. I also have set the loging to /var/log. But in the logs I do not find anything, maybe I have to pass a specifi file name first like "/var/log/minidlnalog?

Permissions: departing from the default permissions I joined full control of the dataset for "Kino" (as this is for the samba share) and then full control for "nobody".
miniDNLA is starting normally with the jail. I tried to restart the service, the jail, the system.

I do not understand the problem. root, nobody, both should have full control by the ACL, over the mounted and available dataset. The machine itself is visible on the network with the correct IP (ipv4 dhcp), samba works, ssh works, minidlna is also visible with the correct IP in the router, but when trying give access to the media_dir, I obviously fail. So the clients do not see the folder.

In the indication it is made clear that the permissions should match the one of the user minidlna is owned by.
But I saw not indication of the creation of a user and group (as happens with samba share) e.g with the name minidlna.
So I suppose, as the jail runs as root, the service will run as root, if not set otherwise in the config. By setting user=nobody in the config and giving nobody full control over the data in the path, this is expected to work.

Still, the TV (a Loewe Art Tv - a bit aging model) is on ethernet. It does see flawlessly a media server e.g. of the router (FritzBox, I ignore which protocol they use for mediaserver, but I suspect minidlna as well). Did I try to deactivate the media server of the FritzBox? Yes, I did.
So I think, I can exclude connectivity issues.

So I am stuck.
My questions:
  1. what user should I set the jail to. (Leave it to root as of creation I suppose?).
  2. what user should miniDLNA run as (and is it enough to run it as e.g. nobody by setting it in the conf). In fact I would have liked to run it as a dedicated user, since when running it as nobody, if I well understand, having e.g. another plugin running, "nobody", this could be a security risk, because if one is compromised (e.g. qbit) the minidnla could be also compromised. Still: if it runs only as nobody but works, I could live with it.
  3. what permissions do I have to set for the pools (A and B) to make sure minidlna can access data on pool B - the one with the media / movies.
  4. Do I have to set specific group permissions too?
I passed days on that but still do not understand why miniDLNA is not visible to the TV. Thank you for every idea / input, weather successful or not.
 
Last edited:

stakanov

Cadet
Joined
Jan 10, 2021
Messages
5
A few results:
If you follow exactly(!) the indications of the first howto it works. But:
the conf file allows you in theory to set a user. If you do this in a jail, you actually break the functionality.

So you have to leave it commented out.

There as a subthreat advice from joeschmuck
about matrioska files
advising to set the type of file with a link to the directory. My experience is: within an iocage this is impossible. I have not found any possibility to set the type of files shared without breaking functionality. So media_dir=/media works, and that is all about it.
Whatever else: not.

I would suspect this is inherent to the characteristics of an iocage. Besides I am not sure that not playing mvk, or not recognizing a video as video correctly if encoded mp4, is a question of indicating the type of file to minidlna.
What I found instead is: some mp4 files do play correctly in the TV if you rename them simply to m4v.
Still investigating why it does not like mkv files.
I am prone to thinking that some encodings historically used for musik (mp4) are not used for video too (I have the issue with streamed videos of a precise online offer, but not with others. So it seams the choice of the compression algorithm or something related may be the problem.)
Ogg audio files play very nice by the way.
 

LayZ_Pz

Cadet
Joined
Jun 14, 2021
Messages
2
I followed the turorial and everything is working perfectly BUT, when I am adding new content to the shares, I have to manually update the database, which is kinda annoying.

Is there a way to have it auto update ? I have changed some values in the conf, but that didnt do anything.

Thanks !
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Is there a way to have it auto update ?
Not really. The port of this program does not work flawlessly and it's been well documented for many years. The best suggestion I could give you is... 1) If you update/change your data files frequently (like throughout the day and evening) then setup a CRON job to scan the database based on time, or 2) if you just add files yourself you could just manually force the update as you do now. Or 3) work on a program to get around the flaw (a much more involved solution but so many people would be happy to see it).

Wish I could give you a super easy and good answer but this is how it works, unfortunately. There are other ways to get around it but it's really by creating a new VM with an OS that supports everything properly. This is why I use Plex to stream my content, it works pretty much perfectly.
 

LayZ_Pz

Cadet
Joined
Jun 14, 2021
Messages
2
setup a CRON job to scan the database based on time

That would be ideal, if only I knew how to that. I am quite a noob when it comes to Linux, but I am good at following tutorials :)

This is why I use Plex to stream my content, it works pretty much perfectly.

I have just tried, installing the plugin etc was already a pain with some failures, but now that I got everything setup, whenever I enable subtitles on some movies, Plex errors out for no reason.

Also the DLNA player on my Samsung TV seems to see all the videos files as .mpg. I don't need transcoding or any fancy features, that's the reason why MiniDLNA or Fuppes that used to use on XigmaNAS worked best...
 

highkick05

Cadet
Joined
Aug 7, 2022
Messages
3
This is a follow up highly inspired (copy/paste) of the excellent guide from joeschmuck to install minidlna in FreeNAS prior to 11.2.


This guide uses FreeNAS new UI 11.2 beta 2 with iocage jails.

What is MiniDLNA ?
MiniDLNA is server software with the aim of being fully compliant with DLNA/UPnP-AV clients.

Creating the Jail
Create a jail in the new UI from FreeNAS 11.2 (press on the + icon in the upper right of the screen)
Choose a jail name. I chose : MiniDLNA
Select the release : 11.2-RELEASE
Click Next.
Configure network : i'm a noob in the area. This is what worked for me.
IPv4 interface. I chose my interface em0
IPv4 Address: i chose a static IP outside my DHCP : 192.168.1.94. Highly depends of your network configuration. You may also choose DHCP.
IPv4 Netmask : 24
Click Auto-Start.
Did not change the rest.
Click Next then submit.

Add a mount point : Normally, you should now see the newly created jail.
Click on the 3 small dots far right to add mount points
Again press on the + icon in the upper right of the screen
  • Source is the media you want to share in your tank. In my case it is : /mnt/NASHD/Media/Movies
  • Destination is : /mnt/iocage/jails/MiniDLNA/root/media (the name of the jail depends on what you chose when you created the jail.)
As previously noted by joeschmuck : "It is recommended to not select Read-Only as some players will have issue with it however if you do select Read-Only and have a player having issues, go back and just change this."

Make sure the jail is started : again click on the 3 small dots far right

SSH into the Jail
You have several ways to SSH into the jail. I use XShell (free for home). This is not the scope of the tutorial. I will not answer questions about how to connect to FreeNAS using SSH. You can copy and paste the below commands if there is any doubt about spaces or format issues.

Type "iocage list" to make sure your jail was successfully created.
Type "iocage console MiniDLNA" (chose the right jail name) to enter in the jail.
Type "pkg install minidlna" (you will be prompted to install pkg too) to install MiniDLNA

Edit minidlna.conf file (instead i personally use WinSCP to access FRENAS and edit files)
Type "cd /usr/local/etc/" and you should be in that directory
Type "ee minidlna.conf" and you will now be editing the minidlna.conf file
Scroll down to the line where it says
  • Code:
  • media_dir=/opt
  • and change it to
  • Code:
  • media_dir=/media
Scroll down to the line where it says
  • Code:
  • #friendly_name=My DLNA Server
  • and change the line to (remove the # and change the name if you like)
  • Code:
  • friendly_name=MiniDLNA Server
Scroll down to the line where it says
  • Code:
  • #db_dir=/var/db/minidlna
  • and remove the "#"
  • Scroll down to the line where it says
  • Code:
  • #log_dir=/var/log
  • and remove the "#"
Press the ESCape key and Enter key twice to Leave and Save the changes.

Edit minidlna file
Type "cd rc.d"
Type "ee minidlna"
Scroll down to the line where it says
  • Code:
  • command_args="-P $pidfile -u $minidlna_uid -f /usr/local/etc/minidlna.conf"
  • and add -R to make the line read
  • Code:
  • command_args="-R -P $pidfile -u $minidlna_uid -f /usr/local/etc/minidlna.conf"
Press ESCape and then Enter key twice to Leave and Save the changes.

Testing MiniDLNA
Type "service minidlna onestart" and you should get "Starting minidlna".

Now go see if your DLNA compliant viewer can see your content. I use an old WDTVLive. I also see DLNA shares in my Windows 10 computer on the network window.

Make MiniDLNA starts when the jail is started (edit the rc.conf file)
Type "echo minidlna_enable="YES" >> /etc/rc.conf"
Type "exit"
Type "exit" which will close the shell.

Voilà. This is mostly a copy and paste of joeschmuck's thread. Hope that helps.
Thank you for this, very good tute. However, two changes

Code:
/usr/local/etc/minidlna.conf
"user=root"

/usr/local/etc/rc.d/minidlna
minidlna_uid=${minidlna_uid-root"}


# service minidlna restart
Will fix the permission issues. There is no such user as "dlna"
 
Top