Minidlna

Hello! I am install minidlna (from repo ubuntu 16.04) but I cant edit a minidlna.conf file even with administrator rights (sudo nautilus and sudo nano). I want to write a new way to the store media files different from defult. How can I editing minidlna.conf file in the snap folder?

if you installed minidlna-escoand (which is the only snap i could find with “minidlna” in the name), it seems to copy the minidlna.conf file to $SNAP_DATA on first start, so take a look at /var/snap/minidlna-escoand/current/ which is what $SNAP_DATA translates to …

Thank you for responding! I corrected file by your way, it changed, but no changes in app, checked minidlna.conf on another way “/snap/minidlna-escoand /19” there is default setting. It seems necessary to correct the file way “/snap/minidlna-escoand /19” but in this folder the file can not be adjusted even with administrator rights.

Did you stop and start the snap after editing the file (or reboot the machine) ? i doubt just editing it will have any effect if the process does not get restarted.

Yes! I rebooted. I think conf file by the way /snap/minidlna-escoand/19/etc is main. It must be changed, but I cant, this minidlna.conf with default settings yet.

the start-minidlna script in the snap clearly uses it from $SNAP_DATA:

$ cat /snap/minidlna-escoand/current/sbin/start-minidlna 
#!/bin/sh
DB_DIR=$(realpath -s $SNAP_DATA/../current/)
[ ! -f $SNAP_DATA/minidlna.conf ] && sed "s|^#db_dir=.*|db_dir=$DB_DIR|; s|^#log_dir=.*|log_dir=$SNAP_COMMON|" $SNAP/etc/minidlna.conf > $SNAP_DATA/minidlna.conf
minidlnad -f $SNAP_DATA/minidlna.conf -P $SNAP_COMMON/minidlna.pid "$@"

the line
minidlnad -f $SNAP_DATA/minidlna.conf

trranslates to minidlnad -f /var/snap/minidlna-escoand/current/minidlna.conf

the file from the readonly snap dir is only copied in place on first start so that there is a default file in $SNAP_DATA.

if the app doesnt start, take a look at the applications log at /var/snap/minidlna-escoand/common/minidlna.log it likely tells you whats wrong.

It is easier to install another application and configure it in the usual way. Thank you very much!

well, if you use minidlna in any other way you will also have to edit minidlna.conf and restart the app … (and if it doesnt start you will still have to read minidlna.log) the snap format doesnt make that worse or better in any way but indeed thats your choice, good luck with it :slight_smile:

1 Like

Minidlna starts, VLC sees it, after changing minidlna.conf (/var/snap/minidlna-escoand/19 ) with new way to media files chahges are not displayed in the VLC player. The second file is minidlna.conf (/snap/minidlna-escoand/19/etc) I cannot change even with admin rights. If after correct the first minidlna.conf no changes means need to change the second file, but the snap does not give it. I have DLNA is on a router, not a problem for me, but how other users of ubuntu 16.04 will be able to fully use minidlna - this is question :slight_smile:

Well, you did not tell us what you are changing in the file …

Looking closer at the snap you would either have to copy your files into /var/snap/minidlna-escoand/current/ or serve them from somewhere underneath /media and connect the removable-media interface by using:

sudo snap connect minidlna-escoand:removable-media

It is a bit unfortunate that the snap developer did not add the home interface to this snap so you could point to ~/Music or ~/Videos perhaps i belive “escoand” is @Alejandro (Escobar), perhaps you can ask him to enable the home interface for this snap in the next version.

I think the main problem is even with sudo, he (and I) are unable to edit the config. It’s read-only.

the package should make sure to store the config in $SNAP_DATA which is RW for root (i.e. with sudo)

see comment 6 above, are you editing /var/snap/minidlna-escoand/current/minidlna.conf or are you trying to edit any other file ?

I guess it’s confusing that the file in /snap/minidlna-escoand/current/etc/ does not change (at least it confused me).

But the log shows that the change in the minidlna.config file in /var/snap/minidlna-escoand/current/ are applied - and there I see the real problem:

warn: Error scanning /media/Medien/Video [Permission denied]

How is the correct handling of the permissions?

snap packages use interfaces to talk to the outside world (or the OS, or the hardware). connect the removable-media interface and it should get access to /media …

sudo snap connect minidlna-escoand:removable-media

… indeed this only works if the user running the snap has access to that dir anyway, the general filesystem permissions are independent from the interface in this case.

1 Like

great, this worked for me :slight_smile: my last question: how can I do a “force-reload” to rebuild the database?

I guess you did not get my last question :slightly_smiling_face:: Is it possible to perform a “force-reload” to rebuild the database? Normally you do something like sudo service minidlna force-reload

have you tried to just use sudo snap stop minidlna-escoand … sudo snap start minidlna-escoand ? that should call stop/start on the systemd unit which is what any force-reload with systemctl would do as well (note that the service command above does not exist anymore on any modern systemd based distro)

yes I tried, but this does not clear the database as a “force-reload” does.
And you are right - the command that I mentioned, is from an old documentation.

minidlnad -R

is what I mean as mentioned in the ArchLinux ReadyMedia documentation
This clears the database and starts scanning the media folders.

well, at that point you should probably contact the author of the snap and ask for such a feature (should be very simple to add a small script to the snap that you can execute … minidlna-escoand.force-reload simply calling the above) … he/she seems to be:

(there is a “contact this user” link at the top right)

Thank you,
that helps my understanding of snap.