Category Archives: OpenSolaris

Articles on OpenSolaris.

Installing rTorrent on Illumian

Illumian is the successor to the open source Nexenta Core Platform. It’s an operating system that combines the power of OpenSolaris with the ease of Debian/Ubuntu’s Avanced Packaging Tool (apt).

I used to use NCP, but hadn’t messed with it in a long time. I’m trying out Illumian, and one of the things I need is a torrent client. The excellent rTorrent client is perfect for a bare-bones server. It took several hours to figure out how to get rTorrent built and running on Illumian. Now, I present the instructions to the web at large in hopes that others can make use of them.

Guide Steps
This guide is divided into the following steps.

  1. Install Dependencies
  2. Download Files/Patches
  3. Install libsigc++
  4. Install CPPUnit
  5. Prepare Environment
  6. Install libTorrent
  7. Install rTorrent

Note on formatting: Due to the blog’s style, some of the lines in the preformatted text blocks are chopped off. In order to get these lines, you can just triple click to highlight the entire line. Then just copy + paste it.

Install Dependencies

We need a number of programs and dependencies from the Illumian apt repositories. Note the \ at the end of each line, indicating that this is a single line to be pasted into bash.

sudo apt-get install system-header developer-build-autoconf text-gnu-patch \
developer-build-make developer-build-gnu-make \
developer-build-automake-110 developer-build-libtool \
developer-build-autoconf text-gnu-patch \
developer-gcc-44 system-library-math-header-math

Note: We must use GCC 4.4, as 4.5 and 4.6 seem to be missing bootstrap libraries (ctr1.o, etc).

Several dependencies will be coming from OpenCSW’s pkgutil because the Illumian repositories are either missing these dependencies, or they don’t work correctly. We need to install pkgutil and download some more dependencies.

# pkgadd -d
# pkgutil -y -i pkgconfig openssl xmlrpc_c libcurl_dev libncurses_dev

The path must be set properly as well:

export PATH=/opt/csw/bin/:/usr/gcc/4.4/bin/:/usr/gnu/bin/:$PATH

Download Files/Patches

Now, to download all of the files. We have to download some final dependencies, as well as libTorrent and rTorrent themselves.

Note: This article is written with specific versions of rTorrent, libTorrent, and their dependencies in mind. To get more up-to-date versions of the above files, visit the following sites:

Solaris Patches
We will also need the Solaris-specific patches for these dependencies. They are available as a download. They can also be downloaded individually (see Sources at the bottom). The patches will need to be extracted.

tar xvf rtorrent-solaris-patches.tar

Install libsigc++

First, libsigc++ must be installed. This is a dependency required by rTorrent. OpenCSW has the current version of this library, but rTorrent does not seem to like it.

tar xjvf libsigc++-2.2.10
cd libsigc++-2.2.10/
./configure --prefix=/opt/csw
sudo make install

Install CPPUnit

CPPUnit is a unit testing framework that is apparently required to build libTorrent (and probably rTorrent). To install it, follow these steps.

tar zxvf cppunit-1.12.1
cd cppunit-1.12.1/
cp ../rtorrent-solaris-patches/cppunit.patch .
patch -p1 < cppunit.patch
./configure --prefix=/opt/csw
sudo make install

Set Up Environment

We must prepare the shell environment for building libTorrent and rTorrent. This will force the build process to use the OpenCSW and locally-installed dependencies, as well as the GNU linker, which are all required for building.

export ACLOCAL_FLAGS="-I /usr/local/share/aclocal"
export PKG_CONFIG_PATH=/opt/csw/lib/pkgconfig/:/usr/local/lib/pkgconfig/:/usr/lib/pkgconfig/
export LD_LIBRARY_PATH=/opt/csw/lib:/usr/local/lib/:/usr/lib/
export LD_ALTEXEC=/opt/csw/bin/gld

Install libTorrent

Next, we build and install libTorrent.

export CFLAGS="-std=c99"
tar zxvf libtorrent-0.12.9.tar.gz
cd libtorrent-0.12.9/
cp ../rtorrent-solaris-patches/libtorrent.patch .
patch -p1 < libtorrent.patch
./configure --prefix=/opt/csw
sudo make install

Install rTorrent

Finally, we can install rTorrent.

tar zxvf rtorrent-0.8.9.tar.gz
cd rtorrent-0.8.9/
export CPPFLAGS="-march=i686 -I /opt/csw/include -I /opt/csw/include/ncurses -I /usr/local/include"
export LDFLAGS="-lncurses"
cp ../rtorrent-solaris-patches/rtorrent.patch .
patch -p1 < rtorrent.patch
./configure --prefix=/opt/csw --with-xmlrpc-c=/opt/csw/bin/xmlrpc-c-config
sudo make install


After building and installing rTorrent, it will be located at /usr/local/bin/rtorrent. A sample config file (rtorrent.rc) will be located in the doc/ of the downloaded soure code. Consult the user guide and the Arch Wiki for information on creating a good .rtorrent.rc file.


This guide was compiled from a lot of my own trial and error, as well as help from these sources. The patches as well as a bit of extra helpful information came from these places.

Fixing Nexenta Zones: Update

According to Comment #10 on Nexenta bug 203, some of the more glaring problems with Zones in Nexenta have been fixed in version 3.0.1. The most tedious fixes have been put in place. The only thing necessary to do now is simply dpkg-reconfigure sunwcsd once the zone is installed. I also did a reimport of sysevent.xml. It seems to be necessary (at least on my dist-upgraded system). In order to do the reconfiguring, you will need to be in maintenance mode. The zone should already have dropped into maintenance mode to begin with, so just zlogin and do the reconfigure. After that you will need to reboot the zone. Everything should then be working correctly. To get Nexenta 3.0.1, either dist-upgrade your existing system, or download the ISO from here.

Fixing Nexenta Zones

Update: Some of the bugs in this post have been fixed, rendering a lot of the steps unnecessary. If you are running the latest version of Nexenta (3.0.1), you should only need to perform the last steps, where you dpkg-reconfigure sunwcsd and reimport the sysevent.xml file. See the new post for more details.

There is a nasty bug in Nexenta 3.0 that causes zones to function improperly. Services such as SSH are broken, packages may not install properly, etc. This is caused by a missing sysidtool, and a missing sysevent service. Two fix this problem, a few steps are required. First, in the global zone, you must edit /usr/bin/createzone and make the following changes:

1. Replace elatte-unstable with hardy-unstable. This should be found around line 41, in the default_config() subroutine.
2. Update the @source_files array as follows:

my @source_files = qw(

You are simply changing “elatte” to “nexenta” here.

Now, go through the normal zone creation process. If you don’t know how to do that, see here for a decent tutorial. The zone creation process should go off without a hitch, and sysidtool should install properly. Without our fixes, you would probably see an error that looks something like this.

There are still two more steps to be done. We must log in to the zone, but regular zlogin will not work until we fix another small bug. Boot the zone with “zoneadm -z yourZone boot”, then log in with “zlogin -S yourZone” instead of the normal zlogin. This will bring us to maintenance mode. Run pwconv:

zoneadm -z yourZone boot
zlogin -S yourZone

[In yourZone]

After this, regular zlogin should work. Now, we need to get the sysevent service working. Many services depend on this service. Without it, all of them will fail to start. To fix this, edit (from within the zone) the /lib/svc/method/svc-syseventd.

After the line . /lib/svc/share/ put
add [ `zonename` = global ] || sleep 3600 & exit 0

When finished, your zone’s /lib/svc/method/svc-syseventd file should look something like this. The bolded line is the one you added.

# CDDL Header
# ...

. /lib/svc/share/
[ `zonename` = global ] || sleep 3600 & exit 0

case "$1" in
	/usr/lib/sysevent/syseventd >/dev/msglog 2>&1
	if [ $rc -ne 0 ]; then
		echo "WARNING: /usr/lib/sysevent/syseventd failed: exit status $rc"

# devfsadmd and syseventconfd are started on-demand
# by syseventd. syseventd should be stopped before devfsadm and syseventconfd.
	/usr/bin/pkill -x -u 0 -P 1 -z $zone rcm_daemon
	/usr/bin/pkill -x -u 0 -P 1 -z $zone syseventd
	/usr/bin/pkill -x -u 0 -P 1 -z $zone devfsadm
	/usr/bin/pkill -x -u 0 -P 1 -z $zone syseventconfd

	# Since pkill is not atomic (may miss forking processes), also
	# kill entire service contract.
	smf_kill_contract $2 TERM 1
	[ $? -ne 0 ] && exit 1

	echo "Usage: $0 { start | stop }"
	exit 1

exit 0

Finally, you will need to enter two more commands as the super-user:

dpkg-reconfigure sunwcsd
svccfg import /var/svc/manifest/system/sysevent.xml

Exit the zone and reboot it. Log in again, and everything should be magically working!

This information was compiled from several Nexenta bug reports (203, 173, LP #347937) after I ran into problems getting SSH working in my new zone. Apparently, the problems are bigger than SSH. I can’t take credit for discovering these fixes.

Software Management on OpenSolaris

One of the main issues I’ve always had with Solaris is finding packages to install. Back when I used Solaris XDE 9/07, this was much worse than it is today. In OpenSolaris, there is a new technology known as the Image Packaging System (IPS). This finally brings centralized software management capability to Solaris. It’s something many Linux distributions already do, and is basically an expected feature these days.

The default OpenSolaris package repository has a fairly large number of packages, but it seems to be lacking in some areas. The amount of packages in the default repository are growing, but it’s missing things such as MPlayer and other programs. Luckily, there are other IPS repositories that help alleviate this! The following commands can be executed in a terminal to add new repositories to the package manager:

pkg set-authority -O Blastwave
pkg set-authority -O Companion

Now, whenever you use the

pkg search -r

command, you should be able to search from these repositories and install from them.

Path Variables:

Packages from Blastwave will install to the directory /opt/csw and entirely isolate themselves from the rest of the system. It has its own bin directory, etc directory, etc. Make sure you add /opt/csw/bin to your PATH to get these programs to work properly:

export PATH=/opt/csw/bin:$PATH

You may want to put that in your .bash_profile or .bashrc file in your home directory so it gets loaded all the time.

Other Places for Packages:

Despite the addition of two more repositories, there will be times when the package image we want just doesn’t exist (Wine? Hello, where are you?). Luckily for us, OpenSolaris has pkgadd and friends for “backwards compatibility.” The pkgadd, pkgrm, and other related commands are used to install programs from .pkg files. It used to be the way Solaris handled software installation. There are some other websites that contain various software packages for installation:

A small, but very nice collection of programs, including an up-to-date version of Wine for Solaris 10 and OpenSolaris (make sure to download the proper version!)

Finding Your Hard Drives in OpenSolaris

If you’re coming from a Linux or Windows system, the first thing you will notice about Solaris systems is that the disk device labeling scheme is rather omgwtf?! when you first see it. Every disk is labeled something like c0t1d0p2. AND, not to mention, there are two places where these huge lists of strange disk IDs appear: /dev/dsk and /dev/rdsk. This can be confusing to someone who doesn’t know their way around a Solaris system.

Fresh and Raw
The first thing to get straight is the difference between disk (/dev/dsk) and raw disk (/dev/rdsk). Devices in the /dev/dsk directory are things that you can mount, unmount, format, and otherwise manipulate with commands. Of course, not all of these devices are used at any given time, which is where a certain program comes in, described below.

The /dev/rdsk directory contains the “raw disks,” the operating system’s abstraction of the raw data. This is used with certain programs that need to access the raw data directly, as we will see below.

Controller What?
The next item on the agenda is to figure out the somewhat funky naming scheme of disk devices in Solaris. On Linux systems, it’s relatively simple. It’s usually something like hda1 or sdb2. The “a” or “b” in the name refers to a physical hard drive, with each number referring to a partition on that hard drive. The “s” and the “h” just seem to be used interchangeably. Maybe it was changed in a kernel upgrade or something.

Solaris uses a significantly different naming scheme. As stated before, the names are things like c0t1d0p2. This website offers a good technical/historical explanation of what the names mean in full. I suggest reading it. Although if you’re using OpenSolaris, you should ignore the part about the “s.” Assuming you only have one hard drive, the main thing of importance to you is the partition number: the number following the “p” in the name. Here’s a summary of what that website says about the names, organized by letter:

C: This refers to the disk’s controller, the internal thing that’s controlling read and write access to the disk. Some disks will appear on different ones depending on what they are. For example, my two internal HDDs appear on c3, while my external USB HDD appears on c1.

T: This is the target. It’s related to the controller. On my system, my two internal hard drives are different targets on the c1 controller: c3t0 and c3t1.

D: This refers to the actual disk. Disk number. Since my targets each refer to an individual hard disk, I have c3t0d0 and c3t1d0.

P: This is the partition number and is what you should be most interested in if you’re running a multi-boot system on a single partitioned hard disk. p0 refers to the entire disk. This is a very important concept. p1 – p4 refers to the primary partitions, with p5 and higher referring to logical partitions.

How I Find Mah Disks?
This is where we introduce the wonderful program of prtpart. It was developed by the BeleniX distribution of OpenSolaris as a partition table viewer. To install this you will need to download the following files:


The first file contains the package file for prtpart while the other contains a package for support for a bunch of miscellaneous file systems that extend the capabilities of prtpart. Install them cding to the directory that you downloaded them to and then put in:

gunzip -c FSWpart.tar.gz | tar xvf -
pkgadd -d . FSWpart
gunzip -c FSWfsmisc.tar.gz | tar xvf -
pkgadd -d . FSWfsmisc

Now you should be ready to use the prtpart program. It must be run with root permissions, so use it with pfexec or start a root shell and execute it. Just executing prtpart without any arguments will produce output like:

Available disk devices:


Use /usr/bin/prtpart  to get partition details
Use /usr/bin/prtpart -help for usage help

This lists all the disk devices the OS currently knows about. Notice that it lists the rdsk devices. If you then execute “prtpart -ldevs”, it will give you the /dev/dsk devices corresponding to that raw disk. Example:

$ pfexec prtpart /dev/rdsk/c3t0d0p0 -ldevs

Fdisk information for device /dev/rdsk/c3t0d0p0

** NOTE **
/dev/dsk/c3t0d0p0      - Physical device referring to entire physical disk
/dev/dsk/c3t0d0p1 - p4 - Physical devices referring to the 4 primary partitions
/dev/dsk/c3t0d0p5 ...  - Virtual devices referring to logical partitions

Virtual device names can be used to access EXT2 and NTFS on logical partitions

/dev/dsk/c3t0d0p1	IFS: NTFS
/dev/dsk/c3t0d0p2	Linux native
/dev/dsk/c3t0d0p3	Linux native

If you’re just trying to find your hard drives, this is one way you can use to find them.