Thursday Jul 17, 2008

BitTorrent on Solaris (Nevada, Solaris 10 Update 5)

After years of trying to squirrel away a few minutes to install my only BitTorrent swarm in our lab, I've finally done it! I thought I'd put the instructions out here on the web since it seems that explicit Solaris-based instructions are relatively sparse (they are sparse because the version I'm using is relatively easy to use and not relegated to a single platform...thus the lack of Solaris-specifics).

I started with a clean build of Solaris 10 Update 5 on one machine, and Build 94 of Nevada on another set of 4 machines. These are the Sun Fire x4150s I've discussed in other posts.

Retrieving all of the packages I needed was straightforward with Blastwave.org (an open source software repository for Solaris). In fact, with just a few commands I had a complete BitTorrent stack installed that runs with Python (don't have Python on the system...Blastwave takes care of that too).

Install BitTorrent
First, read the HOWTO on using Blastwave. I only made it through a few steps of the HOWTO before I was up and running, so don't sweat it if it seems long and you are attention-challenged (like me without a special Nespresso Level 8 or above espresso). Of course, I'm fumbling around more than I should so be sure to read the whole thing when you do have time, it contains information on directories and where stuff gets put (at least I think it does...). Installing what you need to use Blastwave takes only a few minutes. Once you have Blastwave ready and running, retrieve BitTorrent and all its dependencies (primarily Python):

/opt/csw/bin/pkg-get -i bittorrent

That's it, BitTorrent is now installed in /opt/csw/share/BitTorrent

Remember the BitTorrent Components
Here is the 2 minute review of important BitTorrent Network Components and terminology that follows the general deployment diagram here (this is the swarm I've installed in my lab so I'll refer to it throughout):


  • Torrent - A "file" that is prepared to be distributed by BitTorrent, torrent may also refer to the metadata file prepared from the contents of the file you will be distributing
  • Tracker - A "tracker" helps refer downloaders (peers) to each other, sort of an organizer of nodes
  • Swarm - A group of peers that are delivering content to a requester (the downloader itself often becomes a part of the swarm for another requester very early in the download process)
  • Seed - A full copy of a file that clients can obtain. This seems like a heavy load on a single server, but very early on clients will lessen their load on the Seed systems and depend on other peer clients for chunks of the torrent.

In the scenario below, the Tracker and the Seed for my torrent (OpenSolaris 08.05 ISO) are one and the same. The Seed should typically be split from the Tracker though...the Tracker is a bottleneck and you don't want it to be pounded on by Peers.

Start a Tracker
We will start the tracker first. A tracker can be started as a background task. It will sit on a port and listen for requests and write output to a file.

./bttrack.py --port 6969 --dfile dstate --logfile tracker.out

Your tracker is now up and running and ready to organize clients.

Create a Torrent
A "torrent" metadata file contains all of the information about a particular file that can be retrieved through BitTorrent. The torrent is associated with a tracker and when complete will contain a variety of information to ensure the integrity of the final torrent when a client receives it.

The README.txt with the BitTorrent download didn't have proper instructions for building a torrent (seemed a little out of date), so be careful and don't get frustrated. Use the btmaketorrent.py command to build the torrent file. I've chosen to create a torrent from the OpenSolaris 08.05 distribution (my favorite distribution of all, of course...):

./btmaketorrent.py --comment "OpenSolaris 08.05 from Pauls Swarm" http://x4xxx-01.sun.com:6969/announce os200805.iso

Notice the use of the tracker that I set up. You can show the meta information that was generated by using the btshowmetainfo.py command:

# ./btshowmetainfo.py os200805.iso.torrent
btshowmetainfo 4.0.4 - decode BitTorrent metainfo files

metainfo file.: os200805.iso.torrent
info hash.....: fdf239d2524e44432892d01ab354e20a8b77b7e6
file name.....: os200805.iso
file size.....: 719087616 (2743 \* 262144 + 26624)
announce url..: http://x4xxx-01.sun.com:6969/announce

Setting up a Seed
You need a web server available from the system that is going to be a "Seed". Nevada has Apache 2.2 (at least in my build) installed by default, you simply have to turn it on (mileage may vary). You can do this by typing:

# svcadm enable apache22
# svcs | grep -i apache2
online 20:41:36 svc:/network/http:apache22

A better instruction set can be found on BigAdmin.

With a little nosing around the system, I found my httpd.conf file at /etc/apache2/2.2. Look in the file for the DocumentRoot, something like this works:

# cat httpd.conf | grep DocumentRoot
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/var/apache2/2.2/htdocs"

We will place our .torrent file (created earlier) in the DocumentRoot.

Most web servers you also have to associate the mime type "application/x-bittorrent" with the file extension "torrent", this was already done for the pre-installed Apache 2.2 on Nevada.

Finally, put the complete file on a server (the same one would work like I am doing, but a separate server is recommended). Run the BitTorrent download, saving the file into the location that the file already exists. BitTorrent is smart enough to see all of the chunks are there, but it spends time verifying the are correct. When complete, the computer you run the download is a Seed. This command works for the OpenSolaris 08.05 torrent I created earlier:

# ./btdownloadheadless.py --url http://x4xxx-01.sun.com/os200805.iso.torrent --save_as os200805.iso

This takes a while as it runs through hash checks on the existing file.

The torrent is now ready as a Seed for peer to peer access. You can add as many Seeds as you want depending on how popular you think your file is going to be.

Use another Client to Download a File
I can now go to x4xx-02 and start the headless download, just as the previous one ran.

# ./btdownloadheadless.py --url http://x4xxx-01.sun.com/os200805.iso.torrent --save_as os200805.iso

Remember the torrent itself points back to the tracker. There should be some brief activity by the tracker during the download to see if other peers in the swarm can help.

During the download, you will become a part of the swarm from which other clients can download chunks of OpenSolaris (you have to give it, if you want to get it - The Suburbs).

As the file starts to download, you will see the transfer rate start to go up. With a single Seed, I started slowly ramping up. BitTorrent is careful to balance requests. Remember, I now have a Seed and a Peer with chunks of the file. With a single download in progress, I reached about 20 KB/sec (the upload from the Seed and the download from the client)...there is some obvious throttling going on somewhere.

What if I start a download of the torrent on x4xxx-03? The Seed remained uploading around 20 KB/sec. After an initial hit on x4xxx-02 down to about 14 KB/sec, I quickly moved back to over 20 KB/sec, while x4xxx-03 was peaking near 30 KB/sec. As more chunks moved onto x4xxx-03, x4xxx-02 also sped up, since it could grab chunks from two peers. The Seed remained constant at a 20 KB/sec upload, but x4xx-02 was now also uploading at 20 KB/sec and x4xxx-03 was able to have the aggregate bandwidth.

But wait, I have two more clients sitting idle, I started up x4xxx-04 and x4xxx-05 with the download. Again, an initial hit from x4xxx-02 occurred, as it was heavily relying on the original Seed and clients were also relying on it. Within about a minute, the original Seed was still uploading at 20 KB/sec, but -02, -03 and -04 were also uploading at 20 KB/sec. All clients were now downloading at 20 KB/sec with the original seed still uploading at a constant 20 KB/sec...peer to peer amortization of upload bandwidth at its finest.

As the download moved along, more chunks flooded onto the remaining peers and the sharing became much more efficient. Each of the clients regularly found their way over 25 KB/sec and often into the 30 KB/sec range.

I decided that the graphical output wasn't very fun, so I added my home system that I VPN with into the party using Azureus. With Azureus, I'm able to get graphical displays of what's going on. Here is a picture of my swarm:

Note that the center circle is my client, the fully blue circle is the seed, and you can see the other peers don't yet have a lot of chunks of the file.

Here is another interesting view from Azureus:

Of particular note is the Swarm Speed, we have hit about 100 KB/sec with our 5 peers and an obvious upload throttling on each client at around 20 KB/sec. Well, I'll obviously be looking into that...but I think I've run out of words for the evening and I've more than achieved my purpose tonight. Enjoy BitTorrent on Solaris!

Now, I just have to figure out what other kinds of fun I can have with my swarm :-)

Tuesday Jan 02, 2007

Solaris 10 U3 on Gateway MX6453

I bit the bullet this weekend and picked up a Gateway MX6453 Laptop. I also immediately downloaded the Solaris 10 - 11/06 DVD and attempted an installation. It was (and still is) a bit rough going. I thought I would share a few things that are peculiar to the laptop that may help with other Gateways.

One thing to be aware of with this system, you will NOT have network functionality out of the box and as of yet, I do not have wireless working, so plan on being near a wired port for the time being.

Basic system information:
- CPU: AMD Turion 64 - worked without a hitch
- Wired Ethernet: Marvell Yukon 88E8038 PCI-E, get the driver from here, be SURE to grab the 64-bit driver. This SysKonnect supports the Marvell Yukon (note that the Marvell site does NOT have this driver available on it).
- Wireless Ethernet: Gemtek WMIB-184GW (driven by Broadcomm Driver in Windows), NOT WORKING
- Video: Don't know, worked without a hitch
- Audio: Not sure yet, not working either :-)
- Memory: 2GB (one of the reasons I bought it)
- Hard Drive: 160 GB (another reason I bought it)

Hard Drive Partitions
The Gateway comes with two primary partitions, one for system restores and one for the Windows Media Center edition. Do yourself a favor immediately, get Partition Magic before you go any further. Yes, I was able to install Solaris 10 without destroying my Windows partition, but no, I don't think I could have done it without Partition Magic.

Shrink the Windows partition down (you probably only need about 10GB to play, I put 55GB since I want NetBeans, StarOffice 8 and I'll be doing stuff for work on it).

Here are the approximate sizes and relevant information for the partitions in about the order you would see them in partition magic:
- Pre-existing partition: ~8GB, Primary Partition, System Restore already configured from Gateway, leave unchanged
- Pre-existing partition: ~150GB, Primary Partition, Windows XP, shrink to about 85GB, this will remain Windows XP
- New Primary Partition: ~55GB, no type (I think this is "unassigned"), this will be used for our Solaris installation
- New Logical Partition: ~5GB, FAT32, this will be used to transfer files between Solaris and Windows (theoretically)
- New Logical Partition: ~5GB, no type (I think this is "unassigned")

Installation
The installation is very straightforward. The only problem I had was with the initial file system sizes. The defaults were 5GB for / and the remaining for /export/home. This was not good and caused all sorts of problems for me as I tried to install larger programs (like StarOffice 8). I caught it on my second installation. Tweak the file system sizes to be more balanced remembering that if you don't explicitly set /opt and /tmp sizes, these directories will be put in the / file system.

To let you know how serious this is, I could not even grab StarOffice 8, decompress it and add it. The Solaris Companion CD also gave me all sorts of headaches as well. So, if you leave the default directories on the install, at least tweak the sizes so you have the balance in / and not /export/home.

Wired Network
The wired network worked well, but not without a lot of driver searching. For the Marvell chipset, get the driver from the SysKonnect
web site. Now you have some work to do...I think I've captured it here, but it is a bit tricky:
- Uninstall the pre-existing SK98sol package (they conflict and this is old)
- Remove all entries referring to sk98sol from /etc/driver_aliases
- pkgadd the SysKonnect driver (pkgadd -d . SKGEsolx) from the directory you decompressed and untarred the distribution from
- During the pkgadd DO NOT have it configure the interfaces, it won't find it anyway
- Once installed, edit the /etc/driver_aliases file and look towards the bottom, there should be a bunch of lines with skge in them. For the marvell card in this Gateway, add the following line to the end of the file: skge "pciex11ab,4352"
-- NOTE: How I came up with this is kind of weird, I found Ryan Hornbeck's blog that showed the basics of determining the device manufacturer number from Windows, I then used the command 'prtconf -Dv | grep 4352' to determine the rest of the string I needed.

There are many different things you could do from here to get the network up and running. I wanted to use my DHCP and have the same hostname all the time rather than have my router assign it. When the driver gets loaded, the ethernet card device will be skge0, so:
- create a file named /etc/hostname.skge0 with a single line in it: inet (where is the name you want for your host all the time)
- create a file named /etc/dhcp.skge0 (you can use "touch /etc/dhcp.skge0")
- now, you can do the rest of the work with ifconfig and a few other commands...I just rebooted (remember, I came from Windows).

You SHOULD be attached to the network, to see...run "ifconfig -a", you should see skge0 with a valid address assigned by your DHCP server.

COOOL, if I blew some of the instructions above, drop me a note and I'll try to correct them...but that is the basics.

Wireless Network
Forget about it. The Broadcom driver (which appears to drive a Gemtek 802.11b/g Model WMIB-184GW on board card) does not appear to be supported, I couldn't find a Solaris driver anywhere. Further, the laptop community on OpenSolaris and Solaris HCL don't give me much hope for this card natively at the moment.

The ndis community is working to get Windows drivers working with Solaris to help expedite all of the various Wireless chipsets out there but, to be honest, you will have to do a bit of work to get your native chipset working and the ROI isn't worth it to me.

My current plan is to go back to Circuit City and purchase a PCMCIA wireless card that is on the support list, I think this list will provide me with enough information to get started.

StarOffice
Obviously you want StarOffice 8 and not 7. First remove StarOffice 7:
- I forgot the package names, simply do "pkginfo | grep Office", this should return 2 packages. Remote the gnome integration one first, then the main office package.
- You should do this BEFORE you access staroffice for the first time.

Then grab StarOffice 8 from Sun Microsystems, remember to get the x86 packages and follow the readme to install it.

Audio
Not working yet, not a priority for me either, this is why Jobs made iPods.

Grub Menu
When you boot, you will see the following entries on the Grub menu:
- Solaris 10
- Solaris 10 Safe Mode (or something)
- Windows
- Windows

Be VEWY VEWY careful, the first Windows option is the one you want. The second one takes you to a system restore...if you go there, just shut it off ASAP. You can rename these when you are in Solaris, edit the file: /boot/grub/menu.lst

Companion CD
My first attempt at this failed miserably because of lack of disk space (recall I didn't set the file directory sizes properly). At the bottom of the README on the DVD there are instructions for installing all of the packages. If you don't want to be finicky and you want to explore at your leasure, go for it. Noticeable things on the companion DVD include all sorts of GNU utilities, PHP, Ruby and more.

Things left to do
- Audio isn't working
- Try out my share between DOS and Solaris partition
- Try out ZFS :-)

Total Time Spent: More than you want to know ;-) (probably about 16-20 hours thus far, which is the reason I thought I'd post as much of this as I could...there are plenty of other how-to's out there but heck, if you have a Gateway you may as well have some more info).

Finally, thanks to my friend for helping me through some of the sticky networking stuff. Hopefully she can catch any bugs in the above info :-)

About

pmonday

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today