Minidlna Media Server through Debian Arm

This guide is obsolete now, use this one instead
It's only for arm devices, like RT-AC56U,  RT-AC68U/R, RT-AC87U/R
For mipsel optware version go here
For mipsel entware version go here

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), this version will not rebuild entire database after every router reboot.

Let's start

1 - Turn off Media server from router ui, insert an usb drive in to the router, should be formatted as ext2, ext3 or ext4

2 - Install Asus Download Master to activate optware environment, uninstall or disable after if you don't using it, if you need a better download manager use transmission instead

3 - Enable jffs partition (skip to point 5 if was previously enabled)

4 - Reboot router

5 - Open terminal and input the next commands:

ipkg update
ipkg upgrade
ipkg install nano findutils
cd /opt

6 - Download prepared debian with all necesary libs and decompress

wget -c -O debian-minidlna-1.1.4-arm.tgz http://goo.gl/oLIF8y
tar -xvzf ./debian-minidlna-1.1.4-arm.tgz

7 - 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 http://goo.gl/FnWro0
chmod a+rx /opt/etc/init.d/S99debian

8 - 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 http://goo.gl/gFdbdr
chmod a+rx /opt/etc/chroot-services.list

9 - Now create services-start script to start debian together with all other services

nano /jffs/scripts/services-start

Paste this lines in terminal

#!/bin/sh

sleep 10
/opt/etc/init.d/S99debian start

 
Save with CTRL-O / Enter / and exit with CTRL-X

10 - Now create services-stop script to stop debian together with all other services

nano /jffs/scripts/services-stop

Paste this lines in terminal

#!/bin/sh

/opt/etc/init.d/S99debian stop

 
Save with CTRL-O / Enter / and exit with CTRL-X

11 - Make scripts executable

chmod a+rx /jffs/scripts/*

Start minidlna

/opt/etc/init.d/S99debian start

12 - Go to 192.168.1.1:8200 (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 7 carefully

minidlna

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

exit

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-1_armel.deb http://goo.gl/WTGdmI
wget -c -O /opt/debian/var/tmp/minidlna.conf http://goo.gl/G4IOC2

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 755 /etc/minidlna.conf
dpkg -i minidlna_1.1.4-1_armel.deb

5. Exit debian

exit

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

Minidla-bookmarks

 

  • Skello

    Hi,

    When I rebooted the router, the debian + minidlna did not start, even though I have created the /jffs/scripts/services-start as instructed.

    Also, since debian is installed on the external disk, shouldn't we use /jffs/scripts/post-mount instead?

    Furthermore, in /jffs/scripts/services-stop I also have swapoff /opt/swap. Should /opt/etc/init.d/S99debian stop come before that or after. I assume before? and if so, should I add a sleep 10 between /opt/etc/init.d/S99debian stop and swapoff /opt/swap to give the debian script time to stop services before swap is disabled?

    Third, while doing something unrelated in Debian bash I received this alert, which I assume is from the minidlna service: insserv: warning: script 'S98minidlna' missing LSB tags and overrides

    • This kind of feedback I expect, thanks.
      I made a better guide, please use this https://www.hqt.ro/minidlna-upnp-media-server-through-debian-wheezy-mipsel-optware/

      S99debian script is in post-mount now.
      I don't know if is so important to disable swap after all services are stopped.
      If I remember right, I solved S98minidlna script in this version

      • Skello

        Quick question. Will Debian use the same swap file enabled in Asuswrt-Merlin or does it need a separate swap?

        • It uses the same /dev /proc /sys and the same swap

  • 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.

Get Email Notification When a Server or Port is Unreachable
SoftEther VPN Running on AsusWRT Routers
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Spreed WebRTC server and web client
Asterisk VoIP Server running on AsusWRT Routers
Get Email Notification When a Server or Port is Unreachable
SoftEther VPN Running on AsusWRT Routers
NZBGet through Entware
Minidlna UPnP Media Server through Debian Jessie Arm

SUBSCRIBE

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...