With the advent smart computing devices like ARM processor based Raspberry Pi there has been a significant rise is people setting up their home DLNA Servers for streaming their multimedia collections like movies, videos, pictures directly to their internet enabled or DLNA enabled smart TVs. Even almost all modern Android devices are capable to receiving DLNA streams.
MiniDLNA is one of the very popular DLNA server being used by raspbian users and also by users of Arch Linux and even a large community of Ubuntu users, mainly due to to it's fairly small size and simple ease of use. However there is some issue with MiniDLNA in automatically picking up changes / additions to the media_dir (Media Directory) i.e. more often it doesn't picks up any new file if added to the folder and updates the database which appears on your DLNA renderer like TV.
It generally throws the following warning in the logs:
[2012/10/19 18:35:41] inotify.c:195: warn: WARNING: Inotify max_user_watches  is low or close to the number of used watches  and I do not have permission to increase this limit. Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.
While most of the solutions suggests setting up a cron job to rebuild the whole of the database at some specific time but hardly any of them address the fix to real issue or some says that the kernel or OS version doesn't supports the inotify feature. Also I don't like the idea of rebuilding the whole media library database every day or every time a new file is added, as ideally it should just add the new file in the media database Some of you might have even tried to update /proc/sys/fs/inotify/max_user_watches but probably failed with a error "E667: Fsync failed" at the vi.
Edit sysctl.conf (A file for defining kernel parameters)
sudo nano /etc/sysctl.conf
Find and change as below if the following line exists or add at the bottom:
Save the file Ctrl + X and Y(es)
Now run the below command, you should be able to see the values you have set:
sudo /sbin/sysctl -p
Finally restart MiniDLNA service and things should be working:
sudo service minidlna restart
Note: Make sure you have inotify enabled and a notify interval is set as per your requirement in /etc/minidlna.conf per the following settings