Tuesday, January 3, 2012

Utorrent on Centos 5 (GLIBC_2.11 not found Problem)

Note: This is a quick quide for those who are facing GLIBC or other library issues with utorrent. If you are not facing these problems or haven't tried yet, You should follow the complete descriptive guide HERE
If you are using a relatively old distribution (with glibc <= 2.10) like centos 5 for Utorrent (utserver), you must be getting a GLIBC_2.11 not found error:
./utserver: /lib32/libc.so.6: version `GLIBC_2.11' not found (required by ./utserver)
or /lib instead of /lib32 on some distros:
./utserver: /lib/libc.so.6: version `GLIBC_2.11' not found (required by ./utserver)
Although it is recommended to use a newer distribution that has glibc >= 2.11, if you some how cannot afford to do that, here is a hack that should work.

The trick is that, if you can provide utserver binary with the required libraries in a custom directory, it should work no matter what libraries your current distribution is using. You don't need to tamper your existing installation and libraries, just download the required libraries in a custom directory and run utserver with those libraries.

Here are the steps:

1- Get all the libraries

I am using centos 6.2 (32 bit) rpms to get the libraries, these are highly and easily available. Feel free to gather these libraries from any convenient location you like.
Make sure you have the required tools:
yum install cpio xz
Download the rpms in a temp location:
mkdir /tmp/centos6rpms
cd /tmp/centos6rpms/
wget http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages/glibc-2.12-1.47.el6.i686.rpm
wget http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages/libgcc-4.4.6-3.el6.i686.rpm
wget http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages/openssl-1.0.0-20.el6.i686.rpm
wget http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages/krb5-libs-1.9-22.el6.i686.rpm
wget http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages/libcom_err-1.41.12-11.el6.i686.rpm
wget http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages/zlib-1.2.3-27.el6.i686.rpm
wget http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages/keyutils-libs-1.4-3.el6.i686.rpm
wget http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages/libselinux-2.0.94-5.2.el6.i686.rpm
2- Extract and place the libraries

I am using cpio to extract files from the rpm. Be carefull, do not attempt to install these rpms, unless you know what you are doing. Installing these rpms will replace/change the current libraries of the running system and can crash your system.
cd /tmp/centos6rpms/
rpm2cpio glibc-2.12-1.47.el6.i686.rpm | xz -d | cpio -idmv
rpm2cpio keyutils-libs-1.4-3.el6.i686.rpm | xz -d | cpio -idmv
rpm2cpio krb5-libs-1.9-22.el6.i686.rpm | xz -d | cpio -idmv
rpm2cpio libcom_err-1.41.12-11.el6.i686.rpm | xz -d | cpio -idmv
rpm2cpio libgcc-4.4.6-3.el6.i686.rpm | xz -d | cpio -idmv
rpm2cpio libselinux-2.0.94-5.2.el6.i686.rpm | xz -d | cpio -idmv
rpm2cpio openssl-1.0.0-20.el6.i686.rpm | xz -d | cpio -idmv
rpm2cpio zlib-1.2.3-27.el6.i686.rpm | xz -d | cpio -idmv
Collect all the libraries to a custom location, i am placing the libraries in /opt/utorrent/lib:
mkdir -p /opt/utorrent/lib
cp -av /tmp/centos6rpms/lib/* /opt/utorrent/lib/
cp -av /tmp/centos6rpms/usr/lib/* /opt/utorrent/lib/
ln -s /opt/utorrent/lib/libssl.so.1.0.0 /opt/utorrent/lib/libssl.so.0.9.8
ln -s /opt/utorrent/lib/libcrypto.so.1.0.0 /opt/utorrent/lib/libcrypto.so.0.9.8
You can now remove the temp directory where we downloaded all the rpms initially:
rm -rf /tmp/centos6rpms
3- Setup Utorrent

Create directories for utorrent:
mkdir -p /opt/utorrent
mkdir -p /opt/utorrent/conf
mkdir -p /opt/utorrent/pid
mkdir -p /opt/utorrent/webui
mkdir -p /opt/utorrent/data
mkdir -p /opt/utorrent/log
Get and Extract Utorrent:

wget -O /tmp/utorrent-server-3.0-25053.tar.gz http://download.utorrent.com/linux/utorrent-server-3.0-25053.tar.gz
tar --directory /tmp -xzf /tmp/utorrent-server-3.0-25053.tar.gz
cp /tmp/utorrent-server-v3_0/utserver /opt/utorrent/
cp /tmp/utorrent-server-v3_0/webui.zip /opt/utorrent/webui/
4- Create the configuration

Its up to you, you can create your own configuration file, not use a configuration file or use this default configuration file I've created from the documentation (only root_dir is set to /opt/utorrent/data, all other options are default):


wget -O /opt/utorrent/conf/utserver.conf http://kxr.me/blog/uts/utserver.conf
At this point your utserver should run, you can test it by running:
/opt/utorrent/lib/ld-linux.so.2 --library-path /opt/utorrent/lib /opt/utorrent/utserver -settingspath "/opt/utorrent/webui/" -configfile "/opt/utorrent/conf/utserver.conf" -logfile "/opt/utorrent/log/ut.log" -pidfile "/opt/utorrent/pid/utserver.pid"
you should see  "server started" message (ignore no version information warning)

5- Create Start/Stop Script
Its up to you, you can create your own init.d/systemd/upstart scripts. I've created this simple bash script to start, stop, reload and check status.
wget -O /opt/utorrent/utsctl http://kxr.me/blog/uts/utsctl.clib
chmod +x /opt/utorrent/utsctl
ln -s /opt/utorrent/utsctl /usr/bin/utsctl

6- Start/Stop Utorrent
If you were lucky, starting the utorrent should be as simple:
utsctl start
You can use this script to start, stop, check status and reload (reload option builds the configuration from the utserver.conf file and restart the utserver).
utsctl stop

utsctl status
utsctl reload

23 comments:

  1. http://configs.ucoz.com - site was in suspend.
    Can you reactivate this site or re-upload your cfg-files-examples to dropbox?

    ReplyDelete
    Replies
    1. Sorry about that. I have moved the configs and scripts to a better/permanent location and updated the blog accordingly. Should work now.

      Delete
  2. Some security and usability improvements such as here http://blog.kxr.me/2011/12/utorrent-server-on-linux-step-by-step.html:

    useradd utorrent -d /opt/utorrent -s /bin/bash

    Change permision:
    chown utorrent:utorrent /opt/utorrent

    And add in init script:
    ===============
    #!/bin/sh

    shell_user="utorrent"
    custome_lib_path="/opt/utorrent/lib"
    uts_bin="/opt/utorrent/utserver"
    pid_file="/opt/utorrent/pid/utserver.pid"
    settings_path="/opt/utorrent/sets"
    config_file="/opt/utorrent/conf/utserver.conf"
    log_file="/opt/utorrent/log/ut.log"

    start(){

    if [ -s "$pid_file" ]
    then
    kill -s 0 `cat $pid_file` > /dev/null 2>&1
    if [ "$?" == "0" ]
    then
    echo "Err: Utorrent seems to be running, PID `cat $pid_file`"
    else
    echo "Starting Utorrent Server.."
    su -c "cd /opt/utorrent/sets/;$custome_lib_path/ld-linux.so.2 --library-path $custome_lib_path $uts_bin -settingspath $settings_path -configfile $config_file -logfile $log_file -pidfile $pid_file -daemon" $shell_user
    fi
    else
    echo "Starting Utorrent Server.."
    su -c "cd /opt/utorrent/sets/;$custome_lib_path/ld-linux.so.2 --library-path $custome_lib_path $uts_bin -settingspath $settings_path -configfile $config_file -logfile $log_file -pidfile $pid_file -daemon" $shell_user
    fi
    }
    ==================
    ..... (the same of original script)

    So now we have separate security user "utorrent"
    and all utorrent settings in folder /opt/utorrent/sets/
    and folder /opt/utorrent/webui/ have not any trash in it

    ReplyDelete
    Replies
    1. Thanks Alexander for your suggestions. I'll add them to the tutorial after some testing.

      Delete
    2. Some small fixes - this command need
      chown -R utorrent:utorrent /opt/utorrent

      We need chown to ALL folders and files

      Delete
    3. Ok now i did some tests, which also reminded me why i kept settings in the webui/ folder. I think utserver binary expects the the webui.zip in the directory provided by the -settingspath argument, and it will keep the settings trash in that directory too. I can't seem to find any way to separate the webui.zip from the settings! I followed your instructions and just like i suspected, it gave me webui missing error: "The µTorrent WebUI does not seem to be installed. Click here to try to install it, or see the guide for more details.".

      Am I missing some thing?

      Delete
  3. http://blog.kxr.me/2012/01/utorrent-on-centos-5-glibc211-not-found.html?showComment=1341583179309#c2277573308402190397
    Is this my comment visible for all?
    Or it is disabled as spam?

    ReplyDelete
    Replies
    1. Can't see the comment you are talking about

      Delete
    2. I think I got the comment in my email box, but some how the comment is not shown here!

      Delete
    3. Oh, I was missing the ut_webui_dir directive. Thanks I tested it and its working fine. I think I should modify the original tutorial to setup utorrent using a restricted user like you suggested. Anyways, thanks a lot for your input

      Delete
    4. Good what problem was resolved.
      But why google hide my long comment :(

      Delete
  4. server started - using locale
    =====
    Any ideas for start torrent server in locale ru_RU.UTF-8?

    ReplyDelete
  5. Cheers mate,

    Brilliantly done!!! You gave me back 2 days of my life. Kudos. Be well and prosper.

    Alex

    ReplyDelete
  6. Thank you VERY MUCH for this step by step tutorial.
    I had tweak a few things like libraries URL. But everything is working fine !

    ReplyDelete
  7. ./utserver: /usr/lib/libcrypto.so.0.9.8: no version information available (required by ./utserver)
    ./utserver: /usr/lib/libssl.so.0.9.8: no version information available (required by ./utserver)


    i used by centos 6.3 64bits

    and i downloaded rpm packages by url

    http://mirror.crazynetwork.it/centos/6.3/os/i386/Packages/


    but don't work! help me please.

    ReplyDelete
    Replies
    1. Please give more details of your problem.

      Delete
  8. i have the same problem

    ReplyDelete
  9. I HAVE THE SAME PROBLEM!
    My sever is running:
    [root@OpenErpCentOS utorrent]# utsctl status
    Utorrent seems to be running, PID 5302

    But I could not get access to the localhost
    [root@OpenErpCentOS utorrent]# http://localhost:8080/gui
    -bash: http://localhost:8080/gui: No such file or directory

    ReplyDelete
  10. http://mirror.crazynetwork.it/centos/6.2/os/i386/Packages

    on step 1 link dead! please get or update new link

    ReplyDelete
  11. sir i m useing centos 6.4 32 bit. u plz tell me how to install utorrent otherwise how to downlad movies

    ReplyDelete
  12. Here is a replacement for the mirrors
    wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.0/i386/updates/security/glibc-2.12-1.47.el6.i686.rpm
    wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.2/i386/os/Packages/libgcc-4.4.6-3.el6.i686.rpm
    wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.2/i386/os/Packages/openssl-1.0.0-20.el6.i686.rpm
    wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.2/i386/os/Packages/krb5-libs-1.9-22.el6.i686.rpm
    wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.2/i386/os/Packages/libcom_err-1.41.12-11.el6.i686.rpm
    wget ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.3/x86_64/os/Packages/zlib-devel-1.2.3-27.el6.i686.rpm
    wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.2/i386/os/Packages/keyutils-libs-1.4-3.el6.i686.rpm
    wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.2/i386/os/Packages/libselinux-2.0.94-5.2.el6.i686.rpm

    ReplyDelete
  13. I Must say, that Torrent is one of the most famous and used places on the web. The way they provide Free Data, and the popularity and Respect they have earned in these years, is really unbelievable. Officially they are illegal. but they are kind of Robin Hood type. Who takes paid things from the providers and make them available to the public for Free.
    Virtual Edge

    ReplyDelete