Minidlna Media Server through Debian Entware

This guide is obsolete now, use this one instead

This is for mipsel devices, like RT-N16, RT-N66U/R, RT-AC66U/R
Advantages: easy to update without waiting for asus, easy to apply patches, very stable with zero crashes at least for me on RT-AC66U, I enabled movie thumbnails with filmstrip (will take a little bit longer to scan db) and bookmarks for resuming videos on samsung E & F series.
Let's start
0 - Install one of Merlin's firmware from here
1 - Turn off Media server from router ui and insert an usb drive in to the router, should be formatted as ext2 or ext3
2 - Setup entware from this guide

3 - Open terminal and input the next command:

cd /opt

4 - Download prepared debian with all necesary libs and decompress

wget -c -O debian-minidlna-1.1.4-2.tgz
tar -xvzf ./debian-minidlna-1.1.4-2.tgz

5 - Download start-stop script, in this script is a path EXT_DIR to your media folder witch will be mounted in debian as /mnt, mine is /mnt/sda1/Media and if your disk has a label change sda1 from CHROOT_DIR with your disk label, modify the script to match your settings with vi or nano editor, use this command nano /opt/etc/init.d/S99debian

wget -c -O /opt/etc/init.d/S99debian
chmod a+rx /opt/etc/init.d/S99debian
opkg install nano

6 - Download services-list that will run in chrooted debian, for now is only minidlna but if you want to install another packages in debian like transmission-daemon, you need to add transmission start-stop script name, ex. S50transmission

wget -c -O /opt/etc/chroot-services.list
chmod a+rx /opt/etc/chroot-services.list

7 - Reboot router


8 - Go to (this is the default router ip, modify to your router ip if you change it previously) and see how minidlna is creating db, press refresh on your browser for progress.
If all numbers are 0 (zero) after some time, you forget to set the right path to your media folder, read again point 5 carefully


9 - If you want to enter chrooted debian to install other packages or to modify some options, use this commands:

mount -o bind /dev/ /opt/debian/dev/
mount -o bind /proc/ /opt/debian/proc/
mount -o bind /sys/ /opt/debian/sys/
chroot /opt/debian /bin/bash

To exit, just type


To update from a previous version follow this steps:

1. Stop minidlna

/opt/etc/init.d/S99debian stop

2. Download latest version:

wget -c -O /opt/debian/var/tmp/minidlna_1.1.4-2_mipsel.deb
wget -c -O /opt/debian/var/tmp/minidlna.conf

3. Enter chrooted debian

mount -o bind /dev/ /opt/debian/dev/
mount -o bind /proc/ /opt/debian/proc/
mount -o bind /sys/ /opt/debian/sys/
chroot /opt/debian /bin/bash

4. Input next commands:

dpkg -r minidlna
rm -r /opt/minidlna
cd /var/tmp
cp -r minidlna.conf /etc
chmod 777 /etc/minidlna.conf
dpkg -i minidlna_1.1.4-2_mipsel.deb

5. Exit debian


6. Start minidlna

/opt/etc/init.d/S99debian start

7. Enjoy your media :)

To completely uninstall chrooted debian:
1. Stop minidlna

/opt/etc/init.d/S99debian stop

2. Verify if external folder is not mounted, output should be empty, if not - stop again.

Very important!!! If continue and external folder is mounted, all media files inside will be deleted.

ls -l /opt/debian/mnt
/opt/etc/init.d/S99debian stop

3. Delete debian folder

rm -r /opt/debian

4. Delete debian startup script

rm /opt/etc/init.d/S99debian

5. Delete chrooted services list

rm /opt/etc/chroot-services.list

This is how it looks like on my Samsung TV



  • pascal

    i have followed above manual but my DB remains empty, i have several options but i can't get it to work

    • If you set the right path to your media folder in S99 debian script, should work.
      Outside debian, stop server
      /opt/etc/init.d/S99debian stop
      Remove minidlna db folder
      rm -r /opt/debian/opt/minidlna
      Start server again
      /opt/etc/init.d/S99debian start
      If still not working, post here outputs from:
      uname -a
      cat /opt/etc/init.d/S99debian

      • pascal

        ok for the movies i have on the hard disk i got it working, but i also have pictures and music in the same folder and those are not found.

        here you have the outcome of your requests:
        admin@RT-N66U-2A98:/tmp/home/root# mount
        rootfs on / type rootfs (rw)
        /dev/root on / type squashfs (ro)
        proc on /proc type proc (rw)
        tmpfs on /tmp type tmpfs (rw)
        devfs on /dev type tmpfs (rw,noatime)
        sysfs on /sys type sysfs (rw)
        devpts on /dev/pts type devpts (rw)
        /dev/mtdblock4 on /jffs type jffs2 (rw,noatime)
        usbfs on /proc/bus/usb type usbfs (rw)
        /dev/sda1 on /tmp/mnt/mediaserver type ext3 (rw,nodev,noatime,data=ordered)
        devfs on /tmp/mnt/mediaserver/debian/dev type tmpfs (rw,noatime)
        proc on /tmp/mnt/mediaserver/debian/proc type proc (rw)
        sysfs on /tmp/mnt/mediaserver/debian/sys type sysfs (rw)
        /dev/sda1 on /tmp/mnt/mediaserver/debian/mnt type ext3 (rw,nodev,noatime,data=ordered)

        admin@RT-N66U-2A98:/tmp/home/root# uname -a
        Linux RT-N66U-2A98 #1 Tue Dec 23 00:30:59 EST 2014 mips GNU/Linux

        admin@RT-N66U-2A98:/tmp/home/root# df
        Filesystem 1K-blocks Used Available Use% Mounted on
        /dev/root 27712 27712 0 100% /
        tmpfs 119836 4944 114892 4% /tmp
        devfs 119836 0 119836 0% /dev
        /dev/mtdblock4 3072 412 2660 13% /jffs
        /dev/sda1 1922857776 481463452 1343718756 26% /tmp/mnt/mediaserver
        devfs 119836 0 119836 0% /tmp/mnt/mediaserver/debian/dev
        /dev/sda1 1922857776 481463452 1343718756 26% /tmp/mnt/mediaserver/debian/mnt

        admin@RT-N66U-2A98:/tmp/home/root# free
        total used free shared buffers
        Mem: 239672 174220 65452 0 1648
        -/+ buffers: 172572 67100
        Swap: 0 0 0

        admin@RT-N66U-2A98:/tmp/home/root# cat /opt/etc/init.d/S99debian

        # Folder with Debian Squeeze
        # Some folder outside of sandbox, will be mounted to /mnt folder in Debian
        # Leave commented if not needed

        if [ ! -e "$CHROOT_SERVICES_LIST" ]; then
        echo "Please, define Debian services to start in $CHROOT_SERVICES_LIST first!"
        echo "One service per line. Hint: this is a script names from Debian's /etc/init.d/"
        exit 1
        MountedDirCount="$(mount | grep $CHROOT_DIR | wc -l)"
        start() {
        if [ $MountedDirCount -gt 0 ]; then
        echo "Chroot'ed services seems to be already started, exiting..."
        exit 1
        echo "Starting chroot'ed Debian services..."
        for dir in dev proc sys; do
        mount -o bind /$dir $CHROOT_DIR/$dir
        [ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt
        for item in $(cat $CHROOT_SERVICES_LIST); do
        chroot $CHROOT_DIR /etc/init.d/$item start

        stop() {
        if [ $MountedDirCount -eq 0 ]; then
        echo "Chroot'ed services seems to be already stopped, exiting..."
        exit 1
        echo "Stopping chroot'ed Debian services..."
        for item in $(cat $CHROOT_SERVICES_LIST); do
        chroot $CHROOT_DIR /etc/init.d/$item stop
        sleep 2
        mount | grep $CHROOT_DIR | awk "{print $3}" | xargs umount -l

        status() {
        if [ $MountedDirCount -gt 0 ]; then
        echo "Chroot'ed services is running"
        echo "Chroot'ed services is stopped"

        case "$1" in
        sleep 5
        status) status
        echo "Usage: $0 (start|stop|restart|status)"
        exit 1

        echo Done.
        exit 0

        thanx in advance!!!

        • All settings are ok but you didn't enabled SWAP, it's very important, this will crash your minidlna server.
          Enable swap
          Stop server
          Remove minidlna folder
          Start server again

          I will post another tutorial with minidlna through debian wheezy v7.7

          Swap at point 9

          • pascal

            i just enabled the SWAP file but i still have some question, i have a folder called media in which i have movies, pictures and music but only the movies are visible in the scan.

            what do i have to do to solve this?

          • No audio or picture is shown on or in your dlna player list?
            Look for some error in /opt/minidlna/minidlna.log

          • pascal

            no nothing, i tried to check that log but i can't find it

          • /opt/minidlna/minidlna.log is inside debian
            From entware is /opt/debian/opt/minidlna/minidlna.log
            If no error there, try to set log to debug by editing /opt/debian/etc/minidlna.conf

            Minidlna server should be stopped while editing conf file

          • pascal

            it very strange i always get below error message:

            admin@RT-N66U-2A98:/# cd /opt/debian/opt/minidlna/
            -sh: cd: can't cd to /opt/debian/opt/minidlna/

          • Try step by step, maybe you deleted minidlna folder
            cd /opt
            cd /opt/debian...

          • pascal

            it looks you are right, i have deleted the mninidlna folder

            admin@RT-N66U-2A98:/tmp/mnt/mediaserver/entware# cd /opt/debian
            admin@RT-N66U-2A98:/tmp/mnt/mediaserver/entware/debian# ls
            bin dev home media opt root selinux sys usr
            boot etc lib mnt proc sbin srv tmp var

          • No,
            ls -l /opt/debian/opt

          • pascal

            admin@RT-N66U-2A98:/tmp/mnt/mediaserver/entware/debian# ls -l /opt/debian/opt
            drwxrwxrwx 2 admin root 4096 Sep 10 16:22 tmp

          • You only have tmp folder, minidlna is missing because was not started again after you deleted it.
            Have you disabled built in minidlna from router menu?

          • pascal

            yes it is disabled on the router

          • Ok, then start debian version with
            /opt/etc/init.d/S99debian start

          • pascal

            admin@RT-N66U-2A98:/# /opt/etc/init.d/S99debian start
            Chroot'ed services seems to be already started, exiting...

          • Stop and start again
            /opt/etc/init.d/S99debian stop
            /opt/etc/init.d/S99debian start

          • pascal

            admin@RT-N66U-2A98:/# /opt/etc/init.d/S99debian stop
            Stopping chroot'ed Debian services...
            Stopping minidlna:.
            admin@RT-N66U-2A98:/# /opt/etc/init.d/S99debian start
            Starting chroot'ed Debian services...
            Starting minidlna:.

          • Should be ok now, go to
            If only video files are scanned, see log for errors
            cat /opt/debian/opt/minidlna/minidlna.log

          • pascal

            i can only see video files

            admin@RT-N66U-2A98:/# cat /opt/debian/opt/minidlna/minidlna.log
            cat: can't open '/opt/debian/opt/minidlna/minidlna.log': No such file or directory

          • You did something wrong from the beginning!
            cat /opt/debian/etc/minidlna.conf
            cat /opt/debian/etc/init.d/S98minidlna-debian

          • pascal

            admin@RT-N66U-2A98:/# cat /opt/debian/etc/minidlna.conf
            # port for HTTP (descriptions, SOAP, media transfer) traffic

            # network interfaces to serve, comma delimited

            # specify the user account name or uid to run as

            # set this to the directory you want scanned.
            # * if you want multiple directories, you can have multiple media_dir= lines
            # * if you want to restrict a media_dir to specific content types, you
            # can prepend the types, followed by a comma, to the directory:
            # + "A" for audio (eg. media_dir=A,/home/jmaggard/Music)
            # + "V" for video (eg. media_dir=V,/home/jmaggard/Videos)
            # + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
            # + "PV" for pictures and video (eg. media_dir=PV,/home/jmaggard/digital_camera)

            # set this to merge all media_dir base contents into the root container
            # note: the default is no

            # set this if you want to customize the name that shows up on your clients

            # set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache

            # set this if you would like to specify the directory where you want MiniDLNA to store its log file

            # set this to change the verbosity of the information that is logged
            # each section can use a different level: off, fatal, error, warn, info, or debug

            # this should be a list of file names to check for when searching for album art
            # note: names should be delimited with a forward slash ("/")

            # set this to no to disable inotify monitoring to automatically discover new files
            # note: the default is yes

            # set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO

            # set this to strictly adhere to DLNA standards.
            # * This will allow server-side downscaling of very large JPEG images,
            # which may hurt JPEG serving performance on (at least) Sony DLNA products.

            # default presentation url is http address on port 80

            # notify interval in seconds. default is 895 seconds.

            # serial and model number the daemon will report to clients
            # in its XML description

            # specify the path to the MiniSSDPd socket

            # use different container as root of the tree
            # possible values:
            # + "." - use standard container (this is the default)
            # + "B" - "Browse Directory"
            # + "M" - "Music"
            # + "V" - "Video"
            # + "P" - "Pictures"
            # + Or, you can specify the ObjectID of your desired root container (eg. 1$F for Music/Playlists)
            # if you specify "B" and client device is audio-only then "Music/Folders" will be used as root

            # always force SortCriteria to this value, regardless of the SortCriteria passed by the client

            # maximum number of simultaneous connections
            # note: many clients open several simultaneous connections while streaming

            # Suport to Movie Thumbnail generation. To use this option, thumbnail generation must be enable at compile time.

            # The width of the thumbnail image. Large images takes more time to generate. To use this option, thumbnail generation must be enable at compile time.

            # Thumbnail Image quality. To use this option, thumbnail generation must be enable at compile time.

            # Should the thumbnail have a film strip? To use this option, thumbnail generation must be enable at compile time.

          • pascal

            admin@RT-N66U-2A98:/# cat /opt/debian/etc/init.d/S98minidlna-debian
            cat: can't open '/opt/debian/etc/init.d/S98minidlna-debian': No such file or directory

          • pascal

            i think this is the logs you wanted:

            admin@RT-N66U-2A98:/tmp/mnt/mediaserver/entware/debian/etc/init.d# cat /opt/debi

            # description: Startup/shutdown script for MiniDLNA daemon


            ARGS=' -f /etc/minidlna.conf'

            test -f $MINIDLNA || exit 0
            test -d $MIDIADIR || exit 0

            . /lib/lsb/init-functions
            case "$1" in
            start) log_daemon_msg "Starting minidlna" ""
            start-stop-daemon --start --quiet --pidfile /var/run/minidlna/ --startas $MINIDLNA -- $ARGS $LSBNAMES
            log_end_msg $?
            stop) log_daemon_msg "Stopping minidlna" ""
            start-stop-daemon --stop --quiet --pidfile /var/run/minidlna/
            log_end_msg $?
            log_daemon_msg "Restarting minidlna" ""
            start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/minidlna/
            start-stop-daemon --start --quiet --pidfile /var/run/ --startas $MINIDLNA -- $ARGS $LSBNAMES
            log_end_msg $?
            status_of_proc -p /var/run/minidlna/ $MINIDLNA minidlnad && exit 0 || exit $?
            *) log_action_msg "Usage: /etc/init.d/minidlna {start|stop|restart|reload|force-reload|status}"
            exit 2
            exit 0

          • Yes, was this one.
            ls -l /opt/etc/
            cat /opt/etc/chroot-services.list

          • pascal

            admin@RT-N66U-2A98:/tmp/mnt/mediaserver/entware/debian/etc/init.d# ls -l /opt/et
            -rwxrwxrwx 1 admin root 11 Dec 29 17:16 chroot-services.list
            drwxr-xr-x 2 admin root 4096 Dec 29 17:14 init.d
            -rw-r--r-- 1 admin root 580 Dec 29 17:11
            -rw-r--r-- 1 admin root 0 Dec 18 11:58
            -rw-rw-rw- 1 admin root 105 Dec 29 17:11 opkg.conf
            -rwxr-xr-x 1 admin root 457 Dec 29 17:11 profile

          • pascal

            admin@RT-N66U-2A98:/tmp/mnt/mediaserver/entware/etc# cat /opt/etc/chroot-services.list

          • All seams ok, dunno what more I can do.
            Reboot router

            Working on another tutorial, like I said previously

          • Use this tutorial it's for Optware but steps are the same.

            Remove old installation first:

            To completely uninstall chrooted debian:
            1. Stop minidlna

            /opt/etc/init.d/S99debian stop

            2. Verify if external folder is not mounted, output should be empty, if not - stop again.

            Very important!!! If continue and external folder is mounted, all media files inside will be deleted.

            ls -l /opt/debian/mnt

            /opt/etc/init.d/S99debian stop

            3. Delete debian folder

            rm -r /opt/debian

            4. Delete debian startup script

            rm /opt/etc/init.d/S99debian

            5. Delete chrooted services list

            rm /opt/etc/chroot-services.list

  • 1.1.4 - Released 26-Aug-2014
    - Add magic container infrastructure.
    - Add magic containers for 50 recent items for each category.
    - Fix bad null termination in AAC parsing.
    - Fix requests for the last byte of a file, which affected MKV playback on Philips TV's.
    - Support 64-bit time_t values.


To be notified by email when a new tutorial is posted :)

Thanks for Subscribing! I'll keeping you up-to-date with latest tutorials!

Something went wrong, try again...