I know this is an ongoing issue, but I cannot get the daft programme to rescan. I have followed every tutorial online known to man about inotify and it still just won't work.
As the Pi is being used in-car and is frequently turned off and back on, I'm happy to have a command line option added to force-reload every time the pi starts if that's the only way to get this to work. If there's a better way, I'm all ears.
The media is all on an external USB stick, mounted as /media/usb0
In answer to the probable next question, I see no errors in the log. It doesn't even show any signs that it's trying to run inotify at any stage. All it does is complain with inotify.c:89 errors about media directories being missing if I've changed the contents of the usb stick.
Anyone got any advice on getting this to behave properly please?
-
- Posts: 23
- Joined: Tue Sep 04, 2012 9:37 am
Re: Minidlna - again...
If I have to guess, I'd wager this is a permissions problem.
What user is minidlna running as? Does that user have proper permissions for the media directory?
inotify is a service provided by the kernel that minidlna calls so if there are problems, I'd first guess they are at the application level rather than at inotify's level in the kernel.
What user is minidlna running as? Does that user have proper permissions for the media directory?
inotify is a service provided by the kernel that minidlna calls so if there are problems, I'd first guess they are at the application level rather than at inotify's level in the kernel.
Re: Minidlna - again...
I have no idea how to find out what user minidlna is running, sorry.
Although I tried "top -u minidlna" and that returned a process of minidlna running, so probably that!
in minidlna.conf my media_dir is /media/usb0, db_dir is /home/pi/.minidlna, log_dir is /var/log, log_level is info, inotify=yes and notify_interval=300
/media/usb0 is drwxrwxrwx minidlna minidlna
/home/pi/.minidlna is same as above
All I see if I "tail -f /var/log/minidlna.log" is the usual startup messages and then a few inotify.c.89 errors that happen immediately complaining about missing directories (correctly as I've deleted those music albums from the usb stick).
I've left the tail going for ages on screen and it never changes. There are no signs of inotify rescanning.
Although I tried "top -u minidlna" and that returned a process of minidlna running, so probably that!
in minidlna.conf my media_dir is /media/usb0, db_dir is /home/pi/.minidlna, log_dir is /var/log, log_level is info, inotify=yes and notify_interval=300
/media/usb0 is drwxrwxrwx minidlna minidlna
/home/pi/.minidlna is same as above
All I see if I "tail -f /var/log/minidlna.log" is the usual startup messages and then a few inotify.c.89 errors that happen immediately complaining about missing directories (correctly as I've deleted those music albums from the usb stick).
I've left the tail going for ages on screen and it never changes. There are no signs of inotify rescanning.
-
- Posts: 23
- Joined: Tue Sep 04, 2012 9:37 am
Re: Minidlna - again...
Tried deleting the minidlna db and starting again?
also set log level to debug. That'll spit out some more messages that might be helpful.
also set log level to debug. That'll spit out some more messages that might be helpful.
Re: Minidlna - again...
**Edit** Just skimmed what you wrote, so this might now help
hey,
I was having the same problem. MiniDLNA couldn't find any new files in my media_dir even though I was adding new files. I think the problem was that my media_dir was set to an external hard drive. (media_dir=v,/media/ExtHD/x/x). I got it working, here are the steps I used to fix.
1. sudo service minidlna stop
2. sudo rm -r path-to-art_cache-and-files.db
3. edit minidlna.conf (sudo nano /etc/minidlna.conf)
4. set the media_dir back to default location. (media_dir=V,/var/lib/minidlna/video)
5. create a link in /var/lib/minidlna to the directory you want monitored. (sudo ln -s /media/ExtHD/video /var/lib/minidlna/videos)
6. start minidlna (sudo service minidlna force-reload)
your files.db will be recreated, this can take a while, and hopefully inotify will now be working. I tested this last night when I was downloading some files, when I woke up this morning the files that were downloading/queued for download were all available on my minidlna devices.
hey,
I was having the same problem. MiniDLNA couldn't find any new files in my media_dir even though I was adding new files. I think the problem was that my media_dir was set to an external hard drive. (media_dir=v,/media/ExtHD/x/x). I got it working, here are the steps I used to fix.
1. sudo service minidlna stop
2. sudo rm -r path-to-art_cache-and-files.db
3. edit minidlna.conf (sudo nano /etc/minidlna.conf)
4. set the media_dir back to default location. (media_dir=V,/var/lib/minidlna/video)
5. create a link in /var/lib/minidlna to the directory you want monitored. (sudo ln -s /media/ExtHD/video /var/lib/minidlna/videos)
6. start minidlna (sudo service minidlna force-reload)
your files.db will be recreated, this can take a while, and hopefully inotify will now be working. I tested this last night when I was downloading some files, when I woke up this morning the files that were downloading/queued for download were all available on my minidlna devices.
Last edited by everbit on Tue Jun 04, 2013 10:41 am, edited 1 time in total.
Re: Minidlna - again...
It seems that deleting the files.db and allowing minidlna to recreate it has sorted the immediate problem and it does, after 5 minutes, do the rescan if any items in the media directory have changed.
However... I'd still like to know if there's any way I can set the system up so that whenever the pi boots it automatically triggers a check of the media directory, rather than waits 5 minutes to do it. If I get into the car with a usb stick full of music and then tell the kids they have to wait 5 minutes until the system rescans then I'm just asking for moaning! It would be far easier to start minidlna with an option that says, "just compare your media directory with your database and rescan it if it's different" when it starts up.
Any way of doing that?
However... I'd still like to know if there's any way I can set the system up so that whenever the pi boots it automatically triggers a check of the media directory, rather than waits 5 minutes to do it. If I get into the car with a usb stick full of music and then tell the kids they have to wait 5 minutes until the system rescans then I'm just asking for moaning! It would be far easier to start minidlna with an option that says, "just compare your media directory with your database and rescan it if it's different" when it starts up.
Any way of doing that?
Re: Minidlna - again...
...I spoke too soon.
I added new music to the usb stick whilst it was turned off then powered it all back up again. Have had "tail" running on the log for half an hour now, no signs of a rescan and the new music folder I added is being ignored entirely when I view it through bubbleupnp.
This is driving me mad. Is there a better alternative to minidlna that actually works properly?
I added new music to the usb stick whilst it was turned off then powered it all back up again. Have had "tail" running on the log for half an hour now, no signs of a rescan and the new music folder I added is being ignored entirely when I view it through bubbleupnp.
This is driving me mad. Is there a better alternative to minidlna that actually works properly?
Re: Minidlna - again...
Further experimentation seems to show that the inotify system works ONLY IF the media folder is changed/updated whilst the minidlna service is running. If I stop the service and upload new files into the folder (USB stick) and start it again, or boot the pi up with new media on the USB stick then the minidlna service completely ignores the new media, it will just sit there doing absolutely nothing but will insist that the new media files are not there. If I use something that accesses the media via SAMBA then all is well but that's nowhere near as convenient as DLNA.
I can't be the only person with this problem surely? It cannot be permissions as it works fine if the service is running when the media folder is changed. This just seems to be a glaring bug of some sort but I can't believe this hasn't been seen and addressed before...
Is there a semi-official page anywhere that details any startup options that may force a rescan at boot?
I can't be the only person with this problem surely? It cannot be permissions as it works fine if the service is running when the media folder is changed. This just seems to be a glaring bug of some sort but I can't believe this hasn't been seen and addressed before...
Is there a semi-official page anywhere that details any startup options that may force a rescan at boot?
-
- Posts: 23
- Joined: Tue Sep 04, 2012 9:37 am
Re: Minidlna - again...
Aah now I see your problem.
Yes, you're right. Your db will only be updated if you add files while minidlna is running. This is as intended.
How inotify works is that it will notify any application watching for events whenever there is a change to the watched directories. inotify or the kernel does not keep a list of changes in memory and don't have the ability to do a "diff" if you introduce new files outside the system.
If the minidlna DB is being updated whenever you add files while the system is up an running, it is working as designed. I have inotify watch enabled and don't have the 5 minute delay. DB update is almost instantaneous in my case but then my pi runs 24x7.
To solve your problem, what you need is to write a small script that runs via /etc/rc.init or some such startup script and calls minidlna with a reload option. That way the db will be regenerated everytime the pi is booted up. It will not be instantaneous since regenerated the DB will take a couple of minutes or so depending on the size of the library.
Yes, you're right. Your db will only be updated if you add files while minidlna is running. This is as intended.
How inotify works is that it will notify any application watching for events whenever there is a change to the watched directories. inotify or the kernel does not keep a list of changes in memory and don't have the ability to do a "diff" if you introduce new files outside the system.
If the minidlna DB is being updated whenever you add files while the system is up an running, it is working as designed. I have inotify watch enabled and don't have the 5 minute delay. DB update is almost instantaneous in my case but then my pi runs 24x7.
To solve your problem, what you need is to write a small script that runs via /etc/rc.init or some such startup script and calls minidlna with a reload option. That way the db will be regenerated everytime the pi is booted up. It will not be instantaneous since regenerated the DB will take a couple of minutes or so depending on the size of the library.
Re: Minidlna - again...
Thanks for the further information. However, the lack of "rescanning" at startup seems to be illogical to me. I suppose if, like you, people kept the pi on 24/7 then the only way new stuff can get on teh media drives is in "online" mode and therefore inotify will work. I'm curious how yours happens immediately though - do you not have "notify_interval" set in your conf file?
Also on the archlinux wiki it says: "MiniDLNA scans your Media_Collection at startup and creates or updates database" which is exactly what I want it to do and yet it doesn't - this is why I'm asking if there's anything in the conf or startup scripts that I can change that forces it to do exactly this?
Also on the archlinux wiki it says: "MiniDLNA scans your Media_Collection at startup and creates or updates database" which is exactly what I want it to do and yet it doesn't - this is why I'm asking if there's anything in the conf or startup scripts that I can change that forces it to do exactly this?
Re: Minidlna - again...
try a cron job to force the re-scan?
https://www.github.com/random-robbie - Infosec tools
Re: Minidlna - again...
I guess it would work, but it seems hugely overkill for something that is allegedly done by the minidlna service already - if it was working properly of course! As the task is to get minidlna to check at startup, the solution would seem to be more along the lines of changing the startup script as I now know that inotify works fine as long as the media changes are done when minidlna is running.txt3rob wrote:try a cron job to force the re-scan?
Re: Minidlna - again...
true the other option is to get rid of minidnla and try another server.
https://www.github.com/random-robbie - Infosec tools
Re: Minidlna - again...
I did ask that question... any suggestions though?txt3rob wrote:true the other option is to get rid of minidnla and try another server.
-
- Posts: 23
- Joined: Tue Sep 04, 2012 9:37 am
Re: Minidlna - again...
I don't know what the arch linux wiki says but if it says that, it's wrong. minidlna will only rescan on startup if there is no existing DB. If there a DB already present, it will skip the rescan. The only way to make it rescan again is to do a force-rescan.
There are other alternatives such as mediatomb, which have additional features such as the ability to transocode. That feature, though, is more or less useless on the pi given its computing constraints.
I like minidlna because its a simple, no nonsense upnp client that doesn't consume too many resources and work well (for me).
The notify_interval option isn't really needed. If you have inotify working fine, media files show up immediately.
I've just set inotify to yes and it is working as expected.
For your case, the only way to go is have the minidlna init script do a force-rescan on every boot.
There are other alternatives such as mediatomb, which have additional features such as the ability to transocode. That feature, though, is more or less useless on the pi given its computing constraints.
I like minidlna because its a simple, no nonsense upnp client that doesn't consume too many resources and work well (for me).
The notify_interval option isn't really needed. If you have inotify working fine, media files show up immediately.
I've just set inotify to yes and it is working as expected.
For your case, the only way to go is have the minidlna init script do a force-rescan on every boot.
Re: Minidlna - again...
It's here: https://wiki.archlinux.org/index.php/MiniDLNA and it says, "MiniDLNA scans your Media_Collection at startup and creates or updates database".
Quite obviously it doesn't, as has been pointed out. It seems to be a glaring error to me as on a restart surely you'd want it to scan/check?
Anyhow - you mention modifying the init script. I don't know where/how to do this, so would really appreciate a few pointers if possible?
Quite obviously it doesn't, as has been pointed out. It seems to be a glaring error to me as on a restart surely you'd want it to scan/check?
Anyhow - you mention modifying the init script. I don't know where/how to do this, so would really appreciate a few pointers if possible?
-
- Posts: 23
- Joined: Tue Sep 04, 2012 9:37 am
Re: Minidlna - again...
you should be able to add the following line to /etc/rc.local to have it executed right after Linux finishes booting up.
minidlna -R
minidlna -R
-
- Posts: 4
- Joined: Mon Jul 15, 2013 8:25 am
Re: Minidlna - again...
Hi All,
If you are still facing issues with miniDLNA not refreshing the media database automatically, please follow the steps given here http://www.techjawab.com/2013/05/how-to ... -with.html
This will solve all your miniDLNA inotify issues
If you are still facing issues with miniDLNA not refreshing the media database automatically, please follow the steps given here http://www.techjawab.com/2013/05/how-to ... -with.html
This will solve all your miniDLNA inotify issues
