[GUIDE] Install MiniDLNA on WD My Cloud (firmware series 3)

By following the steps below you will be switching off (not removing, it will still there to be used if needed) the default preinstalled Twonky DLNA media server in WD My CLoud and replacing it by the open source solution MiniDLNA (a.k.a. ReadyMedia).

THREE GOOD REASONS TO REPLACE TWONKY BY MINIDLNA

 

  1. Twonky will force you to always reproduce a media file sequentially from the exact beginning, not even letting you manually skip to an instant you choose. With MiniDLNA not only will your TV remember the minute you where when you last started watching a movie, allowing resuming view from there, but it will also let you move forward and backward to whatever instant/minute you wish.  Actually, how could anyone conceive a DLNA server without this!?!?!?
  2. Twonky does not provide support for subtitles. MiniDLNA does so, although a bit limited (.srt file must have exactly the same name as the video file. Suffixes such as "_en" must be removed).
  3. MiniDLNA actually seems better performance wise (works very fast and uses less resources).

 

These instructions were applied and proved functional with WD firmware v03.04.01-230 on a WD My CLoud 3TB and Debian repositories as of 26/06/2014. Functionality of MiniDLNA (v 1.1.2) was tested on an LG TV 2013 Model.

UPDATE (11/JUL/2014): APPARENTLY FIRMWARE 4.00.00-607 NO LONGER SUPPORTS THE ABILITY TO SAFELY USE DEBIAN REPOSITORIES OUT THE BOX (a modified version with 64K sized memory pages is now used). You are instead invited to rebuild your own packages.

I assembled them here as a memo mostly for my own reference They may or may not work for you. In any case, use them at your own exclusive risk.

WARNING


Western Digital warns about this sort of procedure possibly voiding the warranty. So think twice if you really want to try this.

 

In any case be extremely careful while modifying system files. If you change stuff you should not you may render your device unusable altogether.

 

Do not touch/edit/change anything unnecessary just out of curiosity or for the sake of it!

 

If you feel uncomfortable with Linux or by using the command line likely it's better you stick with Twonky as it is.

STEP 0 - The below presupposes (prerequisites to be filled, all must match):

 

  1. You have SSH enabled in My Cloud.
  2. You have an SSH client installed in your PC (Windows users will find Putty handy).
  3. You know the local IP address of My Cloud so you can connect to it via SSH.
  4. Your My Cloud has access to the Internet.
  5. Your My Cloud is running a firmware version prior to release 4.00.00-607.

You should then be able to connect to MyCloud via SSH by using the My Cloud IP and standard port 22 with Username: root and Password: welc0me (provided you did not change it… Also notice “0” is number zero, not a capital o).

STEP 1 - Switch off standard (Twonky server) DLNA support in WD control Panel:

 

Menu “Settings” → “Media” → “DLNA Media Server” → switch “Media Streaming” button to “OFF” position. 
You won’t be needing two DLNA servers running simultaneously.

STEP 2 - Backup your sources.list:

 

cp /etc/apt/sources.list /etc/apt/sources.list.bak

STEP 3 - Add Debian SID (experimental) repository to source list so you get a more recent version of MiniDLNA:

 

echo deb http://ftp.us.debian.org/debian/ sid main >> /etc/apt/sources.list

STEP 4 - Update the sid packages list (be patient as it may take a while):

 

apt-get update

STEP 5 - Install MiniDLNA - When asked to continue the installation type y and hit enter (a number of dependencies will be included amounting to around 60MB):

 

apt-get install minidlna

STEP 6 - Stop MiniDLNA so you can edit the configuration files:

 

sudo service minidlna stop

STEP 7 - Edit the MiniDLNA’s startup script in /etc/init.d:

 

nano /etc/init.d/minidlna

Look for the following line: PIDDIR=/run/$NAME
Add /var to the beginning of the path so it instead reads: PIDDIR=/var/run/$NAME

Note: Keyboard shortcuts to operate Nano editor are listed in the bottom of the window. “^” means press “Ctrl” key (+ given letter)

STEP 8 - Edit the configuration file /etc/minidlna.conf

 

nano /etc/minidlna.conf

Read the instructions supplied there and configure accordingly. Namely:

a -

If you want to restrict a media_dir to a specific content type, you can

#prepend the directory name with a letter representing the type (A, P or V),

followed by a comma, as so:

media_dir=A,/DataVolume/shares/Public/Shared Music
media_dir=P,/DataVolume/shares/Public/Shared Pictures
media_dir=V,/DataVolume/shares/Public/Shared Videos

Note: the above example adds the standard My Cloud Public Shared folders. You will want to add additional folders you may have created.

b -
 # Path to the directory that should hold the database and album art cache. Change to a folder you created somewhere in the large Public Data folder of My Cloud.

Example:
db_dir=/DataVolume/shares/Public/programs/minidlna/cache

_ Note1: Very important to do this. Otherwise you will be filling the small  OS partition.
Note2: The above example requires you to create a /programs/minidlna/cache
 folders inside the Public Share Folders (you can use any file explorer for that matter).It can be anywhere else,
provided inside /DataVolume/shares/Public/_

 

c -

Path to the directory that should hold the log file.

log_dir=/DataVolume/shares/Public/programas/minidlna

_ Note1: Very important, otherwise you will be filling the small OS partition. _

Note2: The above example requires you to create a /programs/minidlna/
 folder inside the Public Share Folders. It can be anywhere else, 
provided inside /DataVolume/shares/Public/
Note 3: Having a log file is actually OPTIONAL (you can skip it) but useful for debug purposes.

 

d -
 # URL presented to clients (e.g. http://example.com:80)..)
presentation_url= http://YOUR.WD.MYCLOUD.IP:8200

Note: Replace YOUR.WD.MYCLOUD.IP by whatever IP your My Cloud has on LAN (local network). I am assuming it is static (always the same, as configured/attributed by the router).

 

e -

Automatic discovery of new files in the media_dir (uncomment/remove the initial # to make it active)

directory.inotify=yes

Note: Automatically searches for new files added without the need to restart the program.

 

STEP 9 - Add user minidlna to share group:

 

usermod -a -G share minidlna

Note: Critical, otherwise you will have Read/Write permission issues. Most notably with the “force-reload” option (see below).

STEP 10 - Move back your original sources.list:

 

mv -f /etc/apt/sources.list.bak /etc/apt/sources.list

STEP 11 - Start MiniDLNA:

 

service minidlna start

STEP 12 - Increase inotify watch limit (Optional)

If you have enabled inotify (see step 8.e, above)  and should you ever stumble on errors about inotify file watch limit being reached (you may wish to do this preventively as well in case you anticipate having a really large number of files) try issuing the following command:

echo fs.inotify.max_user_watches=100000| sudo tee -a /etc/sysctl.conf && sudo sysctl -p

This will define and apply a maximum of 100000 files to be watched by adding the following line to /etc/sysctl.conf:

fs.inotify.max_user_watches=100000

Reference:  Increasing the amount of inotify watchers

  BEAR IN MIND

 

You should turn firmware automatic updates off and backup configuration files in case you futurely update the NAS firmware and need to reinstall MiniDLNA.

The above works for files publicly accessible by everyone. Should you wish MiniDLNA to index and serve files included in directories of particular users you will need to tweak permissions.

USEFUL COMMANDS

 

service minidlna stop //stops daemon
service minidlna start //starts daemon

minidlnad  //same as previous (starts daemon)
service minidlna force-reload  //forces cleaning the database and starting fresh

FURTHER NOTES

 

Accessing the following URL in a browser will show a summary of indexed files and connected clients: 
http://YOUR.WD.MYCLOUD.IP:8200
[Replace YOUR.WD.MYCLOUD.IP by whatever IP your My Cloud has on LAN (local network)]

List of files installed by package:
https://packages.debian.org/sid/armhf/minidlna/filelist

USEFUL DOCUMENTATION ELSEWHERE

 

http://community.wd.com/t5/My-Book-Live/miniDLNA-install-and-the-blankpage-UI-problem/td-p/652803
http://community.wd.com/t5/WD-My-Cloud/GUIDE-Transmission-2-82/td-p/619597

While googling for documentation/help bear in mind that My Cloud is propelled by the Debian distribution (whose relatives include Ubuntu and Mint for instance). User experiences using minidlna in these is more likely to apply.

4 Likes

Hi and welcome hvalentim, thank you for sharing. 

Awesome tutorial only that you might want to get minidlna from wheezy repo for stability.

echo deb http://ftp.us.debian.org/debian/ wheezy main >> /etc/apt/sources.list

Throwing error after latest (July 2004 the 9th, v04.00.00-607) update:

MyCloud:~# service minidlna start
[....] Starting DLNA/UPnP-AV media server : minidlna/etc/init.d/minidlna: line 79: 19964 Killed start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:$GROUP --exec $DAEMON -- $DAEMON_ARGS
 failed!

Transmission fails with a similar error. Ideas?

Haven’t tried the new firmware yet and after all the time spent tweaking the previous I do no think I will any time soon.

I suppose that after the firmware upgrade you redid all the steps?

It may  eventually have something to do with permissions. As a debug measure you can always try editing /etc/minidlna.conf and changing user=minidlna to user=root there and see if that helps.

As for Transmission, I strongly advise you to alternatively give **Aria2**a try. You can get it from Debian repositories.

Performance/resource use is incredibly much better and not only will it allow downloading torrents but also handle pretty much any other sort of download as well. Once installed there’s a neat   Web GUI available.

Tried first Transmission and Deluge and both ended up giving plenty of timeouts and inconsistent download speeds. They work OK provided they manage a limited number of connections/torrents but tend to go berserk  if you push them.

From WD-README.txt within available source file:

"Instructions to rebuild a Debian package

The WD My Cloud device firmware versions 04.00.00 and later use a modified version of Debian Linux which uses 64K sized memory pages.

In order to build Debian packages for use on a 64K page-size device, an “qemu-emulated native” build system is used, which contains the binutils package modified for 64K page-size alignment.

Prerequisites:

  • x86 PC with 64-bit Ubuntu or Debian installed
  • packages qemu-user-static and binfmt-support installed on host build system
  • Modified binutils package with 64K page size support. A pre-built version is included in binutils directory. There is no need to re-build binutils, however, instructions are provided in the source package (see binutils/README-binutils-64K-pagesize.txt).

Run the script:

./build-armhf64k-package.sh <package_name>

Where:

<package_name> is the name of the package you would like to build.
is the Debian suite version. E.g., “wheezy” (i.e. stable) or “jessie” (i.e. testing).

After a successful build, the Debian build artifacts (.deb files) for the package will appear in the directory “build/root”. The artifacts may then be copied to a WD My Cloud device, and installed through the standard Debian install mechanism (dpkg -i)."

I guess this can improve performance but may as well prove to be a big hassle considering the handling of the dependencies…

1 Like

Thank you very much for your reply.

Mhmmm… I think I’ll stick to Transmission for now. Indeed, I’ve seen that you can’t push it. But it usually works just fine dealing with a small amount of connections.

That explains a lot. Seems I won’t be upgrading to 4.0. I don’t have a Linux box and I’m too lazy to install a virtual. Plus, I’m not so good with Linux. Also, 4.0 caused issues out of the box anyway. So… Maybe, someone will upload some already compiled file somewhere.  :stuck_out_tongue:

Cheers.

hvalentim,

Just wanted to thank you for adding in our disclaimers.  We really appreciate that our users show this kind of responsibility. 

Bill_S

Hello,

after reading the whole thread I still don’t understand if it’s possible to stream subtitles over the DLNA server. So, I have Sony KDL-40W605B TV & Western Digital My Cloud 3 TB (firmware v04.00.00-607 & Twonky DLNA media streaming server 7.2.8_7.5.0-20140510.024914).

As such, external subtitles don’t work and muxing subtitles in video files isn’t an option.

Is it possible to install MiniDLNA on this WD firmware without losing my data on WD drive?

Regards,

I have an LG TV myself and never used the Twonky version shipped with v.4 firmware so I am afraid I can not help you with that.

Concerning the installation of MiniDLNA with firmware v.4, I am unaware of the existence of a custom compiled version. So the short answer is no. It is thus far not possible.

@mladimatija,

please check the specs of your TV.   No matter what you do, unless you get an actual client (i.e. computer, media player, etc) to play your movies, your TV will not display subtitles over network, only USB.

http://pdf.crse.com/manuals/14HM094111/EN/codeclist.html#10 

Thank you for your answers. So, my next question is: Is it then possible to stream movies with subtitles from Android Media Player > WD My Cloud (LAN) > TV? Also, which price range do you recommend for such media players?

It should be WD My Cloud > Android media player > TV.  If you’re android media player supports subtitles (most likely would) then it should work.  Otherwise most media players will support subtitles.  You can use a cheap laptop, pc, roku, wd tv, etc…

I’m streaming movies from WD MyCloud to EZCast dongle in TV (by default DLNA client from WD) controlling by android phone. You can use for this Media House or Bubble UPNP apps from market.

BTW, Android is involved just as control device. I can even switch the phone off and this will not stop the show, I’ll just loose the control of playback.

Hi everyone, and sorry for the long absence. 

About the subtitles - I didn’t read the entire discussion cause i’m in kind of a hurry here but on short - minidlna streams .str subtitles just fine as long as both movie and subtitle file have the same name - e.g. movie.avi / movie.str

neither WD Dlna server nor Twonky (before v.7) does not support subtitles. 

I don’t know anything about this new firmware since right now I use fully working debian wheezy distro with my MyBookLive and the new Twonky 7.2.8 as media server and everything works like a charm. I found this firmware on a russian forum and I can say it is awesome.

If the moderators are ok with this, i’ll post here everything about it, if not you can ask me about the details via PM.

Cheers!

Sorry for the missunderstanding, i was sure that i’m replying to my topic… the wheezy firmware is for MyBookLive… sorry again… i gotta catch some sleep hours… :frowning:

Hello everyone,

I was wondering if it was possible to safely downgrade the firmware like it’s described here http://community.wd.com/t5/WD-My-Cloud/Firmware-downgrade/m-p/693892/ and then install MiniDLNA?

Or any custom firmware for that matter. Has anyone tried it yet?

Regards,

Hey

Has anyone taken the plunge and recompiled Minidlna for firmware version 4 as per the full guide here:

http://community.wd.com/wstd/board/message?board.id=mycloud&message.id=18650#M18650

(there is a link at the top of this thread which has information about compiling packages for the new firmware but the guide above seems more useful).

I am tempted to have a go but i’d have to install linux somewhere and id really rather not. Im also not sure about what would happen with dependencies and such as im really no linux afficionado.

I would be surprised if no-one on the formus had already done this as there seems to be an interest in those of a technical bent to have minidlna on their my cloud. But so far anyone who has done this is not sharing their results or at least not that i can find for all the googling I have done.

I have seen instructions on how to install clean debian with openmediavault (which also seem to include downgrading the firmware which I dont really want to do as heartbleed and or shellshock probably arent patched under the older versions and I cant confirm from reading and rereading the thread what the results will be vis a vis the original web ui and software on the my cloud and my data already on the device).

http://community.wd.com/t5/WD-My-Cloud/Clean-debian-and-OpenMediaVault-on-WDMyCloud/td-p/785505

Anyway i was hoping someone who had been reading this thread might have some info. It has been several months since the new firmware came out.

I can tell you that it can be done in V4.

I built amule and minidlna for V4 before and they worked fine.

However, my WD my cloud was crashed and I lost all the deb files.

Jsut follow the guide you post, you can build all the packages (to me I built them in ubuntu under a VM).

It is a very time consuming process as you have to build many deb files.

I hope you good luck to build all of them!

When you build it does it automatically build all the dependencies which are needed or do you need to do that all manually?

And if you have to do them all manually do you have any pointers on how to determine what packages need built?

I have no problem if it takes a long time id just rather know that when I have built something im not going to have to stop and figure out what dependencies I forgot or didnt know to include.

Its a pity all those people who have rebuilt packages for the new firmware didnt feel the need to share with the rest of the community.

@henryjfry,

_ Its a pity all those people who have rebuilt packages for the new firmware didnt feel the need to share with the rest of the community. _

Apart from security concern installing personally built packages, rebuilding the packages is no easy task. Run below in shell (you need to 1st add the source list then “apt-get update”): 

nazar@TeaNazaR4TB:~$ apt-cache depends minidlna
minidlna
Depends: adduser
Depends: lsb-base
|Depends: libavformat53
Depends: libavformat-extra-53
|Depends: libavutil51
Depends: libavutil-extra-51
Depends: libc6
Depends: libexif12
Depends: libflac8
Depends: libgcc1
Depends: libid3tag0
Depends: libjpeg8
Depends: libogg0
Depends: libsqlite3-0
Depends: libvorbis0a

OR show all:

nazar@TeaNazaR4TB:~$ apt-cache showpkg minidlna
Package: minidlna
Versions:
1.0.24+dfsg-1 (/var/lib/apt/lists/ftp.us.debian.org_debian_dists_wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/ftp.us.debian.org_debian_dists_wheezy_main_binary-armhf_Packages
MD5: 5b2d396f86d25a79b5ab8a1c34181623
Description Language: en
File: /var/lib/apt/lists/ftp.us.debian.org_debian_dists_wheezy_main_i18n_Translation-en
MD5: 5b2d396f86d25a79b5ab8a1c34181623

1.0.24+dfsg-1 (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/ftp.us.debian.org_debian_dists_wheezy_main_binary-armhf_Packages
MD5: 5b2d396f86d25a79b5ab8a1c34181623
Description Language: en
File: /var/lib/apt/lists/ftp.us.debian.org_debian_dists_wheezy_main_i18n_Translation-en
MD5: 5b2d396f86d25a79b5ab8a1c34181623

Reverse Depends:
Dependencies:
1.0.24+dfsg-1 - adduser (0 (null)) lsb-base (0 (null)) libavformat53 (18 4:0.8-1~) libavformat-extra-53 (2 4:0.8-1~) libavutil51 (18 4:0.8-1~) libavutil-extra-51 (2 4:0.8-1~) libc6 (2 2.4) libexif12 (0 (null)) libflac8 (2 1.2.1) libgcc1 (2 1:4.4.0) libid3tag0 (2 0.15.1b) libjpeg8 (2 8c) libogg0 (2 1.0rc3) libsqlite3-0 (2 3.5.9) libvorbis0a (2 1.1.2)
1.0.24+dfsg-1 - adduser (0 (null)) lsb-base (0 (null)) libavformat53 (2 6:0.8.3-1~) libavutil51 (2 6:0.8.3-1~) libc6 (2 2.13-28) libexif12 (0 (null)) libflac8 (2 1.2.1) libgcc1 (2 1:4.4.0) libid3tag0 (2 0.15.1b) libjpeg8 (2 8c) libogg0 (2 1.0rc3) libsqlite3-0 (2 3.5.9) libvorbis0a (2 1.1.2)
Provides:
1.0.24+dfsg-1 -
1.0.24+dfsg-1 -
Reverse Provides:

OR via web: 

Just look here https://packages.debian.org/search?searchon=sourcenames&keywords=minidlna

Choose your suite, then look at the “adep:”. Each of those are required to be rebuilt manually if its not already in your system (check: “dpkg -l|grep package_name”). If that doesn’t look bad, each of those has its own sub-dependencies to go crazy with. And no it won’t automatically build for you but you can do sort of scripts to help out a bit.

The problem here is not figuring out dependencies, but if they can be compiled successfully or not. I recently tried gcc-4.9. It took almost the whole night despite me running the entire build process on ramdisk. But ends up with segment fault. Also when installing those debs, one needs to be careful as not to break the mycloud. I have rebuilt several packages but only those few I could share here because it needs more than just installing i.e. modifying configs, linking libraries manually.