Mldonkey - multi-network file-sharing client

Originally by marge and frontalot from linkstationwiki.org =Background= MLDonkey is an open source, free software multi-network peer-to-peer application that supports the BitTorrent protocol . It is also the name of the peer-to-peer overlay network that application uses. Originally a Linux client for the eDonkey protocol MLdonkey is written in the Ocaml programming language and licensed under the GPL. The application separates the user interface (which can be a web browser, telnet, or a third-party GUI application) and the code that interacts with the peer-to-peer networks.

MLDonkey supports the following network protocols, either partially or completely:
 * EDonkey network
 * Overnet
 * BitTorrent
 * Direct Connect
 * FastTrack
 * Kad Network
 * HTTP/FTP

=Installation=

ARM9
{| MLdonkey is reported to run well and stable on ARM9 boxes. Only emule sui feature has to be disabled cause mldonkey's implementation needs a real FPU which is not present in SoftARM Linkstations.
 * -valign=top

Pre-compiled mldonkey cores for ARM architectures are avaiable for download:
http://mldonkey.sourceforge.net/forums/viewtopic.php?t=4825 Cores are compiled on Debian Linux.

There are possible issues about DNS resolutions or library version problems (Linkstations have modified version of libc which could cause incompatibility). In order to solve these issues the cores are bundled with the exact shared libraries (zipped in archive) and libc version used to compile the cores.




 * }

FIRST SOLUTION(easy)
The Library problem (if arises) has an easy solution, let's put the bundled libraries in a proper directory ("/new_libs_path" in this example) and call mlnet thru next script. For example Georg wrote following three liner scripts:

LD_LIBRARY_PATH=/new_libs_path:$LD_LIBRARY_PATH export LD_LIBRARY_PATH /path_to_mldonkey/mlnet.static

This starts the static linked mlnet after setting the LD_LIBRARY_PATH environment variable as needed. And the variable is only set for the call of mlnet (the new added libraries are picked first to look for standard ones), thus the remainer of the installation is not affected.It is higly suggested to use a user to only run mldonkey. DNS issue seems to be solved and mldonkey works as it should. You can also try running mlnet by commandline:

$ LD_LIBRARY_PATH=/new_libs_path:$LD_LIBRARY_PATH ./mldonkey_path/mlnet (arguments?)

SECOND SOLUTION (CHROOT MLNET)
A more complex solution is to "chroot" mldonkey.This is also a feature suggested to raise system security but this is quite difficult to set. Togeis has wrote a splendid walkthru:

This is a little howto running mldonkey on a opend Stock firmware. I am using 1.11-1.a. All steps are done as root user.

1) Make a new mldonkey User: If /mnt/disk1/home doesn't exist, make it:

mkdir /mnt/disk1/home

Adding user:

useradd -d /mnt/disk1/home/mldonkey -m mldonkey

I used a homedir an disk1 to prevent filling up /

2) Getting UID of created user:

grep mldonkey /etc/passwd|cut -d ":" -f3 1000

Now you have the UID you can use for starting mldonkey

3) Setting up chroot: - Make /dev/null and /dev/random

mkdir /mnt/disk1/home/mldonkey/dev mknod /mnt/disk1/home/mldonkey/dev/null c 1 3 mknod /mnt/disk1/home/mldonkey/dev/urandom c 1 9

- Copy Libs: Use the libraries tarfile from fabtar

cp libraries.tar.bz2 /mnt/disk1/home/mldonkey cd /mnt/disk1/home/mldonkey tar -jxvf libraries.tar.bz2

- Make ./etc

mkdir /mnt/disk1/home/mldonkey/etc cp /etc/group /etc/hosts/ /etc/nsswitch.conf /etc/passwd /etc/resolv.conf /mnt/disk1/home/mldonkey/etc

4) Copy MLDonkey: Started mldonkey before: - You have to copy the existing directory form the old mldonkey directory to the new home directory /mnt/disk1/home/mldonkey - Edit your downloads.ini for the new root:

incoming_directory = incoming temp_directory = temp shared_directories = [ shared1; shared2; shared3] run_as_user = ""

Starting with a fresh install: I use the static build with gd support from fabtars tarfile.

cp mldonkey-2.9.0.CVS.static.arm-Linux_glibc-2.3.6.tar.bz2 /mnt/disk1/home/mldonkey cd /mnt/disk1/home/mldonkey; tar -xjvf mldonkey-2.9.0.CVS.static.arm-Linux_glibc-2.3.6.tar.bz2 mv ./mldonkey-distrib-2.9.0.CVS/*. rm ./mldonkey-distrib-2.9.0.CVS

5) Setting up ownership

chown -R mldonkey:mldonkey /mnt/disk1/home/mldonkey chown -R root:root /mnt/disk1/home/mldonkey/lib /mnt/disk1/home/mldonkey/etc /mnt/disk1/home/mldonkey/dev

mldonkey is the user created at step 1. The user has its own group named the same.

6) Staring mldonkey with chroot Be sure you are root:

id getting --> uid=0(root) gid=0(root)

Setting enviroment:

export MLDONKEY_CHROOT=/home/mldonkey

Starting mldonkey:

cd /mnt/disk1/home/mldonkey ./mlnet -run_as_useruid 1000

1000 is the UID of the user mldonkey you get it in step 2

7) Starting mldonkey with nohup (detach mldonkey from the console)

- Install nohup if it doesn't exist: When you use a opend Stock firmware with wget installed, you don't have nohup, but you can install it by yourself. Get the file coreutils-6.7-r1.tbz2

cd /tmp wget http://downloads.nas-central.org/LSPro_ARM9/Distributions/Genlink/Binaries/armv5tejl-softfloat-linux-gnueabi/coreutils-6.7-r1.tbz2 tar -C / -xjvf coreutils-6.7-r1.tbz2 ./usr/bin/nohup

- Starting mldonkey as root

cd ~mldonkdey nohup ./mlnet -run_as_useruid 1000 &

Now you are able to close the terminal and mldonkey keeps on running. Output created by mldonkey is written to ./nohup

NOTES: Mindbender has pointed that overmentioned solutions are inelegant. You may consider to merge the tricks with a smarter way to launch mlnet, a more elegant way is for example this startup script: http://www.unet.univie.ac.at/~a0025690/scripts/mldonkey

Someone told me that they had problems because su was missing. in case that is true for the arm9-boxes as well then we can just remove that command and just use the built in mldonkey thing you used. if su is missing replace this line

su - $USER -c"/usr/local/bin/mlnet&"

with either

/usr/local/bin/mlnet -run_as_useruid 1000 &

if you start it automatically at bootup from /etc/init.d/rcS by adding

echo "exec_sh mldonkey" >> /etc/init.d/rcS

then you do not need to install nohup btw. In case you are a script-guru, I suggest to mix the mindbender script/suggestions with the tricks about Library problems.

PowerPC(PPC) and MIPSEL
Over mentioned methods could be also applied on these archiectures please test and report about on software forums.

PowerPC and MIPSEL Precompiled cores are aviable:
PPC: http://mldonkey.sourceforge.net/forums/viewtopic.php?t=4834 Mipsel: http://mldonkey.sourceforge.net/forums/viewtopic.php?t=4890

PPC cores are reported to work well on to other PPC based NAS ( Synology DS207, tested by ZeusII ), no positive feedback about Linkstation PPC users at the moment.

FreeLink
You may need to use the Unstable (Debian) branch: apt-get install mldonkey-server
 * 1) Get access to packages from the Debian unstable branch
 * 2) Then install mldonkey by

apt-get
apt-get update                  # update APT-Repository apt-get install mldonkey-server # install MLDonkey

Upgrading installed apt-get version
'''NOTE: This method ONLY tested by fcisler on his LSpro. Please provide feedback!!'''

The version apt-get will install is 2.8.1. I have had problems that after about two weeks or several gigs, it will crash. I have compiled 2.8.3 static (latest at time of writing, 3.15.07), so it should work standalone. For ease of use, and startup scripts - i install is via apt-get, and then upgrade it. After following the procedure above, use this: /etc/init.d/mldonkey-server stop cd /usr/bin/ mv mlnet mlnet.PKG wget http://www.cisler.net/lspro/mldonkey/mlnet.static mv mlnet.static mlnet /etc/init.d/mldonkey-server start
 * 1) make sure mldonky is stopped
 * 1) start mldonkey

A ps-ax | grep mlnet should show at least one process running.

Please report success/failure in the forums. - fcisler

compile latest SVN
If you would like to have the latest SVN-Version (better speed etc.) then you should do the following steps. But be careful: Currently the latest SVN-Version is very unstable on the ARM-System. It'll freeze after a few minutes. There's a patch (svn.debian.org ) which should fix the problem but i didn't have success, it's still unstable.

cd /mnt/disk1/share/source/ apt-get install ssh cvs patch autoconf gcc g++ libc-dev make zlib1g-dev libbz2-dev libgd2-noxpm-dev cvs -d:pserver:anonymous@cvs.sv.gnu.org:/sources/mldonkey co -P mldonkey cd mldonkey ./configure make cp ./mlnet /root/.mldonkey/

Problems (both ways)
There are problems within the ARM9-Version. After some starts the mlnet-Service will shut down automatically with an errormessage. The Problem is caused by a file called mlnet_strings.EN_ANSI_X3.4-1968. I've found a workaround: You have to delete the file before mlnet starts. Mlnet will create the file as soon as it is started. I've created a file called run_mldonkey in the mldonkey-dir (/root/.mldonkey/): # cd /root/.mldonkey/ rm /root/.mldonkey/mlnet_strings.EN_ANSI_X3.4-1968 mlnet > /dev/null 2>&1 &
 * 1) ! /bin/sh

After that i have created a symbolic link within the /etc/rc2.d-Directory to get it automatically started. First tests were successfully, mldonkey seems to run stable

PowerPC
This project aims to offer the latest MLDonkey P2P client and additional utilities precompiled and packaged for the PPC LinkStation. This release is compiled without GUI support. See http://www.nongnu.org/mldonkey/ for more information. You may download the latest version from the downloads area.

ppc-mldonkey-2.5.30.16–1


 *  mldonkey-2.5.30.16
 *  ed2k_hash
 *  make_torrent

A newer version of mldonkey, MLNet 2.8.1, compiled for a KuroBox Pro (PPC) is available at: http://cisler.net/kuro/mlnet/mlnet-2.8.1.tar.gz

If someone could please host this (bandwidth is limited), contact me on the site - fcisler

MIPSel
Older binaries + packages are available here. But there was feedback that they did no work properly because of the missing libmagic. So you would have to install the development tools which should fix this dependancy. mkdir /mnt/hda/temp cd /mnt/hda/temp wget http://www.unet.univie.ac.at/~a0025690/mips-binaries/mldonkey_mips-2.7.6.tar.gz tar -xzvf mldonkey_mips-2.7.6.tar.gz  ./install.sh
 * 1) Precompiled C development environment, running on the LS
 * 2) Then

Compile from Source
You can find the latest sources of mldonkey at the mldonkey project at sourceforge. First install the development tools. wget http://easynews.dl.sourceforge.net/sourceforge/mldonkey/mldonkey-2.8.4.tar.bz2 tar -xjf mldonkey-*.tar.bz2 cd mldonkey-* ./configure --enable-batch --disable-gui make make install
 * 1) Precompiled C development environment, running on the LS
 * 2) Then mldonkey can be compiled by:

mldonkey version 2.8.4 compiled onto the following way (By HomeBunny - April 2007): cd /mnt/misc wget http://dfn.dl.sourceforge.net/sourceforge/mldonkey/mldonkey-2.8.4.tar.bz2 bunzip2 mldonkey-2.8.4.tar.bz2 tar xvf mldonkey-2.8.4.tar cd mldonkey-2.8.4 ./configure --enable-batch --disable-guia make make install WHEN YOU HAVE THIS PROBLEM: NOT ENOUGH FREE SPACE ONTO \root\.mldonkey SOLUTION : Move your installation to \mnt\share mkdir  /mnt/share/.mldonkey cp -Rdp /root/.mldonkey /mnt/share/.mldonkey rm -R  /root/.mldonkey ln - s /mnt/share/.mldonkey /root/.mldonkey DON'T FORGET TO CHANGE THE Startscript: INSTALLEDPATH=/mnt/share/.mldonkey

you will need a startscript (/etc/init.d/mldonkey) for mldonkey. export USER="root" NAME=mldonkey INSTALLEDPATH=/$USER/.mldonkey start { su - $USER -c"/usr/local/bin/mlnet&" } stop { su - $USER -c"kill -15 `cat $INSTALLEDPATH/mlnet.pid`" su - $USER -c"sleep 5" } case "$1" in    start)         echo -n "Starting mldonkey: "         start         ;;     stop) echo -n "Stopping mldonkey " stop ;;    restart)         echo -n "Restarting mldonkey "         stop         start         ;;     force) echo -n "Forcing start of mldonkey " rm $INSTALLEDPATH/config_files_space.tmp rm $INSTALLEDPATH/mlnet.pid start ;;    *)         echo "Usage: /etc/init.d/$NAME {start|stop|restart|force}"         exit 1         ;; esac exit 0 you can download it directly from here here. cd /etc/init.d wget http://www.unet.univie.ac.at/~a0025690/scripts/mldonkey chmod 755 mldonkey
 * 1) ! /bin/sh

= Additional Info = mldonkey should be runnable now by executing /etc/init.d/mldonkey start I had to add .sh   That is what I use: /etc/init.d/mldonkey.sh start if you want mldonkey to be started automatically at startup:

FreeLink
ln -s /etc/init.d/mldonkey /etc/rc2.d/S99mldonkey

OpenLink
ln -s /etc/init.d/mldonkey /etc/rc.d/rc2.d/S99mldonkey

=References=