OmniOS: How to Install TransmissionBT

Compilation and install: steps required and solving issues

This article is part of a series focused on the building and setup of a home-NAS based on ZFS and OmniOS. The index is located here: An OmniOS ZFS Fileserver.

Having a server or a NAS always-on and not offloading the different computers from the longest tasks makes no sense, so I decided to install on my OmniOS box one of the most lightweight torrent clients available, TransmissionBT. Other very light clients exist, for example btpd, but I decided to go for a very common one, one I already used under OS X and under NAS4free. Even if btpd could be easier to compile, the web interface seems to be better on Transmission.

Compilation

This post has been written after finishing the whole procedure, so some steps may be incorrectly reported. It should be fine but in case of problems just drop me an email or write a commentary.

In any case, feel free to use the latest packages instead of the versions I used.

The first step is to install the development packages as described in the official guide.

Transmission uses packages not available on the standard OmniOS repository, I had first to add the inofficial repositories OmniTI provided:

$ pfexec pkg set-publisher -g http://pkg.omniti.com/omniti-ms/ ms.omniti.com

$ pfexec pkg install developer/gcc48
$ pfexec pkg install compress/xz
$ pfexec pkg install omniti/library/libevent
$ pfexec pkg install text/gnu-gettext
$ pfexec pkg install library/perl-5/xml-parser
$ export PATH=/usr/gnu/bin:/opt/gcc-4.8.1/bin:$PATH:/usr/local/bin

$ wget http://ftp.acc.umu.se/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.bz2
$ tar xf intltool-0.40.6.tar.bz2
$ cd intltool-0.40.6
$ ./configure
$ make
$ pfexec make install
$ cd ..

$ wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
$ tar xf pkg-config-0.28.tar.gz
$ cd pkg-config-0.28
$ ./configure --with-internal-glib
$ make
$ pfexec make install
$ cd ..

I need no native graphical interface, only the daemon running in background and the web interface accessible from every computer of the local network, so I disabled everything else:

$ wget http://download.transmissionbt.com/files/transmission-2.77.tar.xz
$ tar xf transmission-2.77.tar.xz
$ cd transmission-2.77
$ ./configure --enable-utp --enable-nls --enable-daemon --disable-cli --with-gtk=NO LIBEVENT_CFLAGS=-I/opt/omni/include LIBEVENT_LIBS="-L/opt/omni/lib -levent"

Transmission was compiling correctly but couldn't run due to a library missing at runtime:

$ ./daemon/transmission-daemon --help
ld.so.1: transmission-daemon: fatal: libevent-2.0.so.5: open failed: No such file or directory
Killed
$ ldd ./daemon/transmission-daemon
        librt.so.1 =>    /lib/librt.so.1
        libevent-2.0.so.5 =>     (file not found)
        libcurl.so.4 =>  /usr/lib/libcurl.so.4
        libssl.so.1.0.0 =>       /lib/libssl.so.1.0.0
        libcrypto.so.1.0.0 =>    /lib/libcrypto.so.1.0.0
        libz.so =>       /usr/lib/libz.so
        libnsl.so.1 =>   /lib/libnsl.so.1
        libsocket.so.1 =>        /lib/libsocket.so.1
        libm.so.2 =>     /lib/libm.so.2
        libpthread.so.1 =>       /lib/libpthread.so.1
        libc.so.1 =>     /lib/libc.so.1
        libidn.so.11 =>  /usr/lib/libidn.so.11
        libldap.so.5 =>  /usr/lib/libldap.so.5
        libgcc_s.so.1 =>         /usr/lib/libgcc_s.so.1
        libmp.so.2 =>    /lib/libmp.so.2
        libmd.so.1 =>    /lib/libmd.so.1
        libsasl.so.1 =>  /usr/lib/libsasl.so.1
        libnspr4.so =>   /usr/lib/mps/libnspr4.so
        libplc4.so =>    /usr/lib/mps/libplc4.so
        libnss3.so =>    /usr/lib/mps/libnss3.so
        libssl3.so =>    /usr/lib/mps/libssl3.so
        libdl.so.1 =>    /lib/libdl.so.1
        libnssutil3.so =>        /usr/lib/mps/libnssutil3.so
        libplds4.so =>   /usr/lib/mps/libplds4.so
        libthread.so.1 =>        /lib/libthread.so.1
$ ls /usr/local/lib/libevent
libevent-2.0.so.5               libevent_core-2.0.so.5          libevent_extra-2.0.so.5         libevent_openssl-2.0.so.5       libevent_pthreads-2.0.so.5
libevent-2.0.so.5.1.8           libevent_core-2.0.so.5.1.8      libevent_extra-2.0.so.5.1.8     libevent_openssl-2.0.so.5.1.8   libevent_pthreads-2.0.so.5.1.8
libevent.so                     libevent_core.so                libevent_extra.so               libevent_openssl.so             libevent_pthreads.so

So the library is there, but it cannot be found. The solution is to use the previously to me unknown tool crle that sets search paths for libraries. I tried:

$ crle

Default configuration file (/var/ld/ld.config) not found
  Platform:     32-bit LSB 80386
  Default Library Path (ELF):   /lib:/usr/lib  (system default)
  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure  (system default)

So I added the required path and everything went fine:

$ pfexec crle -l /lib:/usr/lib:/usr/local/lib
$ crle

Configuration file [version 4]: /var/ld/ld.config  
  Platform:     32-bit LSB 80386
  Default Library Path (ELF):   /lib:/usr/lib:/usr/local/lib
  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure  (system default)

Command line:
  crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/local/lib

However, keep in mind what could go bad and how to solve it.

Installation and permissions

I don't want Transmission to be able to access my personal data, since a bug may cause their deletion or a security hole could lead to someone else see them, so I created a new "transmis" user with a separate home folder ("/var/transmission-daemon") and with no shell ("/bin/false") for the daemon to access his own configuration files and I put him also in the "temps" user group, so that it can only read files marked public or only files located in the Temporary share of the server (see OmniOS: Installation and Basic Setup for details on the user and directory structure I used).

$ pfexec mkdir /var/transmission-daemon
$ pfexec groupadd -g 402 transmis
$ pfexec useradd -g 402 -G temps -u 402 -d /var/transmission-daemon -s /bin/false transmis
$ pfexec chown transmis:root /var/transmission-daemon

To avoid confusion, I created a subfolder in the Temporary directory and I set it as both "watched" folder and as download folder for the daemon, so that torrent files start automatically as soon as they are copied in it. Downloaded files also will be found in the same folder and will keep a ".part" extension during download. The configuration for the daemon has to be edited manually and the following lines should be changed directly in the "settings.json" file, while everything else can be left with default values or set via the web interface:

    "download-dir": "/tank/Temporary/Torrents/",
    "incomplete-dir": "/tank/Temporary/Torrents",
    "incomplete-dir-enabled": false,
    "rename-partial-files": true,
    "rpc-whitelist": "127.0.0.1,10.0.0.*",
    "rpc-whitelist-enabled": true,
    "start-added-torrents": true,
    "trash-original-torrent-files": false,
    "umask": 2,
    "watch-dir": "/tank/Temporary/Torrents/",
    "watch-dir-enabled": true

The "incomplete-dir" was disabled because I want the files directly in the final location and I want incomplete files just to be renamed ("rename-partial-files" active). The "rpc-whitelist" was enabled and set so that computers on the local network are allowed to access the web interface. Since I enabled the "watch-dir" I also want downloads to start automatically: the torrent end up in the watched folder only after manual copy, not by mistake.
An important setting is "umask" because it determines the reading permissions of the downloaded files. I want them to be readable by creator and by the group, so I set "2" that means "rw-rw----". I know that the group will be set correctly thanks to the directory ACL set in OmniOS: Installation and Basic Setup.

The only thing left is the automatic start of the daemon at boot. I wanted to use the native SMF Solaris (and derivatives) method, so I found transmission-daemon.sh and transmission-daemon.xml, written by another user ("Wonk"). Since the original website is gone and I changed some parameters in the files, I will host them.
The installation is simple: put the files in a folder, then change to that one and give:

$ pfexec cp transmission-daemon.sh /lib/svc/method/
$ pfexec cp transmission-daemon.xml /var/svc/manifest/site/
$ pfexec svccfg -v import -V /var/svc/manifest/site/transmission-daemon.xml


Update 2015-08-15

After changing some permissions, I found that Transmission was not able to create files inside the download folder anymore.

The issue was solved by setting the following permissions:

$ ls -lVa /tank/Temporary/Torrents/
drwxrws---+  4 transmis temps          4 Aug 15 20:58 .
                 owner@:rwxpdDaARWcCos:fd-----:allow
                 group@:rwxpdDaARWcCos:fd-----:allow
              everyone@:rwxpdDaARWcCos:fd-----:deny
d-----S---+ 25 root     temps        166 Aug  9 20:40 ..
          user:transmis:--x---a-R-c--s:-------:allow
              everyone@:rwxpdDaARWcCos:fd-----:deny

Author: Olaf Marzocchi

First revision: 2013-04-14.
Last revision: 2015-08-15.