How to Install Xupnpd DLNA Media Server From Source - Debian

Xupnpd is a light DLNA Media Server which provides ContentDirectory:1 service for sharing IPTV unicast streams over local area network (with udpxy for multicast to HTTP unicast conversion).

Features

  • Builtin DLNA/UPnP media server for sharing local media files and external IPTV/Radio streams
  • Builtin multicast proxy for MPEG-TS streams
  • YouTube, Vimeo and GameTrailers plugins (HD)
  • No transcoding
  • HDTV ready
  • Parent control (Access Control List)
  • Web-based user interface
  • LUA scripting

 

Setup Debian from point A or B, depends which router do you have

A - For Arm routers, setup Debian Jessie from here

B - For Mipsel routers, setup Debian Wheezy from here

1 - Enter chrooted debian with:

debian enter

2 - Update Debian

apt update && apt upgrade -y

3 - Install necessary packages

apt install nano git build-essential uuid-dev psmisc -y

- Clone and compile xupnpd source code

cd /var/tmp
git clone https://github.com/clark15b/xupnpd.git
cd xupnpd/src
make

5 - Move files to /etc folder

mkdir -p /etc/xupnpd
mv /var/tmp/xupnpd/src/* /etc/xupnpd
rm -r /var/tmp/xupnpd

6 - Create startup script, paste in terminal

cat >> /etc/init.d/S99xupnpd-debian << 'EOF'
#!/bin/sh
### BEGIN INIT INFO
# Provides: xupnpd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Light DLNA IPTV media server
### END INIT INFO
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting Light DLNA IPTV media server" "xupnpd" || true
if /etc/xupnpd/xupnpd; then
log_end_msg 0 || true
else
log_eng_msg 1 || true
fi
;;stop)
log_daemon_msg "Stopping Light DLNA IPTV media server" "xupnpd" || true
if killall xupnpd >/dev/null; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;status)
pidof xupnpd >/dev/null 2>&1 && {
echo "xupnpd is running." || true
exit 0
}
echo "xupnpd is not running." || true
;;*)
log_action_msg "Usage: /etc/init.d/xupnpd {start|stop|status}" || true
exit 1
esac
exit 0
EOF

Press ENTER
7 - Make script executable

chmod 755 /etc/init.d/S99xupnpd-debian

8 - Fix network and fork daemon to background by editing configuration file

sed -i "s|interface='lo'|interface='br0'|g" "/etc/xupnpd/xupnpd.lua"
sed -i "s|cfg.daemon=false|cfg.daemon=true|g" "/etc/xupnpd/xupnpd.lua"

9 - To enable startup script we need to exit debian

exit

10 - Add xupnpd to chrooted services list

echo "" >>/opt/etc/chroot-services.list
echo "S99xupnpd-debian" >>/opt/etc/chroot-services.list
chmod 755 /opt/etc/chroot-services.list

11 - Start xupnpd

debian restart

12 - Go to 192.168.1.1:4044 (this is the default router ip, modify to your router ip if you change it previously) and configure settings, add your playlists and feeds...

xupnpd-page

13 - Watch videos on your preferred dlna client

  • Egor

    Hi firstly thank you for the tutorial, but is there a way to make this DDNS accesable? So i can go to xxxx.asuscomm.com:4041?
    thanks

    • TeHashX

      Sure, to open a router port add to /jffs/scripts/firewall-start
      #!/bin/sh
      iptables -I INPUT -p tcp --destination-port 4044 -j ACCEPT
      Fix permission
      chmod 777 /jffs/scripts/firewall-start
      Apply rule immediately
      sh /jffs/scripts/firewall-start
      firewall-start script will open requested port/ports on every router reboot

      • Egor

        Doesnt work for me :(

      • TeHashX

        Post here output from:
        ls -l /jffs/scripts
        cat /jffs/scripts/firewall-start

      • Egor

        admin@xxxx:/tmp/home/root# ls -l /jffs/scripts
        -rwxrwxrwx 1 admin root 249 Jun 24 23:13 firewall-start
        -rwxrwxrwx 1 admin root 135 Jan 25 21:03 init-start
        -rwxrwxrwx 1 admin root 229 Mar 13 19:35 post-mount
        -rwxrwxrwx 1 admin root 193 Feb 14 17:05 services-start
        -rwxrwxrwx 1 admin root 43 Feb 14 17:05 services-stop
        admin@xxxx:/tmp/home/root# cat /jffs/scripts/firewall-start
        #!/bin/sh

        iptables -I INPUT -p tcp --destination-port 9091 -j ACCEPT
        iptables -I INPUT -p tcp --destination-port 51413 -j ACCEPT
        iptables -I INPUT -p udp --destination-port 51413 -j ACCEPT
        iptables -I INPUT -p tcp --destination-port 4044 -j ACCEPT

      • Egor

        tried adding iptables -I INPUT -p udp --destination-port 4044 -j ACCEPT - still not working

      • TeHashX

        I found the issue, something must be changed in latest firmwares, don't need to open ports in firewall-script but in router UI under Virtual Server / Port Forwarding
        XUPNPD-PF

  • TeHashX
    • Scruck

      I have already installed debian jessie and follow the tutorial ... but get this error

      • TeHashX

        Fixed :)
        Continue from step 3, don't forget to refresh your browser!

  • Scruck

    Router ac87u

    root@RT-AC87U-59E0:/var/tmp# svn co http://tsdemuxer.googlecode.com/svn/trunk/xupnpd
    A newer kernel is required to run this binary. (__kernel_cmpxchg64 helper)
    Aborted

    what is the problem? Thanks!

    • Scruck

      sorry :(

  • Csaba Benesch

    I have removed debian but the xupnpd is still visible in dlna player, any idea?

    • Reboot router

      • Csaba Benesch

        Rebooted 5x, but still visible

      • Then you didn't uninstalled debian

      • Csaba Benesch

        Debian removed, rm /opt/debian also folder is no more there

      • Strange,
        also remove /opt/etc/chroot-services.list
        xupnpd is visible but it still works?

      • Csaba Benesch

        /opt/etc/chroot-services.list removed too router rebooted, it is visible, but can not play video/music

      • I bet xupnpd is visible even if router is powered off, you have an issue with dlna client, somehow remain in cache.

      • Csaba Benesch

        Player is Samsung BD500, screenshot attached what the player see. The second is minidlna (optware-ng)

      • Reset dlna player to factory defaults

      • Csaba Benesch

        after reset it seems ok, thank you :)

  • SebZab

    I have installed xupnpd directly from entware on my RT-AC56U. After configuration it seems to work, but in most of cases I see "corrupted" info (error with audio). Only few movies from built-in playlists are playing properly...

  • BaRDaHL

    Hello, thanks for the guide, amazing router and amazing web!!!
    i have a RT-AC87U on AP mode whit 3TB Seagate (7200RPM - 64MB CACHE) USB3.0 Hard Disk, following ur guides i already managed to install:
    * MERLIN
    * ENTWARE
    * DEBIAN
    * XUPNPD (on debian)
    * Transmission (on debian)
    * udpxy (on entware)

    btm everithing is working fine for me (i dont know how i managed to install udpxy whitout a guide but it is running and working fine) would be good you make a guide for this :P

    The only problem i have right now is that if the router restarts everithing goes up (transmission, udpxy) but no xupnpd.... i mean if i check pids (ps command on ssh) i can see xupnpd running but it is not accesible from web ui. All i need to do is "debian restart" and it will be back working again....
    1- How can i fix it so it runs normally after restart whitout me having to restart debian?
    2- How is posible udpxy starts automatically if did nothing for that? i mean i was asking myself hhow to make it start automatically after restart but dont tryed nothing... (all i did to install it was something like (opkg install .ipkglink) and nothing more...
    3- should i make any specific configuration for udpxy to make it runs better?

    Thanks in advance and sorry about my bad english...

  • Tery

    wget -c -O /etc/init.d/S99xupnpd-debian http://goo.gl/yK8p7c
    bash: wget: command not found

    I suppose the link is broken already.
    Would appreciate a new link to be updated.

    TKs.

    • apt-get install wget

      • Tery

        Thx!
        I thought I had that installed earlier.

        It's working now.
        Cheers.

  • Ocram59

    Hello
    I have a strange problem : If i start XUPNPD on my RT-N66U as a daemon then the S99 script says "ok" but the service is not running

    If configure it with cfg.daemon=false then it starts regularly , writing it's output on the terminal and it works without problem.

    This strange thing did not happen the very first time that I tried to start it

    It began to happen only after i removed the whole tree and I remade the full procedura again recompiling everything ok.

    I wonder where i can dind XUPNPD logs to understand why it does not run as daemon

    I add a datai: if I run it whith cfg.daemon=false but detaching it from terminal (&) it runs without any problem.

    Any idea or anh hint to help me to understand why it does not work in daemon mode?
    Thanks In advance

    Ocram59

    • The nice part of debian is that when something goes wrong you can delete debian folder (don't forget to stop S99debian first or all files mounted in external directory will be deleted) and start from beginning.
      I have no idea what could be wrong.

      • Ocram59

        As last chanche I will try to do that.

        Deleting the /etc/xupnpd folder (from chrooted) did not help at all so i will try to delete the whole debian (I use it for minidilna too) and reinstall it from scratch .
        Thanks for your reply and ofr the advice to stop S99debian before deleting it to avoid to delete all the files mounted , i was aware of it thanks to your guide but it always nice to rewrite it for everybody.
        I will lett you know if reinstalling debian from scratch will change anghing
        BR
        Ocram59

      • I just check on RT-N66U and it's all ok, maybe you modified something in /etc/init.d/S99xupnpd-debian script?

      • Ocram59

        Hello
        No , I did not modify /etc/init.d/S99xupnpd-debian script and also please consider that before asking your help here i tried to re execute the xpunpn install procedure from zero so the script was downloaded again .
        Realy no idea about hwat but probably when i deleted /etc/xpunpd to reinstall it the first time probably i dd some mistake.
        Unfortunately I di dnot save debian folder to see now what is differnt so.. .. let'be happ that everything works now simply reistalling everything after some mistake of mine
        Thanks alot
        Ocram59

      • I posted how to backup debian in case someone need it for the future.

      • Don't forget to rate posts!
        REVIEW (CLICK ON THE STARS TO RATE!)

      • Ocram59

        Hello Again
        After deleting and reinstalling debian from zero.. everythings works fine now :-)
        I learned that sometimes it is the results that counts and so I am happy with it
        Thank you again for all
        BR
        Ocram59

    • I found the reason: xupnpd.pid was not deleted from previous run.

  • Incognito Psytrancer

    Wow! Cool, well done! You're a real man! Thank you so much !!!!!!!

    Another would be a manual for Adbloсk device and can be called a full-fledged kombain!

    • Dunno if it worth such a service, why don't you use adblock on pc browser or android phone?

  • DLNAFan

    When performing step 10, I get:

    Starting chroot'ed Debian services...

    mount: mounting /dev on /tmp/mnt/sda1/asusware/debian/dev failed: No such file or directory

    mount: mounting /proc on /tmp/mnt/sda1/asusware/debian/proc failed: No such file or directory

    mount: mounting /sys on /tmp/mnt/sda1/asusware/debian/sys failed: No such file or directory

    mount: mounting /tmp/mnt/sda1/Media on /tmp/mnt/sda1/asusware/debian/mnt failed: No such file or directory

    chroot: can't change root directory to /tmp/mnt/sda1/asusware/debian: No such file or directory

    Done.

    --

    I guess the directory should be: /tmp/mnt/sda1/entware/debian/dev etc...

    How can I get this right?

SoftEther VPN Running on AsusWRT Routers
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Nginx Web Server with PHP Support through Optware-NG
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
SoftEther VPN Running on AsusWRT Routers
NZBGet through Entware
Minidlna UPnP Media Server through Debian Jessie Arm
NetData System Monitor Entware

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