Wednesday, October 2, 2013

Making my Pentium-S 75MHz a bit torrent client

So the Pentium-S at 75MHz is probably technical worse off than the phone I own. But it was the first PC I owned! I'm sentimentally attached to it. And I want to use it.

Hell, so I decided, why not make it the bit torrent client. Get Linux with Transmission and SSH installed and use it for only that. No data, so should it not work, I don't care. Just reformat and start again!

But here was the plan. Install puppy linux & transmission and I should be off!

But things are never that easy.

So, first problem I faced, that when I tried to install the Wary Puppy (5.3). It wouldn't boot from the CD to which the ISO was written! I vaguely remember that this was an issue with the kernel used for this distribution and that the system did not support this.

So what I had to do was to install a really old version of Red hat linux, in fact this was before they forked it to Fedora core and RHEL! At that time (2001) I used to subscribe to PCQuest and in March every year the magzine would provide a distribution called PCQLinux which was based on Redhat's Linux. I found that redhat linux 7.1 was the one that would boot and so I installed it!

Once the install completed and I was able to login I wanted to begin work on installing Wary puppy. But things went up in smoke! Literally. I was rebooting the system when a puff of smoke came out the back and the system refused to start working.

I suspected the power supply had conked off. So, I bravely went and unplugged everything and took the power supply off intending to take it the next day and get it replaced in the store. But I decided to run one last check before I did that. At that time I noticed that I seemed to be getting a live line on both the input sockets. Turns out the cable I was using had shorted and on closer investigation I found the place where it had shorted. It was blackened and I concluded that's where the puff of smoke came from. So my next step was to get a replacement cable, replug everything back in and test. Which I did and found it all working! DUH! When things go wrong check the cable FIRST!!

Anyway, with that sorted out and a week later when I found the time, I had the option of manually installing puppy following the instructions at these websites

  1. http://www.puppylinux.com/install.htm
  2. http://www.puppylinux.com/hard-puppy.htm
But then I was lazy so thought of finding a different way to do it. I'll leave manual installation as a last option.

So what i did was to pull the HDD from the Pentium S and put it into another system. Boot of the WaryPuppy USB, run universal installer & the grub installer to ensure booting from the HDD and then switch the HDD back to the Pentium-S.

Only trouble was it didn't boot. There was a wierd error (something like "urr! wee..."). I put that down to an incompatible kernel. So the next step was to write out the oldest puppy I could find, viz., 'puppy-216-seamonkey' to CD. This too didn't work and I realized it too used the 2.6 kernel.

I was eventually stumped and virtually gave up. However, one Sunday, I thought let's give it the old college try once more.

I did do that and found a link http://www.murga-linux.com/puppy/viewtopic.php?t=9965 that explained how to manually install and configure puppy using Lilo.

Here's a summary of what I finally did:
  1. Created a directory /boot/wary5.5
  2. Copied the vmlinuz and initrd.gz to this folder
  3. Copied puppy*.sfs to /boot
  4. Modified /etc/lilo.conf and added the following
    1. # Puppy Linux
    2. image = /boot/wary5.5/vmlinuz 
    3. root = /dev/ram0
    4. label = Puppy
    5. initrd = /boot/wary5.5/initrd.gz
    6. append = "pfix=ram"
    7. read-only
  5. Once I saved this file, I then ran lilo.
  6. Rebooted and puppy started working! Or so it seemed
  7. Next step was to free up some disk space and remove the PCQuest Linux 7.1 based on Redhat Linux 7.1
  8. For the record here's the partitions I set up on the 4GB disk
    1. 256 MB /boot
    2. 128 MB swap
    3. Rest all in a single root partition
Well the sad part was that puppy booted but I believe Wary Puppy couldn't load the drivers to read the hard disks.

After a while puppy would just drop to the "init" . At this point I kind of gave up and turned to the puppy linux community for help by posting this query on the forum.

After a couple more frustrating weekends trying out various suggestions, I was ready to give up.

Then one day, my PC refused to boot. A couple of times I tried and the same result, it hung after a while during the boot process. I was really disappointed and discouraged!

But come weekend, I prayed (really) and tried again, and the PC didn't boot but it gave a memory error! So, I opened up the unit, took off the four sticks of RAM, wiped them clean and reinserted them back into their respective slots. And this time the PC started up!

Next, I booted in PCQLinux 7.1, and copied across the files for puppy linux 2.0.2 opera version, modified the /etc/lilo.conf to boot using these files and rebooted the PC.

To my absolute delight, PUPPY booted up! I was thrilled. As another experiment I rebooted into PCQLinux7.1 and copied across the files for Puppy 4.1.2 and rebooted. That worked too! Now that I was on a roll, I gave Wary 5.5 another try, but this failed at the same point and refused to boot.

So now that the system was up, I started exploring it all and found that puppy202 was more responsive that puppy412. So I decided to stick with 202. Besides 202 came with transmission out of the box while 412 didn't.

Having done that, the next thing was to start a torrent. Unfortunately, the version of transmission on puppy202 didn't recognize magnet URL schemes. The next hurdle was to find a way to convert magnet URLs to .torrent files. Here I turned to Google and found the following link which allowed just that. So I converted a test URL to a torrent and tried to do the download. The sample I used was converted to the following torrent file.
I don't remember the result nor the attempts to get this to work.

However in all my searches I couldn't find software compatible with puppy202 so I decided to continue with puppy4.1.2 and I found all the software I wanted off the shelf (kind of).


I also found this site which provided me options to download pet files for transmission. I had earlier tried to installing transmission downloaded from Barry's page here. This worked but was a version of transmission that didn't work with magnet URLs. The former site's 4th download had everything statically linked or so I thought. There was a dependency missing, viz., libfio-2.0.so which I found here. But I continued to still get errors as described here but I realized I could still run transmission in the CLI mode using the following commands
  1. transmission-cli or transmission-daemon
  2. transmission-remote
  3. Using the web browser once transmission is started by going to http://localhost:9091/transmission
But my final hurdle still needed to be crossed, viz., setting up an SSH server to access the system remotely. I left this for last thinking it would be easy since I'd seen a few entries about setting up an sshd server on puppy. And it was relatively simple when I found this link. Thanks to Sven, install and everything was running. Needless to say, I changed the default passwords for both root & spot and I was able to ssh into my puppy server.

With that I was almost at the end of my journey. Unfortunately, the journey never ends. I found that X forwarding on the ssh server wouldn't work and there was no way to login to the 'console' of puppy. I also wanted to get LILO setup on puppy so I could get rid of the PCQuest installation. Alternatively I need to get grub installed. So my setup continues...

For VNC and viewing the console I used X11VNC which I found here. (Plain  old vnc is available from here but does not work on the display 0, i.e., the main console). Installing server and client was simple enough. Started x11vncServer from the menu, and chose to start it every time the system boots up. Then few more screens (enter vncserver password, etc.) and it was all started.
From another system (my laptop) I tried to connect vncviewer to the :5900 but that failed. That's because I only allow ssh through my firewall. So, I now connected to the puppy PC using ssh and local forwarding (-L5900:localhost:5900) to enable connecting to the system's console (screen 0 in VNC). That freed me up quite a bit and I could administer the system remotely.

Finally I also forwarded the transmission web port (-L9091:localhost:9091) to enable access the transmission web interface remotely. I also created a symlink to /root/.config/tranmission-cli as /root/.config/transmission-daemon which allowed me to start a download using transmission-cli and then continue using transmission-daemon.

And finally to get everything started up automatically on a reboot I wrote a small script and invoked it /etc/rc.d/rc.local. rc.local made a call to the script startTransmission.sh which contains the following lines of code:

  # Starts the transmission daemon
  transmission-daemon
  # Verifies already downloaded files for the first torrent in the list
  transmission-remote -t 1 -v &
  # Gets file# as I don't have enough space to download the full torrent
  transmission-remote -t 1 -g 1,5,6,7,8,9,10

With that my project came to an end. Will append and update this blog post if I think of anything later.

Update:
One more useful link to remember is this one which helps to autostart GUI applicaitons on different desktops. If I ever need it this will be good to remember.

Update:
While searching for alternatives to allow a central file server, I found this link which claims to be a tool to remotely login into puppy. I've not tried it out, but it maybe a useful one to try